10 from cm.security import get_viewable_activities |
10 from cm.security import get_viewable_activities |
11 from cm.models import ApplicationConfiguration, Activity, Configuration |
11 from cm.models import ApplicationConfiguration, Activity, Configuration |
12 import time |
12 import time |
13 from cm.exception import UnauthorizedException |
13 from cm.exception import UnauthorizedException |
14 import re |
14 import re |
|
15 from urlparse import urlparse |
15 # taken from django's feedgenerator.py and changed to support multiple posts in minute |
16 # taken from django's feedgenerator.py and changed to support multiple posts in minute |
16 def get_tag_uri(url, date): |
17 def get_tag_uri(url, date): |
17 "Creates a TagURI. See http://diveintomark.org/archives/2004/05/28/howto-atom-id" |
18 "Creates a TagURI. See http://diveintomark.org/archives/2004/05/28/howto-atom-id" |
18 tag = re.sub('^http://', '', url) |
19 parsed_url = urlparse(url) |
19 if date is not None: |
20 time_stp = time.mktime(date.timetuple()) if date is not None else '' |
20 tag = re.sub('/', ',%s:/' % time.mktime(date.timetuple()), tag, 1) |
21 return u'tag:%s,%s:%s' %(parsed_url.hostname, time_stp, parsed_url.path) # + '/' + parsed_url.fragment |
21 tag = re.sub('#', '/', tag) |
|
22 return u'tag:' + tag |
|
23 |
22 |
24 |
23 |
25 def public_feed(request): |
24 def public_feed(request): |
26 feed_title = _(u"%(workspace_name)s's public feed" % {'workspace_name' : ApplicationConfiguration['workspace_name']}) |
25 feed_title = _(u"%(workspace_name)s's public feed" % {'workspace_name' : ApplicationConfiguration['workspace_name']}) |
27 feed_description = _(u"Workspace %(workspace_name)s public activity feed") % {'workspace_name' : ApplicationConfiguration['workspace_name']} |
26 feed_description = _(u"Workspace %(workspace_name)s public activity feed") % {'workspace_name' : ApplicationConfiguration['workspace_name']} |