Alessandro Molina avatar Alessandro Molina committed 26994e7

Fix issue with caching articles

Comments (0)

Files changed (2)

-    version='0.2',
+    version='0.2.1',
     description='Pluggable Minimalistic Blog for TurboGears2 with Attachments and Tags',
     author='Alessandro Molina',


-from tg import expose
+from tg import expose, request
 from model import Article, Tagging
-from tgext.pluggable import plug_url
+from tgext.pluggable import plug_url, primary_key, app_model
 from tgext.tagging import TagCloud
 from smallpress.lib.forms import SearchForm
 def article_preview(article):
-    return dict(article=article, tg_cache=dict(key='%s-%s' % (article.uid,
-                                                              article.update_date.strftime('%Y-%m-%d_%H:%M:%S')),
+    user = 'anonymous'
+    if request.identity:
+        user = getattr(request.identity['user'], primary_key(app_model.User).key)
+    return dict(article=article, tg_cache=dict(key='%s-%s-%s' % (article.uid, user,
+                                                                 article.update_date.strftime('%Y-%m-%d_%H:%M:%S')),
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.