Commit c362b81a authored by Jim Fulton's avatar Jim Fulton

Several changes to fix bugs introduced when trying to make

setting headers work.

Modified basic template template to use standard header and standard
footer.

Made it more convenient to use manage_addDocument outside of web
context.
parent a2fbee09
"""Document object""" """Document object"""
__version__='$Revision: 1.7 $'[11:-2] __version__='$Revision: 1.8 $'[11:-2]
from STPDocumentTemplate import HTML from STPDocumentTemplate import HTML
from Globals import HTMLFile from Globals import HTMLFile
from string import join, split, strip from string import join, split, strip, rfind
import AccessControl.ACL import AccessControl.ACL
import regex import regex
...@@ -26,11 +26,18 @@ class Document(HTML, AccessControl.ACL.RoleManager): ...@@ -26,11 +26,18 @@ class Document(HTML, AccessControl.ACL.RoleManager):
<input type=text name=roles SIZE="50" value="%s"></td></tr> <input type=text name=roles SIZE="50" value="%s"></td></tr>
</table>""" % (self.title, roles)) </table>""" % (self.title, roles))
def index_html(self, REQUEST, PARENTS, RESPONSE):
"""Run the document as a web object with possible HTTP headers""" def initvars(self, mapping, vars):
return decapitate(self(PARENTS[1],REQUEST), RESPONSE) """Hook to override signature so we can detect whether we are
running from the web"""
HTML.initvars(self, mapping, vars)
self.func_code.__init__(('self','REQUEST','RESPONSE'))
self.func_defaults=(None,)
def __call__(self, client=None, REQUEST={}, RESPONSE=None, **kw):
r=apply(HTML.__call__, (self, client, REQUEST), kw)
if RESPONSE is None: return r
return decapitate(r, RESPONSE)
def manage_edit(self,data,title,roles,REQUEST=None): def manage_edit(self,data,title,roles,REQUEST=None):
"""Edit method""" """Edit method"""
...@@ -41,15 +48,9 @@ class Document(HTML, AccessControl.ACL.RoleManager): ...@@ -41,15 +48,9 @@ class Document(HTML, AccessControl.ACL.RoleManager):
default_html=""" default_html="""<!--#var standard_html_header-->
<HTML>
<HEAD>
<TITLE>New Document</TITLE>
</HEAD>
<BODY>
New Document New Document
</BODY> <!--#var standard_html_footer-->"""
</HTML>"""
class DocumentHandler: class DocumentHandler:
...@@ -65,7 +66,7 @@ class DocumentHandler: ...@@ -65,7 +66,7 @@ class DocumentHandler:
i.title=title i.title=title
i.parse_roles_string(roles) i.parse_roles_string(roles)
self._setObject(id,i) self._setObject(id,i)
return self.manage_main(self,REQUEST) if REQUEST: return self.manage_main(self,REQUEST)
def documentIds(self): def documentIds(self):
t=[] t=[]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment