You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An exception `AttributeError` is raised when `child.targets[0]` does not have an attribute `name`, as stated in the issue #284 .
`meta.get_children()` returns all children of the `Meta` class, which in the sample code contains a dictionary assignment.
The expected children are of type `Assign` whose first item in the attribute `targets` is of type `AssignName`, like `AssignName.widgets(name='widgets')`.
An instruction like `widget["field"] = forms.SomeWidget` will result in a `Assign` child containing a `Subscript(ctx=<Context.Store: 2>, value=<Name.widgets ...>, slice=<Index ...>)`. This is of course unexpected.
I guess other unexpected instructions in the `Meta` class can trigger similar errors, so probably the most economic solution is to enclose the code in `try... except` and ignore the `AttributeError`. Trying to identify the type of object before accessing the `name` attribute would probably incur in a slower execution.
0 commit comments