Skip to content

Commit

Permalink
Move parent & oid initialization to the top
Browse files Browse the repository at this point in the history
  • Loading branch information
ezag committed Oct 23, 2021
1 parent 28e451b commit c896125
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions deform/field.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,11 @@ def __init__(
):
self.counter = counter or itertools.count()
self.order = next(self.counter)
if parent is not None:
parent = weakref.ref(parent)
self._parent = parent
oid_prefix = getattr(self.get_root(), "formid", "deform")
self.oid = getattr(schema, "oid", f"{oid_prefix}Field{self.order}")
self.schema = schema
self.typ = schema.typ # required by Invalid exception
self.name = schema.name
Expand Down Expand Up @@ -221,11 +226,6 @@ def __init__(

self.resource_registry = resource_registry
self.children = []
if parent is not None:
parent = weakref.ref(parent)
self._parent = parent
oid_prefix = getattr(self.get_root(), "formid", "deform")
self.oid = getattr(schema, "oid", f"{oid_prefix}Field{self.order}")
self.__dict__.update(kw)

first_input_index = -1
Expand Down

0 comments on commit c896125

Please sign in to comment.