[Zope-dev] product creation woes..

Geir Bækholt Hansen Geir B Hansen <geirh@funcom.com>
Wed, 5 Apr 2000 11:18:28 +0200


sorry for asking the list again, but i got no answers
earlier, and i really need assistance on this one...

How can i make a product include std_header and _footer when
called ??

Tweaking JOhanc's IEmethod, i  managed to return them from a redefined
__call__ function, but this only works if standard_html_header
doesn't try to call other methods.. If standard_html_header
refers to other methods, i get name-errors, as  if the
methods didn't exist...

what am i missing ?

--
Geir Bækholt Hansen
web-developer/designer
geirh@funcom.com
http://www.funcom.com





        def __call__(self, client=None, REQUEST={}, RESPONSE=None, **kw):
                """Render the document given a client object, REQUEST mapping,
                Response, and key word arguments."""
                kw['document_id']   =self.id
                kw['document_title']=self.title
                if hasattr(self, 'aq_explicit'): bself=self.aq_explicit
                else: bself=self
                if client is None:
                    # Called as subtemplate, so don't need error propigation!
                    r=apply(HTML.__call__, (self, bself, REQUEST), kw)
                    if RESPONSE is None: return r
                    return decapitate(r, RESPONSE)
        
                r=apply(HTML.__call__, (self, (client, bself), REQUEST), kw)
                if type(r) is not type(''): return r
                if RESPONSE is None: return r
        
                hh=RESPONSE.headers.has_key
                if not (hh('content-type') or hh('Content-Type')):
                    if self.__dict__.has_key('content_type'):
                        c=self.content_type
                    else:
                        c, e=guess_content_type(self.__name__, r)
                    RESPONSE.setHeader('Content-Type', c)

                std_html_header= apply(HTML.__call__, (self.standard_html_header, bself, REQUEST), kw)
                std_html_footer= apply(HTML.__call__, (self.standard_html_footer, bself, REQUEST), kw)
                
                out = std_html_header + r + std_html_footer
                return out