Show More
@@ -145,7 +145,12 b' class BaseModel(object):' | |||
|
145 | 145 | def delete(cls, id_): |
|
146 | 146 | obj = cls.query().get(id_) |
|
147 | 147 | Session.delete(obj) |
|
148 | ||
|
148 | ||
|
149 | def __repr__(self): | |
|
150 | if hasattr(self, '__unicode__'): | |
|
151 | # python repr needs to return str | |
|
152 | return safe_str(self.__unicode__()) | |
|
153 | return '<DB:%s>' % (self.__class__.__name__) | |
|
149 | 154 | |
|
150 | 155 | class RhodeCodeSetting(Base, BaseModel): |
|
151 | 156 | __tablename__ = 'rhodecode_settings' |
@@ -183,8 +188,8 b' class RhodeCodeSetting(Base, BaseModel):' | |||
|
183 | 188 | """ |
|
184 | 189 | self._app_settings_value = safe_unicode(val) |
|
185 | 190 | |
|
186 |
def __ |
|
|
187 | return "<%s('%s:%s')>" % ( | |
|
191 | def __unicode__(self): | |
|
192 | return u"<%s('%s:%s')>" % ( | |
|
188 | 193 | self.__class__.__name__, |
|
189 | 194 | self.app_settings_name, self.app_settings_value |
|
190 | 195 | ) |
@@ -333,8 +338,8 b' class User(Base, BaseModel):' | |||
|
333 | 338 | def is_admin(self): |
|
334 | 339 | return self.admin |
|
335 | 340 | |
|
336 |
def __ |
|
|
337 | return "<%s('id:%s:%s')>" % (self.__class__.__name__, | |
|
341 | def __unicode__(self): | |
|
342 | return u"<%s('id:%s:%s')>" % (self.__class__.__name__, | |
|
338 | 343 | self.user_id, self.username) |
|
339 | 344 | |
|
340 | 345 | @classmethod |
@@ -429,8 +434,8 b' class UsersGroup(Base, BaseModel):' | |||
|
429 | 434 | users_group_to_perm = relationship('UsersGroupToPerm', cascade='all') |
|
430 | 435 | users_group_repo_to_perm = relationship('UsersGroupRepoToPerm', cascade='all') |
|
431 | 436 | |
|
432 |
def __ |
|
|
433 | return '<userGroup(%s)>' % (self.users_group_name) | |
|
437 | def __unicode__(self): | |
|
438 | return u'<userGroup(%s)>' % (self.users_group_name) | |
|
434 | 439 | |
|
435 | 440 | @classmethod |
|
436 | 441 | def get_by_group_name(cls, group_name, cache=False, |
@@ -508,9 +513,9 b' class Repository(Base, BaseModel):' | |||
|
508 | 513 | |
|
509 | 514 | logs = relationship('UserLog') |
|
510 | 515 | |
|
511 |
def __ |
|
|
512 | return "<%s('%s:%s')>" % (self.__class__.__name__, | |
|
513 |
|
|
|
516 | def __unicode__(self): | |
|
517 | return u"<%s('%s:%s')>" % (self.__class__.__name__,self.repo_id, | |
|
518 | self.repo_name) | |
|
514 | 519 | |
|
515 | 520 | @classmethod |
|
516 | 521 | def url_sep(cls): |
@@ -748,8 +753,8 b' class RepoGroup(Base, BaseModel):' | |||
|
748 | 753 | self.group_name = group_name |
|
749 | 754 | self.parent_group = parent_group |
|
750 | 755 | |
|
751 |
def __ |
|
|
752 | return "<%s('%s:%s')>" % (self.__class__.__name__, self.group_id, | |
|
756 | def __unicode__(self): | |
|
757 | return u"<%s('%s:%s')>" % (self.__class__.__name__, self.group_id, | |
|
753 | 758 | self.group_name) |
|
754 | 759 | |
|
755 | 760 | @classmethod |
@@ -865,8 +870,8 b' class Permission(Base, BaseModel):' | |||
|
865 | 870 | permission_name = Column("permission_name", String(length=255, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) |
|
866 | 871 | permission_longname = Column("permission_longname", String(length=255, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) |
|
867 | 872 | |
|
868 |
def __ |
|
|
869 | return "<%s('%s:%s')>" % ( | |
|
873 | def __unicode__(self): | |
|
874 | return u"<%s('%s:%s')>" % ( | |
|
870 | 875 | self.__class__.__name__, self.permission_id, self.permission_name |
|
871 | 876 | ) |
|
872 | 877 | |
@@ -918,8 +923,8 b' class UserRepoToPerm(Base, BaseModel):' | |||
|
918 | 923 | Session.add(n) |
|
919 | 924 | return n |
|
920 | 925 | |
|
921 |
def __ |
|
|
922 | return '<user:%s => %s >' % (self.user, self.repository) | |
|
926 | def __unicode__(self): | |
|
927 | return u'<user:%s => %s >' % (self.user, self.repository) | |
|
923 | 928 | |
|
924 | 929 | |
|
925 | 930 | class UserToPerm(Base, BaseModel): |
@@ -962,8 +967,8 b' class UsersGroupRepoToPerm(Base, BaseMod' | |||
|
962 | 967 | Session.add(n) |
|
963 | 968 | return n |
|
964 | 969 | |
|
965 |
def __ |
|
|
966 | return '<userGroup:%s => %s >' % (self.users_group, self.repository) | |
|
970 | def __unicode__(self): | |
|
971 | return u'<userGroup:%s => %s >' % (self.users_group, self.repository) | |
|
967 | 972 | |
|
968 | 973 | |
|
969 | 974 | class UsersGroupToPerm(Base, BaseModel): |
@@ -1076,8 +1081,8 b' class CacheInvalidation(Base, BaseModel)' | |||
|
1076 | 1081 | self.cache_args = cache_args |
|
1077 | 1082 | self.cache_active = False |
|
1078 | 1083 | |
|
1079 |
def __ |
|
|
1080 | return "<%s('%s:%s')>" % (self.__class__.__name__, | |
|
1084 | def __unicode__(self): | |
|
1085 | return u"<%s('%s:%s')>" % (self.__class__.__name__, | |
|
1081 | 1086 | self.cache_id, self.cache_key) |
|
1082 | 1087 | @classmethod |
|
1083 | 1088 | def clear_cache(cls): |
@@ -112,6 +112,7 b' class NotificationModel(BaseModel):' | |||
|
112 | 112 | kwargs.update(email_kwargs) |
|
113 | 113 | email_body_html = EmailNotificationModel()\ |
|
114 | 114 | .get_email_tmpl(type_, **kwargs) |
|
115 | ||
|
115 | 116 | run_task(tasks.send_email, rec.email, email_subject, email_body, |
|
116 | 117 | email_body_html) |
|
117 | 118 | |
@@ -183,6 +184,7 b' class NotificationModel(BaseModel):' | |||
|
183 | 184 | else: |
|
184 | 185 | DTF = lambda d: datetime.datetime.strftime(d, DATETIME_FORMAT) |
|
185 | 186 | when = DTF(notification.created_on) |
|
187 | ||
|
186 | 188 | data = dict( |
|
187 | 189 | user=notification.created_by_user.username, |
|
188 | 190 | action=_map[notification.type_], when=when, |
General Comments 0
You need to be logged in to leave comments.
Login now