40 |
40 |
41 # robots control |
41 # robots control |
42 NOINDEX = u'<meta name="ROBOTS" content="NOINDEX" />' |
42 NOINDEX = u'<meta name="ROBOTS" content="NOINDEX" />' |
43 NOFOLLOW = u'<meta name="ROBOTS" content="NOFOLLOW" />' |
43 NOFOLLOW = u'<meta name="ROBOTS" content="NOFOLLOW" />' |
44 |
44 |
45 CW_XHTML_EXTENSIONS = '''[ |
|
46 <!ATTLIST html xmlns:cubicweb CDATA #FIXED \'http://www.logilab.org/2008/cubicweb\' > |
|
47 |
|
48 <!ENTITY % coreattrs |
|
49 "id ID #IMPLIED |
|
50 class CDATA #IMPLIED |
|
51 style CDATA #IMPLIED |
|
52 title CDATA #IMPLIED |
|
53 |
|
54 cubicweb:accesskey CDATA #IMPLIED |
|
55 cubicweb:actualrql CDATA #IMPLIED |
|
56 cubicweb:dataurl CDATA #IMPLIED |
|
57 cubicweb:facetName CDATA #IMPLIED |
|
58 cubicweb:facetargs CDATA #IMPLIED |
|
59 cubicweb:fallbackvid CDATA #IMPLIED |
|
60 cubicweb:fname CDATA #IMPLIED |
|
61 cubicweb:initfunc CDATA #IMPLIED |
|
62 cubicweb:inputid CDATA #IMPLIED |
|
63 cubicweb:inputname CDATA #IMPLIED |
|
64 cubicweb:limit CDATA #IMPLIED |
|
65 cubicweb:loadtype CDATA #IMPLIED |
|
66 cubicweb:loadurl CDATA #IMPLIED |
|
67 cubicweb:maxlength CDATA #IMPLIED |
|
68 cubicweb:required CDATA #IMPLIED |
|
69 cubicweb:rooteid CDATA #IMPLIED |
|
70 cubicweb:rql CDATA #IMPLIED |
|
71 cubicweb:size CDATA #IMPLIED |
|
72 cubicweb:sortvalue CDATA #IMPLIED |
|
73 cubicweb:target CDATA #IMPLIED |
|
74 cubicweb:tindex CDATA #IMPLIED |
|
75 cubicweb:tlunit CDATA #IMPLIED |
|
76 cubicweb:type CDATA #IMPLIED |
|
77 cubicweb:unselimg CDATA #IMPLIED |
|
78 cubicweb:uselabel CDATA #IMPLIED |
|
79 cubicweb:value CDATA #IMPLIED |
|
80 cubicweb:variables CDATA #IMPLIED |
|
81 cubicweb:vid CDATA #IMPLIED |
|
82 cubicweb:wdgtype CDATA #IMPLIED |
|
83 "> ] ''' |
|
84 |
|
85 TRANSITIONAL_DOCTYPE = u'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" %s>\n' % CW_XHTML_EXTENSIONS |
|
86 TRANSITIONAL_DOCTYPE_NOEXT = u'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n' |
45 TRANSITIONAL_DOCTYPE_NOEXT = u'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n' |
87 STRICT_DOCTYPE = u'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" %s>\n' % CW_XHTML_EXTENSIONS |
46 TRANSITIONAL_DOCTYPE = TRANSITIONAL_DOCTYPE_NOEXT # bw compat |
|
47 |
88 STRICT_DOCTYPE_NOEXT = u'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n' |
48 STRICT_DOCTYPE_NOEXT = u'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n' |
|
49 STRICT_DOCTYPE = STRICT_DOCTYPE_NOEXT # bw compat |
89 |
50 |
90 # base view object ############################################################ |
51 # base view object ############################################################ |
91 |
52 |
92 class View(AppObject): |
53 class View(AppObject): |
93 """This class is an abstraction of a view class, used as a base class for |
54 """This class is an abstraction of a view class, used as a base class for |
508 """main template are primary access point to render a full HTML page. |
469 """main template are primary access point to render a full HTML page. |
509 There is usually at least a regular main template and a simple fallback |
470 There is usually at least a regular main template and a simple fallback |
510 one to display error if the first one failed |
471 one to display error if the first one failed |
511 """ |
472 """ |
512 |
473 |
513 @property |
474 doctype = STRICT_DOCTYPE |
514 def doctype(self): |
|
515 if self._cw.xhtml_browser(): |
|
516 return STRICT_DOCTYPE |
|
517 return STRICT_DOCTYPE_NOEXT |
|
518 |
475 |
519 def set_stream(self, w=None): |
476 def set_stream(self, w=None): |
520 if self.w is not None: |
477 if self.w is not None: |
521 return |
478 return |
522 if w is None: |
479 if w is None: |