--- a/web/request.py Tue Nov 10 15:46:34 2009 +0100
+++ b/web/request.py Tue Nov 10 18:11:24 2009 +0100
@@ -25,7 +25,7 @@
from cubicweb.dbapi import DBAPIRequest
from cubicweb.common.mail import header
from cubicweb.common.uilib import remove_html_tags
-from cubicweb.utils import SizeConstrainedList, HTMLHead
+from cubicweb.utils import SizeConstrainedList, HTMLHead, make_uid
from cubicweb.view import STRICT_DOCTYPE, TRANSITIONAL_DOCTYPE_NOEXT
from cubicweb.web import (INTERNAL_FIELD_VALUE, LOGGER, NothingToEdit,
RequestError, StatusResponse)
@@ -83,10 +83,20 @@
# tabindex generator
self.tabindexgen = count(1)
self.next_tabindex = self.tabindexgen.next
- # page id, set by htmlheader template
- self.pageid = None
self.varmaker = rqlvar_maker()
self.datadir_url = self._datadir_url()
+ self._set_pageid()
+
+ def _set_pageid(self):
+ """initialize self.pageid
+ if req.form provides a specific pageid, use it, otherwise build a
+ new one.
+ """
+ pid = self.form.get('pageid')
+ if pid is None:
+ pid = make_uid(id(self))
+ self.pageid = pid
+ self.html_headers.define_var('pageid', pid)
def set_connection(self, cnx, user=None):
"""method called by the session handler when the user is authenticated