Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

various clean-ups from recent contributions from others

  • Loading branch information...
commit 55f718ae2eaf37514a2afe72dc3e5cf76c8e4901 1 parent d097e77
@brosner brosner authored
View
15 notification/models.py
@@ -401,10 +401,11 @@ class Meta:
verbose_name = _('observed item')
verbose_name_plural = _('observed items')
- def send_notice(self, kwargs = {}):
- values ={'observed': self.observed_object}
- values.update(kwargs)
- send([self.user], self.notice_type.label, values)
+ def send_notice(self, extra_context=None):
+ if extra_context is None:
+ extra_context = {}
+ extra_context.update({'observed': self.observed_object})
+ send([self.user], self.notice_type.label, extra_context)
def observe(observed, observer, notice_type_label, signal='post_save'):
"""
@@ -425,13 +426,15 @@ def stop_observing(observed, observer, signal='post_save'):
observed_item = ObservedItem.objects.get_for(observed, observer, signal)
observed_item.delete()
-def send_observation_notices_for(observed, signal='post_save', kwargs = {}):
+def send_observation_notices_for(observed, signal='post_save', extra_context=None):
"""
Send a notice for each registered user about an observed object.
"""
+ if extra_context is None:
+ extra_context = {}
observed_items = ObservedItem.objects.all_for(observed, signal)
for observed_item in observed_items:
- observed_item.send_notice(kwargs)
+ observed_item.send_notice(extra_context)
return observed_items
def is_observing(observed, observer, signal='post_save'):
View
4 notification/urls.py
@@ -4,8 +4,8 @@
urlpatterns = patterns('',
url(r'^$', notices, name="notification_notices"),
- url(r'^settings$', notice_settings, name="notification_notice_settings"),
- url(r'^(\d+)/$', single, name="notification_notice"),
+ url(r'^settings/$', notice_settings, name="notification_notice_settings"),
+ url(r'^(\d+)/$', single, name="notification_notice"),
url(r'^feed/$', feed_for_user, name="notification_feed_for_user"),
url(r'^mark_all_seen/$', mark_all_seen, name="notification_mark_all_seen"),
)
View
2  notification/views.py
@@ -37,7 +37,7 @@ def notices(request):
return render_to_response("notification/notices.html", {
"notices": notices,
}, context_instance=RequestContext(request))
-
+
@login_required
def notice_settings(request):
"""
Please sign in to comment.
Something went wrong with that request. Please try again.