Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
pieterproigia opened this issue Jan 8, 2014 · 0 comments
Open

Comments

@pieterproigia
Copy link
Contributor

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'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant