Example #1
0
    def _request(self,*args,**kw):
        """ perform a Zope request """

        io =cStringIO.StringIO()
        kw['fp']=io
        # Publish this module.
        testargs = (__name__,) + args
        real_stdout = sys.stdout
        garbage_out = cStringIO.StringIO()
        sys.stdout = garbage_out  # Silence, ZPublisher!
        try:
            ZPublisher.test(*testargs,**kw)
        finally:
            sys.stdout = real_stdout
        outp = io.getvalue()
        mo = self.status_regex.search(outp)

        code,txt = mo.groups()

        res = ResultObject.ResultObject()
        res.request     = args
        res.user        = kw.get('u','')
        res.code        = int(code)
        res.return_text = txt
        res.output      = outp

        return res
Example #2
0
    def _request(self,*args,**kw):
        """ perform a Zope request """

        io =cStringIO.StringIO()
        kw['fp']=io
        # Publish this module.
        testargs = (__name__,) + args
        real_stdout = sys.stdout
        garbage_out = cStringIO.StringIO()
        sys.stdout = garbage_out  # Silence, ZPublisher!
        try:
            ZPublisher.test(*testargs,**kw)
        finally:
            sys.stdout = real_stdout
        outp = io.getvalue()
        mo = self.status_regex.search(outp)

        code,txt = mo.groups()

        res = ResultObject.ResultObject()
        res.request     = args
        res.user        = kw.get('u','')
        res.code        = int(code)
        res.return_text = txt
        res.output      = outp

        return res
Example #3
0
 def XXXtestPageViewing(self):
     #t = self.portal.index_html() # works
     #t = self.portal.TestPage() # fails, wants a CMF skin
     #app = ZopeTestCase.app()
     #ZopeTestCase.utils.setupSiteErrorLog(app)
     #ZopeTestCase.close(app)
     import ZPublisher
     t = ZPublisher.test('Zope', self.portal.TestPage.getPath())
Example #4
0
 def XXXtestPageViewing(self):
     #t = self.portal.index_html() # works
     #t = self.portal.TestPage() # fails, wants a CMF skin
     #app = ZopeTestCase.app()
     #ZopeTestCase.utils.setupSiteErrorLog(app)
     #ZopeTestCase.close(app)
     #import pdb; pdb.set_trace()
     import ZPublisher
     t = ZPublisher.test('Zope',self.portal.TestPage.getPath())
Example #5
0
def debug(*args, **kw):
    """Utility to try a Zope request using the interactive interpreter"""
    startup()
    import ZPublisher
    return ZPublisher.test('Zope2', *args, **kw)
Example #6
0
def debug(*args, **kw):
    """Utility to try a Zope request using the interactive interpreter"""
    startup()
    import ZPublisher
    return ZPublisher.test('Zope2', *args, **kw)