Mercurial > kallithea
diff rhodecode/model/notification.py @ 1716:7d1fc253549e beta
notification to commit author + gardening
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Wed, 23 Nov 2011 22:46:14 +0200 |
parents | 54687aa00724 |
children | 7ff304d3028f |
line wrap: on
line diff
--- a/rhodecode/model/notification.py Wed Nov 23 22:26:54 2011 +0200 +++ b/rhodecode/model/notification.py Wed Nov 23 22:46:14 2011 +0200 @@ -36,19 +36,15 @@ log = logging.getLogger(__name__) + class NotificationModel(BaseModel): def __get_user(self, user): - if isinstance(user, User): - return user - elif isinstance(user, basestring): + if isinstance(user, basestring): return User.get_by_username(username=user) - elif isinstance(user, int): - return User.get(user) else: - raise Exception('Unsupported user must be one of int,' - 'str or User object') + return self._get_instance(User, user) def __get_notification(self, notification): if isinstance(notification, Notification): @@ -82,7 +78,9 @@ recipients_objs = [] for u in recipients: - recipients_objs.append(self.__get_user(u)) + obj = self.__get_user(u) + if obj: + recipients_objs.append(obj) recipients_objs = set(recipients_objs) return Notification.create(created_by=created_by_obj, subject=subject, body=body, recipients=recipients_objs,