Inheritance in WidgetsList classes doesn't work as I'd expect. For example,
suppose I want to make a class hierarchy where a single base class contains a
bunch of shared fields, and child classes add extra fields as needed:
class BaseUserFields(widgets.WidgetsList):
email_address = widgets.TextField()
display_name = widgets.TextField()
password = widgets.PasswordField()
class EditUser(BaseUserFields):
# ID of the user we're editing
user_id = widgets.HiddenField()
class AddUser(BaseUserFields):
# We don't have a username yet, so get one
user_name = widgets.TextField()
However, when I display the children as forms, I only see the fields defined
directly in the children and none of the parent's fields.
First, how is that even possible? I've never seen a Python class that behaves
that way (not meant as a criticism, but genuinely curious).
Second, are there idiomatic workarounds?
Third, my example is pretty close to a real problem I'm trying to solve. How
would you solve this particular case?
--
Kirk Strauser
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---