Roy Smith wrote:
class User(Document):
    @staticmethod
    def _get_next_id():
[blah, blah, blah] return id

    user_id = IntField(required=True, default=_get_next_id)

If you don't call '_get_next_id()' from any class methods (in other words, if you don't need to ever say 'self._gen_next_id()') then you can remove the '@staticmethod':

    def _get_next_id():
      [blah, blah, blah]
      return id

    user_id = IntField(required=True, default=_get_next_id)

If you do need to sometimes call it from a method then still leave off the '@staticmethod', and give 'self' a default of 'None':

    def _get_next_id(self=None):
      [blah, blah, blah]
      return id

    user_id = IntField(required=True, default=_get_next_id)

~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to