Commit 2acdfa26 authored by Jim Fulton's avatar Jim Fulton

Moved function masquerating data to class from instance.

parent f5e4768a
...@@ -9,6 +9,13 @@ class String: ...@@ -9,6 +9,13 @@ class String:
__doc__=DT_Doc.String__doc__ __doc__=DT_Doc.String__doc__
isDocTemp=1 isDocTemp=1
# Document Templates masquerade as functions:
class func_code: pass
func_code=func_code()
func_code.co_varnames='self','REQUEST'
func_code.co_argcount=2
func_defaults=()
def errQuote(self, s): return s def errQuote(self, s): return s
def parse_error(self, mess, tag, text, start): def parse_error(self, mess, tag, text, start):
...@@ -245,9 +252,7 @@ class String: ...@@ -245,9 +252,7 @@ class String:
if globals: if globals:
for k in globals.keys(): for k in globals.keys():
if k[:1] != '_' and not vars.has_key(k): vars[k]=globals[k] if k[:1] != '_' and not vars.has_key(k): vars[k]=globals[k]
self.func_defaults=()
self.globals=vars self.globals=vars
self.func_code=func_code()
self._vars={} self._vars={}
__state_names__=('raw', 'globals', '__name__', '_vars') __state_names__=('raw', 'globals', '__name__', '_vars')
...@@ -410,8 +415,3 @@ class File(FileMixin, String): ...@@ -410,8 +415,3 @@ class File(FileMixin, String):
""" """
def manage_edit(self,data): raise TypeError, 'cannot edit files' def manage_edit(self,data): raise TypeError, 'cannot edit files'
class func_code:
def __init__(self,varnames=('self','REQUEST')):
self.co_varnames=varnames
self.co_argcount=len(varnames)
"""Document object""" """Document object"""
__version__='$Revision: 1.29 $'[11:-2] __version__='$Revision: 1.30 $'[11:-2]
from Globals import HTML, HTMLFile from Globals import HTML, HTMLFile
from string import join,split,strip,rfind,atoi from string import join,split,strip,rfind,atoi
...@@ -15,6 +15,12 @@ class Document(HTML, RoleManager, SimpleItem.Item_w__name__, ...@@ -15,6 +15,12 @@ class Document(HTML, RoleManager, SimpleItem.Item_w__name__,
icon ='OFS/Document_icon.gif' icon ='OFS/Document_icon.gif'
__state_names__=HTML.__state_names__+('title','__roles__') __state_names__=HTML.__state_names__+('title','__roles__')
# Documents masquerade as functions:
class func_code: pass
func_code=func_code()
func_code.co_varnames='self','REQUEST','RESPONSE'
func_code.co_argcount=3
manage_options=({'icon':'', 'label':'Edit', manage_options=({'icon':'', 'label':'Edit',
'action':'manage_main', 'target':'manage_main', 'action':'manage_main', 'target':'manage_main',
}, },
...@@ -29,13 +35,6 @@ class Document(HTML, RoleManager, SimpleItem.Item_w__name__, ...@@ -29,13 +35,6 @@ class Document(HTML, RoleManager, SimpleItem.Item_w__name__,
}, },
) )
def initvars(self, mapping, vars):
"""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): def __call__(self, client=None, REQUEST={}, RESPONSE=None, **kw):
kw['document_id'] =self.id kw['document_id'] =self.id
kw['document_title']=self.title kw['document_title']=self.title
......
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