Skip to content

Inheritence as explained in the Design Document does not work #32

@pieterproigia

Description

@pieterproigia

Inheritence as described in http://tw2core.readthedocs.org/en/latest/design/#declarative-instantiation does not work. Example code:

import tw2.core as twc
import tw2.devtools
import tw2.forms as twf

class Index(twf.FormPage):
    class MyFields(twc.CompoundWidget):
        b = twf.TextArea()
        x = twf.Label(text='this is a test')
        c = twf.TextField()

    class TableFields(MyFields, twf.TableLayout):
        pass

    class ListFields(MyFields, twf.ListLayout):
        b = twf.TextField()

tw2.devtools.dev_server()

Gives the following error:

Traceback (most recent call last):
  File "myapp.py", line 5, in <module>
    class Index(twf.FormPage):
  File "myapp.py", line 15, in Index
    class ListFields(MyFields, twf.ListLayout):
  File "/home/pieter/.virtualenvs/tw2dev/local/lib/python2.7/site-packages/tw2/core/widgets.py", line 81, in __new__
    w.post_define.__func__(widget)
  File "/home/pieter/.virtualenvs/tw2dev/local/lib/python2.7/site-packages/tw2/core/widgets.py", line 604, in post_define
    raise core.WidgetError("Duplicate id '%s'" % c.id)
tw2.core.core.WidgetError: Duplicate id 'b'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions