class State(SQLObject):
ABBREVIATION_LENGTH = 2
NAME_LENGTH = name_field_length
abbreviation = StringCol(length=ABBREVIATION_LENGTH,
alternateID=True)
name = StringCol(length=NAME_LENGTH)
# class methods
def optionList():
list = []
for state in State.select(orderBy=State.q.abbreviation):
list.append((state.id, state.abbreviation))
return list
>>> State.optionList()
Traceback (most recent call last):
File "<console>", line 1, in ?
TypeError: unbound method optionList() must be called with State
instance as fir
st argument (got nothing instead)
Don't get this one. Why is python treating this like an instance
method? And yes, the indents line up in the original source.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---