def __init__(self, *args, **kwargs): super(Audited, self).__init__(*args, **kwargs) def before_put_trigger(this): if not this.is_saved(): this.creator_id = users.get_current_user().user_id() else: this.updater_id = users.get_current_user().user_id() self.add_before_put_trigger(before_put_trigger) from tickuser import TickUser self.add_to_simple_field_mapping( 'creator', lambda this: TickUser.get_by_user_id(this.creator_id).tick_name) self.add_to_simple_field_mapping( 'creator_gravatar', lambda this: TickUser.get_by_user_id( this.creator_id).gravatar_link()) self.add_to_simple_field_mapping( 'updater', lambda this: TickUser.get_by_user_id(this.updater_id).tick_name) self.add_to_simple_field_mapping( 'updater_gravatar', lambda this: TickUser.get_by_user_id( this.updater_id).gravatar_link()) self.add_to_simple_field_mapping('age', lambda this: this.age())
def __init__(self,*args,**kwargs): super(Audited,self).__init__(*args,**kwargs) def before_put_trigger(this): if not this.is_saved(): this.creator_id = users.get_current_user().user_id() else: this.updater_id = users.get_current_user().user_id() self.add_before_put_trigger(before_put_trigger) from tickuser import TickUser self.add_to_simple_field_mapping('creator',lambda this: TickUser.get_by_user_id(this.creator_id).tick_name) self.add_to_simple_field_mapping('creator_gravatar',lambda this: TickUser.get_by_user_id(this.creator_id).gravatar_link()) self.add_to_simple_field_mapping('updater',lambda this: TickUser.get_by_user_id(this.updater_id).tick_name) self.add_to_simple_field_mapping('updater_gravatar',lambda this: TickUser.get_by_user_id(this.updater_id).gravatar_link()) self.add_to_simple_field_mapping('age',lambda this: this.age())
def permission_emails(self): return [TickUser.get_by_user_id(id).email_address for id in self.specified_permissions]