Permalink
Browse files

Merge branch 'master' of git://github.com/hemebond/eden

  • Loading branch information...
2 parents 2a41f73 + 1648718 commit 44e26ba7ae0ecc6c222bc66e33effdcb8c9fc539 @flavour flavour committed Oct 3, 2012
Showing with 42 additions and 9 deletions.
  1. +1 −1 models/00_utils.py
  2. +6 −0 models/tasks.py
  3. +25 −0 models/zzz_1st_run.py
  4. +6 −6 modules/eden/msg.py
  5. +4 −2 modules/s3/s3search.py
View
@@ -17,7 +17,7 @@
).first()
if search:
# Impersonate user
- user_id = auth.s3_get_user_id(search.pe_id)
+ user_id = auth.s3_get_user_id(pe_id=search.pe_id)
if user_id:
# Impersonate the user who is subscribed to this saved search
View
@@ -166,6 +166,12 @@ def msg_parse_workflow(workflow, source, user_id):
tasks["msg_parse_workflow"] = msg_parse_workflow
+ # --------------------------------------------------------------------------
+ def msg_search_subscription_notifications(frequency):
+ return eden.msg.search_subscription_notifications(frequency=frequency)
+
+ tasks["msg_search_subscription_notifications"] = msg_search_subscription_notifications
+
# -----------------------------------------------------------------------------
if settings.has_module("stats"):
View
@@ -100,6 +100,31 @@
timeout=300, # seconds
repeats=0 # unlimited
)
+ # saved search notifications
+ s3task.schedule_task("msg_search_subscription_notifications",
+ vars={"frequency":"hourly"},
+ period=3600,
+ timeout=300,
+ repeats=0
+ )
+ s3task.schedule_task("msg_search_subscription_notifications",
+ vars={"frequency":"daily"},
+ period=86400,
+ timeout=300,
+ repeats=0
+ )
+ s3task.schedule_task("msg_search_subscription_notifications",
+ vars={"frequency":"weekly"},
+ period=604800,
+ timeout=300,
+ repeats=0
+ )
+ s3task.schedule_task("msg_search_subscription_notifications",
+ vars={"frequency":"monthly"},
+ period=2419200,
+ timeout=300,
+ repeats=0
+ )
# Daily maintenance
s3task.schedule_task("maintenance",
View
@@ -735,7 +735,7 @@ class S3ParsingModel(S3Model):
def model(self):
T = current.T
-
+
# ---------------------------------------------------------------------
#
# Link between Message Sources and Workflows in parser.py
@@ -747,9 +747,9 @@ def model(self):
represent = self.source_represent,
),
Field("workflow_task_id",
- label = T("Workflow")),
+ label = T("Workflow")),
*s3_meta_fields())
-
+
# ---------------------------------------------------------------------
#
# Login sessions for Message Parsing
@@ -764,7 +764,7 @@ def model(self):
default = False),
Field("sender"),
*s3_meta_fields())
-
+
# ---------------------------------------------------------------------
#
# Keywords for Message Parsing
@@ -794,7 +794,7 @@ def model(self):
@staticmethod
def source_represent(id, show_link=True):
""" Represent a Message Source in the Workflow Table """
-
+
db = current.db
stable = db.msg_inbound_email_settings
wtable = db.msg_workflow
@@ -833,7 +833,7 @@ def search_subscription_notifications(frequency):
import urlparse
from urllib import urlencode
from uuid import uuid4
-
+
try:
import json # try stdlib (Python 2.6)
except ImportError:
View
@@ -1114,7 +1114,7 @@ def save_search_widget(self, r, query, **attr):
_id="save-search"),
SCRIPT('''
S3.search.saveOptions=%s
-S3.i18n.edit_saved_search=%s
+S3.i18n.edit_saved_search="%s"
''' % (json.dumps(save_options),
T("Edit saved search"))))
@@ -1125,6 +1125,8 @@ def email(self, r, **kwargs):
"""
Take a search request and render it through a template
to format it for email notifications.
+
+ @param r: S3Request object
"""
represent = current.manager.represent
@@ -1156,7 +1158,7 @@ def email(self, r, **kwargs):
# Get the field objects based on list_fields
fields = self.resource.readable_fields(field_names)
- #fields = [f for f in resource.readable_fields() if f.name != "id"] # We don't want to show the "id" field at all
+ # We don't want to show the "id" field at all
head_row = TR([TH(f.label) for f in fields if f.name != "id"])
new_rows = []
nappend = new_rows.append

0 comments on commit 44e26ba

Please sign in to comment.