equal
deleted
inserted
replaced
31 prepare_facets_rqlst) |
31 prepare_facets_rqlst) |
32 HAS_SEARCH_RESTRICTION = True |
32 HAS_SEARCH_RESTRICTION = True |
33 except ImportError: # gae |
33 except ImportError: # gae |
34 HAS_SEARCH_RESTRICTION = False |
34 HAS_SEARCH_RESTRICTION = False |
35 |
35 |
|
36 def xhtml_wrap_header(self): |
|
37 # XXX factor out, watch view.py ~ Maintemplate.doctype |
|
38 if not self.vreg.config['force-html-content-type'] and self.req.xhtml_browser(): |
|
39 head = (u'<?xml version="1.0"?>\n' + STRICT_DOCTYPE + |
|
40 u'<div xmlns="http://www.w3.org/1999/xhtml" xmlns:cubicweb="http://www.logilab.org/2008/cubicweb">') |
|
41 else: |
|
42 head = u'<div>' |
|
43 return head |
|
44 |
|
45 def xhtml_wrap_tail(self): |
|
46 return u'</div>' |
36 |
47 |
37 def xhtml_wrap(self, source): |
48 def xhtml_wrap(self, source): |
38 # XXX factor out, watch view.py ~ Maintemplate.doctype |
49 return u''.join((xhtml_wrap_header(self), source.strip(), xhtml_wrap_tail(self))) |
39 if self.req.xhtml_browser(): |
|
40 dt = STRICT_DOCTYPE |
|
41 else: |
|
42 dt = STRICT_DOCTYPE_NOEXT |
|
43 head = u'<?xml version="1.0"?>\n' + dt |
|
44 return head + u'<div xmlns="http://www.w3.org/1999/xhtml" xmlns:cubicweb="http://www.logilab.org/2008/cubicweb">%s</div>' % source.strip() |
|
45 |
50 |
46 def jsonize(func): |
51 def jsonize(func): |
47 """decorator to sets correct content_type and calls `simplejson.dumps` on |
52 """decorator to sets correct content_type and calls `simplejson.dumps` on |
48 results |
53 results |
49 """ |
54 """ |