Permalink
Browse files

removed remaining on_site bits

  • Loading branch information...
1 parent b8d663c commit 5cf39d029fad28ed10ce43b4fdfa68f51f9987ea @brosner brosner committed Mar 17, 2011
Showing with 6 additions and 11 deletions.
  1. +1 −3 docs/usage.txt
  2. +2 −2 notification/engine.py
  3. +3 −6 notification/models.py
View
@@ -86,7 +86,7 @@ simple way to send out a notification, for example::
One thing to note is that ``send`` is a proxy around either ``send_now`` or
``queue``. They all have the same signature::
- send(users, label, extra_context, on_site)
+ send(users, label, extra_context)
The parameters are:
@@ -95,8 +95,6 @@ The parameters are:
type.
* ``extra_content`` is a dictionary to add custom context entries to the
template used to render to notification. This is optional.
- * ``on_site`` is a boolean flag to determine whether an ``Notice`` object is
- created in the database.
``send_now`` vs. ``queue`` vs. ``send``
---------------------------------------
View
@@ -45,13 +45,13 @@ def send_all():
try:
for queued_batch in NoticeQueueBatch.objects.all():
notices = pickle.loads(str(queued_batch.pickled_data).decode("base64"))
- for user, label, extra_context, on_site, sender in notices:
+ for user, label, extra_context, sender in notices:
try:
user = User.objects.get(pk=user)
logging.info("emitting notice %s to %s" % (label, user))
# call this once per user to be atomic and allow for logging to
# accurately show how long each takes.
- notification.send_now([user], label, extra_context, on_site, sender)
+ notification.send_now([user], label, extra_context, sender)
except User.DoesNotExist:
# Ignore deleted users, just warn about them
logging.warning("not emitting notice %s to user %s since it does not exist" % (label, user))
View
@@ -128,7 +128,7 @@ def get_notification_language(user):
raise LanguageStoreNotAvailable
-def send_now(users, label, extra_context=None, on_site=True, sender=None):
+def send_now(users, label, extra_context=None, sender=None):
"""
Creates a new notice.
@@ -138,9 +138,6 @@ def send_now(users, label, extra_context=None, on_site=True, sender=None):
"spam": "eggs",
"foo": "bar",
)
-
- You can pass in on_site=False to prevent the notice emitted from being
- displayed on the site.
"""
if extra_context is None:
extra_context = {}
@@ -197,7 +194,7 @@ def send(*args, **kwargs):
return send_now(*args, **kwargs)
-def queue(users, label, extra_context=None, on_site=True, sender=None):
+def queue(users, label, extra_context=None, sender=None):
"""
Queue the notification in NoticeQueueBatch. This allows for large amounts
of user notifications to be deferred to a seperate process running outside
@@ -212,5 +209,5 @@ def queue(users, label, extra_context=None, on_site=True, sender=None):
users = [user.pk for user in users]
notices = []
for user in users:
- notices.append((user, label, extra_context, on_site, sender))
+ notices.append((user, label, extra_context, sender))
NoticeQueueBatch(pickled_data=pickle.dumps(notices).encode("base64")).save()

0 comments on commit 5cf39d0

Please sign in to comment.