web/views/basecontrollers.py
changeset 603 18c6c31bbaf4
parent 581 09f87f2c535e
child 635 305da8d6aa2d
child 643 616191014b8b
--- a/web/views/basecontrollers.py	Wed Feb 11 15:59:40 2009 +0100
+++ b/web/views/basecontrollers.py	Wed Feb 11 18:43:32 2009 +0100
@@ -452,7 +452,14 @@
         # link the new entity to the main entity
         rql = 'SET F %(rel)s T WHERE F eid %(eid_to)s, T eid %(eid_from)s' % {'rel' : rel, 'eid_to' : eid_to, 'eid_from' : eid_from}
         return eid_from
-    
+
+    def js_set_cookie(self, cookiename, cookievalue):
+        # XXX we should consider jQuery.Cookie
+        cookiename, cookievalue = str(cookiename), str(cookievalue)
+        cookies = self.req.get_cookie()
+        cookies[cookiename] = cookievalue
+        self.req.set_cookie(cookies, cookiename)
+
 class SendMailController(Controller):
     id = 'sendmail'
     require_groups = ('managers', 'users')