コード例 #1
0
    def fromFile(cls, filename):
        """
        Load a suffix array instance from filename, a file created by
        toFile.
        Accept any filename following the _open conventions.
        """
        self = cls.__new__(cls)  #new instance which does not call __init__

        start = _time()

        savedData = _loads(_open(filename, "r").read())

        # load common attributes
        self.string, self.unit, self.voc, self.vocSize, self.SA, features = savedData[:
                                                                                      6]
        self.length = len(self.SA)

        # determine token delimiter
        if self.unit == UNIT_WORD:
            self.tokSep = " "
        elif self.unit in (UNIT_CHARACTER, UNIT_BYTE):
            self.tokSep = ""
        else:
            raise Exception("Unknown unit type identifier:", self.unit)

        # recompute tokId based on voc
        self.tokId = dict((char, iChar) for iChar, char in enumerate(self.voc))
        self.nbSentences = self.string.count(self.tokId.get("\n", 0))

        # Load features
        self.features = []
        for featureName, (featureValues,
                          featureDefault) in zip(features, savedData[6:]):
            self.addFeatureSA((lambda _: featureValues),
                              name=featureName,
                              default=featureDefault)

        self.fromFileTime = _time() - start
        if _trace: print >> _stderr, "fromFileTime %.2fs" % self.fromFileTime
        return self
 def fromFile(cls, filename):
     """
     Load a suffix array instance from filename, a file created by
     toFile.
     Accept any filename following the _open conventions.
     """
     self = cls.__new__(cls) #new instance which does not call __init__  
     
     start=_time()
     
     savedData=_loads(_open(filename, "r").read())
     
     # load common attributes
     self.string, self.unit, self.voc, self.vocSize, self.SA, features = savedData[:6]
     self.length=len(self.SA)
     
     # determine token delimiter
     if self.unit==UNIT_WORD:
         self.tokSep=" "
     elif self.unit in (UNIT_CHARACTER, UNIT_BYTE):
         self.tokSep=""
     else:
         raise Exception("Unknown unit type identifier:", self.unit)
     
     # recompute tokId based on voc
     self.tokId=dict((char, iChar) for iChar,char in enumerate(self.voc))
     self.nbSentences = self.string.count(self.tokId.get("\n", 0))
     
     
     # Load features
     self.features=[]        
     for featureName, (featureValues, featureDefault) in zip(features, savedData[6:]):
         self.addFeatureSA((lambda _: featureValues), name=featureName, default=featureDefault)
     
     self.fromFileTime=_time()-start
     if _trace: print >> _stderr, "fromFileTime %.2fs"%self.fromFileTime
     return self
コード例 #3
0
def bind():
    from cPickle import loads as _loads
    _attrs_3060924876 = _loads('(dp1\nVid\np2\nVfooter\np3\ns.')
    _lookup_attr = _loads('cchameleon.core.codegen\nlookup_attr\np1\n.')
    _attrs_3060927180 = _loads('(dp1\nVhref\np2\nVhttp://docs.pylonshq.com/pyramid/dev/#tutorials\np3\ns.')
    _attrs_3060878188 = _loads('(dp1\n.')
    _attrs_3060925580 = _loads('(dp1\n.')
    _attrs_3060924620 = _loads('(dp1\n.')
    _attrs_3060901356 = _loads('(dp1\nVclass\np2\nVtop align-center\np3\ns.')
    _attrs_3060901132 = _loads('(dp1\nVid\np2\nVtop\np3\ns.')
    _attrs_3060926028 = _loads('(dp1\n.')
    _init_stream = _loads('cchameleon.core.generation\ninitialize_stream\np1\n.')
    _attrs_3060903852 = _loads('(dp1\nVid\np2\nVright\np3\nsVclass\np4\nValign-left\np5\ns.')
    _attrs_3060902508 = _loads('(dp1\nVclass\np2\nVbottom\np3\ns.')
    _attrs_3060928268 = _loads('(dp1\n.')
    _attrs_3060927628 = _loads('(dp1\nVhref\np2\nVhttp://docs.pylonshq.com/pyramid/dev/#change-history\np3\ns.')
    _attrs_3060927372 = _loads('(dp1\n.')
    _re_amp = _loads("cre\n_compile\np1\n(S'&(?!([A-Za-z]+|#[0-9]+);)'\np2\nI0\ntRp3\n.")
    _attrs_3060903692 = _loads('(dp1\nVtype\np2\nVsubmit\np3\nsVid\np4\nVx\nsVvalue\np5\nVSearch\np6\ns.')
    _attrs_3060877964 = _loads('(dp1\nVxml:lang\np2\nVen\np3\nsVxmlns\np4\nVhttp://www.w3.org/1999/xhtml\np5\ns.')
    _attrs_3060901996 = _loads('(dp1\nVclass\np2\nVapp-name\np3\ns.')
    _attrs_3060926476 = _loads('(dp1\n.')
    _attrs_3060878412 = _loads('(dp1\n.')
    _attrs_3060903468 = _loads('(dp1\nVname\np2\nVq\nsVvalue\np3\nV\nsVtype\np4\nVtext\np5\nsVid\np6\nVq\ns.')
    _attrs_3060925836 = _loads('(dp1\nVhref\np2\nVhttp://docs.pylonshq.com/\np3\ns.')
    _attrs_3060926924 = _loads('(dp1\n.')
    _attrs_3060926284 = _loads('(dp1\nVhref\np2\nVhttp://docs.pylonshq.com/pyramid/dev/#narrative-documentation\np3\ns.')
    _init_default = _loads('cchameleon.core.generation\ninitialize_default\np1\n.')
    _attrs_3060949228 = _loads('(dp1\n.')
    _attrs_3060878220 = _loads('(dp1\n.')
    _init_tal = _loads('cchameleon.core.generation\ninitialize_tal\np1\n.')
    _attrs_3060902732 = _loads('(dp1\nVid\np2\nVleft\np3\nsVclass\np4\nValign-right\np5\ns.')
    _attrs_3060925356 = _loads('(dp1\nVhref\np2\nVhttp://pylonshq.com\np3\ns.')
    _attrs_3060928076 = _loads('(dp1\nVhref\np2\nVhttp://docs.pylonshq.com/pyramid/dev/#sample-applications\np3\ns.')
    _attrs_3060901772 = _loads('(dp1\nVclass\np2\nVapp-welcome\np3\ns.')
    _attrs_3060924844 = _loads('(dp1\nVclass\np2\nVlinks\np3\ns.')
    _attrs_3060949772 = _loads('(dp1\nVclass\np2\nVfooter\np3\ns.')
    _attrs_3060928428 = _loads('(dp1\nVhref\np2\nVhttp://docs.pylonshq.com/pyramid/dev/#support-and-development\np3\ns.')
    _attrs_3060900076 = _loads('(dp1\nVmedia\np2\nVscreen\np3\nsVcharset\np4\nVutf-8\np5\nsVhref\np6\nVhttp://fonts.googleapis.com/css?family=Nobile:regular,italic,bold,bolditalic&subset=latin\np7\nsVrel\np8\nVstylesheet\np9\nsVtype\np10\nVtext/css\np11\ns.')
    _attrs_3060903212 = _loads('(dp1\nVaction\np2\nVhttp://docs.pylonshq.com/pyramid/dev/search.html\np3\nsVmethod\np4\nVget\np5\ns.')
    _attrs_3060900748 = _loads('(dp1\nVid\np2\nVheader\np3\ns.')
    _attrs_3060878988 = _loads('(dp1\nVcontent\np2\nVpyramid web application\np3\nsVname\np4\nVdescription\np5\ns.')
    _attrs_3060926732 = _loads('(dp1\nVhref\np2\nVhttp://docs.pylonshq.com/pyramid/dev/#api-documentation\np3\ns.')
    _attrs_3060900524 = _loads('(dp1\nVid\np2\nVwrap\np3\ns.')
    _init_scope = _loads('cchameleon.core.utils\necontext\np1\n.')
    _attrs_3060879308 = _loads('(dp1\nVmedia\np2\nVscreen\np3\nsVcharset\np4\nVutf-8\np5\nsVhref\np6\nV${request.application_url}/static/pylons.css\np7\nsVrel\np8\nVstylesheet\np9\nsVtype\np10\nVtext/css\np11\ns.')
    _attrs_3060902988 = _loads('(dp1\n.')
    _attrs_3060879180 = _loads('(dp1\nVhref\np2\nV${request.application_url}/static/favicon.ico\np3\nsVrel\np4\nVshortcut icon\np5\ns.')
    _attrs_3060949484 = _loads('(dp1\nVhref\np2\nVirc://irc.freenode.net#pyramid\np3\ns.')
    _attrs_3060925100 = _loads('(dp1\n.')
    _attrs_3060902220 = _loads('(dp1\nVid\np2\nVbottom\np3\ns.')
    _attrs_3060901580 = _loads('(dp1\nVsrc\np2\nV${request.application_url}/static/logo.png\np3\nsVwidth\np4\nV300\np5\nsVheight\np6\nV80\np7\ns.')
    _attrs_3060927820 = _loads('(dp1\n.')
    _attrs_3060902188 = _loads('(dp1\n.')
    _attrs_3060900972 = _loads('(dp1\nVclass\np2\nVheader\np3\ns.')
    _attrs_3060878604 = _loads('(dp1\nVcontent\np2\nVtext/html;charset=UTF-8\np3\nsVhttp-equiv\np4\nVContent-Type\np5\ns.')
    _attrs_3060878796 = _loads('(dp1\nVcontent\np2\nVpython web application\np3\nsVname\np4\nVkeywords\np5\ns.')
    def render(econtext, rcontext=None):
        macros = econtext.get('macros')
        _translate = econtext.get('_translate')
        _slots = econtext.get('_slots')
        target_language = econtext.get('target_language')
        u'_init_stream()'
        (_out, _write, ) = _init_stream()
        u'_init_tal()'
        (_attributes, repeat, ) = _init_tal()
        u'_init_default()'
        _default = _init_default()
        u'None'
        default = None
        u'None'
        _domain = None
        _write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n')
        attrs = _attrs_3060877964
        _write(u'<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">\n')
        attrs = _attrs_3060878188
        _write(u'<head>\n\t')
        attrs = _attrs_3060878412
        _write(u'<title>The Pyramid Web Application Development Framework</title>\n\t')
        attrs = _attrs_3060878604
        _write(u'<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />\n\t')
        attrs = _attrs_3060878796
        _write(u'<meta name="keywords" content="python web application" />\n\t')
        attrs = _attrs_3060878988
        _write(u'<meta name="description" content="pyramid web application" />\n\t')
        attrs = _attrs_3060879180
        "join(value('request.application_url'), u'/static/favicon.ico')"
        _write(u'<link rel="shortcut icon"')
        _tmp1 = ('%s%s' % (_lookup_attr(econtext['request'], 'application_url'), u'/static/favicon.ico', ))
        if (_tmp1 is _default):
            _tmp1 = u'${request.application_url}/static/favicon.ico'
        if ((_tmp1 is not None) and (_tmp1 is not False)):
            if (_tmp1.__class__ not in (str, unicode, int, float, )):
                _tmp1 = unicode(_translate(_tmp1, domain=_domain, mapping=None, target_language=target_language, default=None))
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if ('&' in _tmp1):
                if (';' in _tmp1):
                    _tmp1 = _re_amp.sub('&amp;', _tmp1)
                else:
                    _tmp1 = _tmp1.replace('&', '&amp;')
            if ('<' in _tmp1):
                _tmp1 = _tmp1.replace('<', '&lt;')
            if ('>' in _tmp1):
                _tmp1 = _tmp1.replace('>', '&gt;')
            if ('"' in _tmp1):
                _tmp1 = _tmp1.replace('"', '&quot;')
            _write(((' href="' + _tmp1) + '"'))
        _write(u' />\n\t')
        attrs = _attrs_3060879308
        "join(value('request.application_url'), u'/static/pylons.css')"
        _write(u'<link rel="stylesheet"')
        _tmp1 = ('%s%s' % (_lookup_attr(econtext['request'], 'application_url'), u'/static/pylons.css', ))
        if (_tmp1 is _default):
            _tmp1 = u'${request.application_url}/static/pylons.css'
        if ((_tmp1 is not None) and (_tmp1 is not False)):
            if (_tmp1.__class__ not in (str, unicode, int, float, )):
                _tmp1 = unicode(_translate(_tmp1, domain=_domain, mapping=None, target_language=target_language, default=None))
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if ('&' in _tmp1):
                if (';' in _tmp1):
                    _tmp1 = _re_amp.sub('&amp;', _tmp1)
                else:
                    _tmp1 = _tmp1.replace('&', '&amp;')
            if ('<' in _tmp1):
                _tmp1 = _tmp1.replace('<', '&lt;')
            if ('>' in _tmp1):
                _tmp1 = _tmp1.replace('>', '&gt;')
            if ('"' in _tmp1):
                _tmp1 = _tmp1.replace('"', '&quot;')
            _write(((' href="' + _tmp1) + '"'))
        _write(u' type="text/css" media="screen" charset="utf-8" />\n\t')
        attrs = _attrs_3060900076
        _write(u'<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Nobile:regular,italic,bold,bolditalic&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />\n\t<!--[if !IE 7]>\n\t<style type="text/css">\n\t\t#wrap {display:table;height:100%}\n\t</style>\n\t<![endif]-->\n</head>\n')
        attrs = _attrs_3060878220
        _write(u'<body>\n\t')
        attrs = _attrs_3060900524
        _write(u'<div id="wrap">\n\t\t')
        attrs = _attrs_3060900748
        _write(u'<div id="header">\n\t\t\t')
        attrs = _attrs_3060900972
        _write(u'<div class="header">The Pyramid Web Application Development Framework</div>\n\t\t</div>\n\t\t')
        attrs = _attrs_3060901132
        _write(u'<div id="top">\n\t\t\t')
        attrs = _attrs_3060901356
        _write(u'<div class="top align-center">\n\t\t\t\t')
        attrs = _attrs_3060901580
        "join(value('request.application_url'), u'/static/logo.png')"
        _write(u'<img')
        _tmp1 = ('%s%s' % (_lookup_attr(econtext['request'], 'application_url'), u'/static/logo.png', ))
        if (_tmp1 is _default):
            _tmp1 = u'${request.application_url}/static/logo.png'
        if ((_tmp1 is not None) and (_tmp1 is not False)):
            if (_tmp1.__class__ not in (str, unicode, int, float, )):
                _tmp1 = unicode(_translate(_tmp1, domain=_domain, mapping=None, target_language=target_language, default=None))
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if ('&' in _tmp1):
                if (';' in _tmp1):
                    _tmp1 = _re_amp.sub('&amp;', _tmp1)
                else:
                    _tmp1 = _tmp1.replace('&', '&amp;')
            if ('<' in _tmp1):
                _tmp1 = _tmp1.replace('<', '&lt;')
            if ('>' in _tmp1):
                _tmp1 = _tmp1.replace('>', '&gt;')
            if ('"' in _tmp1):
                _tmp1 = _tmp1.replace('"', '&quot;')
            _write(((' src="' + _tmp1) + '"'))
        _write(u' width="300" height="80" />\n\t\t\t\t')
        attrs = _attrs_3060901772
        _write(u'<p class="app-welcome">\n\t\t\t\t\tWelcome to ')
        attrs = _attrs_3060901996
        u'project'
        _write(u'<span class="app-name">')
        _tmp1 = econtext['project']
        _tmp = _tmp1
        if (_tmp.__class__ not in (str, unicode, int, float, )):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if (_tmp is not None):
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            if ('&' in _tmp):
                if (';' in _tmp):
                    _tmp = _re_amp.sub('&amp;', _tmp)
                else:
                    _tmp = _tmp.replace('&', '&amp;')
            if ('<' in _tmp):
                _tmp = _tmp.replace('<', '&lt;')
            if ('>' in _tmp):
                _tmp = _tmp.replace('>', '&gt;')
            _write(_tmp)
        _write(u'</span>, an application generated by')
        attrs = _attrs_3060902188
        _write(u'<br />\n\t\t\t\t\tthe Pyramid web application development framework.\n\t\t\t\t</p>\n\t\t\t</div>\n\t\t</div>\n\t\t')
        attrs = _attrs_3060902220
        _write(u'<div id="bottom">\n\t\t\t')
        attrs = _attrs_3060902508
        _write(u'<div class="bottom">\n\t\t\t\t')
        attrs = _attrs_3060902732
        _write(u'<div id="left" class="align-right">\n\t\t\t\t\t')
        attrs = _attrs_3060902988
        _write(u'<h3>Search Pyramid documentation</h3>\n\t\t\t\t\t')
        attrs = _attrs_3060903212
        _write(u'<form method="get" action="http://docs.pylonshq.com/pyramid/dev/search.html">\n\t\t      \t\t\t')
        attrs = _attrs_3060903468
        _write(u'<input type="text" id="q" name="q" value="" />\n\t\t      \t\t\t')
        attrs = _attrs_3060903692
        _write(u'<input type="submit" id="x" value="Search" />\n\t\t  \t\t\t</form>\n\t\t\t\t</div>\n\t\t\t\t')
        attrs = _attrs_3060903852
        _write(u'<div id="right" class="align-left">\n\t\t\t\t\t')
        attrs = _attrs_3060924620
        _write(u'<h3>Pyramid links</h3>\n\t\t\t\t\t')
        attrs = _attrs_3060924844
        _write(u'<ul class="links">\n\t\t\t\t\t\t')
        attrs = _attrs_3060925100
        _write(u'<li>\n\t\t\t\t\t\t\t')
        attrs = _attrs_3060925356
        _write(u'<a href="http://pylonshq.com">Pylons Website</a>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t\t')
        attrs = _attrs_3060925580
        _write(u'<li>\n\t\t\t\t\t\t\t')
        attrs = _attrs_3060925836
        _write(u'<a href="http://docs.pylonshq.com/">The Pylons Project Documentation</a>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t\t')
        attrs = _attrs_3060926028
        _write(u'<li>\n\t\t\t\t\t\t\t')
        attrs = _attrs_3060926284
        _write(u'<a href="http://docs.pylonshq.com/pyramid/dev/#narrative-documentation">Narrative Documentation</a>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t\t')
        attrs = _attrs_3060926476
        _write(u'<li>\n\t\t\t\t\t\t\t')
        attrs = _attrs_3060926732
        _write(u'<a href="http://docs.pylonshq.com/pyramid/dev/#api-documentation">API Documentation</a>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t\t')
        attrs = _attrs_3060926924
        _write(u'<li>\n\t\t\t\t\t\t\t')
        attrs = _attrs_3060927180
        _write(u'<a href="http://docs.pylonshq.com/pyramid/dev/#tutorials">Tutorials</a>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t\t')
        attrs = _attrs_3060927372
        _write(u'<li>\n\t\t\t\t\t\t\t')
        attrs = _attrs_3060927628
        _write(u'<a href="http://docs.pylonshq.com/pyramid/dev/#change-history">Change History</a>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t\t')
        attrs = _attrs_3060927820
        _write(u'<li>\n\t\t\t\t\t\t\t')
        attrs = _attrs_3060928076
        _write(u'<a href="http://docs.pylonshq.com/pyramid/dev/#sample-applications">Sample Applications</a>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t\t')
        attrs = _attrs_3060928268
        _write(u'<li>\n\t\t\t\t\t\t\t')
        attrs = _attrs_3060928428
        _write(u'<a href="http://docs.pylonshq.com/pyramid/dev/#support-and-development">Support and Development</a>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t\t')
        attrs = _attrs_3060949228
        _write(u'<li>\n\t\t\t\t\t\t\t')
        attrs = _attrs_3060949484
        _write(u'<a href="irc://irc.freenode.net#pyramid">IRC Channel</a>\n\t\t\t\t\t\t</li>\n\t\t  \t\t\t</ul>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t</div>\n\t')
        attrs = _attrs_3060924876
        _write(u'<div id="footer">\n\t\t')
        attrs = _attrs_3060949772
        _write(u'<div class="footer">\xa9 Copyright 2008-2010, Agendaless Consulting.</div>\n\t</div>\n</body>\n</html>')
        return _out.getvalue()
    return render
コード例 #4
0
ファイル: question.pt.py プロジェクト: ellimistd/pyquiz
def bind():
    from cPickle import loads as _loads
    _lookup_attr = _loads('cchameleon.core.codegen\nlookup_attr\np1\n.')
    _attrs_42815632 = _loads('(dp1\nVhref\np2\nVstatic/css/theme.css\np3\nsVrel\np4\nVstylesheet\np5\nsVtype\np6\nVtext/css\np7\ns.')
    _init_scope = _loads('cchameleon.core.utils\necontext\np1\n.')
    _attrs_42749520 = _loads('(dp1\n.')
    _attrs_42656720 = _loads('(dp1\nVid\np2\nVpublic\np3\ns.')
    _attrs_42749392 = _loads('(dp1\n.')
    _attrs_42815568 = _loads('(dp1\nVhref\np2\nVstatic/css/form.css\np3\nsVrel\np4\nVstylesheet\np5\nsVtype\np6\nVtext/css\np7\ns.')
    _attrs_42749648 = _loads('(dp1\nVcontent\np2\nVtext/html; charset=utf-8\np3\nsVhttp-equiv\np4\nVContent-Type\np5\ns.')
    _attrs_42707792 = _loads('(dp1\n.')
    _attrs_42815760 = _loads('(dp1\nVtype\np2\nVtext/javascript\np3\ns.')
    _attrs_42749264 = _loads('(dp1\nVxmlns\np2\nVhttp://www.w3.org/1999/xhtml\np3\ns.')
    _init_stream = _loads('cchameleon.core.generation\ninitialize_stream\np1\n.')
    _attrs_42707856 = _loads('(dp1\n.')
    _attrs_42747280 = _loads('(dp1\n.')
    _init_default = _loads('cchameleon.core.generation\ninitialize_default\np1\n.')
    _attrs_42749840 = _loads('(dp1\nVsrc\np2\nVstatic/scripts/jquery-1.4.2.min.js\np3\nsVtype\np4\nVtext/javascript\np5\ns.')
    _re_amp = _loads("cre\n_compile\np1\n(S'&(?!([A-Za-z]+|#[0-9]+);)'\np2\nI0\ntRp3\n.")
    _attrs_42749776 = _loads('(dp1\nVsrc\np2\nVstatic/scripts/deform.js\np3\nsVtype\np4\nVtext/javascript\np5\ns.')
    _attrs_42815824 = _loads('(dp1\nVhref\np2\nV${link}\np3\ns.')
    _init_tal = _loads('cchameleon.core.generation\ninitialize_tal\np1\n.')
    def render(econtext, rcontext=None):
        macros = econtext.get('macros')
        _translate = econtext.get('_translate')
        _slots = econtext.get('_slots')
        target_language = econtext.get('target_language')
        u'_init_stream()'
        (_out, _write, ) = _init_stream()
        u'_init_tal()'
        (_attributes, repeat, ) = _init_tal()
        u'_init_default()'
        _default = _init_default()
        u'None'
        default = None
        u'None'
        _domain = None
        _write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n')
        attrs = _attrs_42749264
        _write(u'<html xmlns="http://www.w3.org/1999/xhtml">\n')
        attrs = _attrs_42749392
        _write(u'<head>\n')
        attrs = _attrs_42749520
        _write(u'<title>\n   Pyquiz\n</title>\n<!-- Meta Tags -->\n')
        attrs = _attrs_42749648
        _write(u'<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />\n<!-- JavaScript -->\n')
        attrs = _attrs_42749776
        _write(u'<script type="text/javascript" src="static/scripts/deform.js"></script>\n')
        attrs = _attrs_42749840
        _write(u'<script type="text/javascript" src="static/scripts/jquery-1.4.2.min.js"></script>\n<!-- CSS -->\n')
        attrs = _attrs_42815568
        _write(u'<link rel="stylesheet" href="static/css/form.css" type="text/css" />\n')
        attrs = _attrs_42815632
        _write(u'<link rel="stylesheet" href="static/css/theme.css" type="text/css" />\n</head>\n')
        attrs = _attrs_42656720
        _write(u'<body id="public">\n  ')
        attrs = _attrs_42747280
        _write(u'<div>\n    ')
        attrs = _attrs_42707856
        u'test.name'
        _write(u'<h1>')
        _tmp1 = _lookup_attr(econtext['test'], 'name')
        _tmp = _tmp1
        if (_tmp.__class__ not in (str, unicode, int, float, )):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if (_tmp is not None):
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            if ('&' in _tmp):
                if (';' in _tmp):
                    _tmp = _re_amp.sub('&amp;', _tmp)
                else:
                    _tmp = _tmp.replace('&', '&amp;')
            if ('<' in _tmp):
                _tmp = _tmp.replace('<', '&lt;')
            if ('>' in _tmp):
                _tmp = _tmp.replace('>', '&gt;')
            _write(_tmp)
        _write(u'</h1>\n    ')
        attrs = _attrs_42707792
        u"''"
        _write(u'<div />\n    ')
        _default.value = default = ''
        u'form'
        _content = econtext['form']
        u'_content'
        _tmp1 = _content
        _tmp = _tmp1
        if (_tmp.__class__ not in (str, unicode, int, float, )):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if (_tmp is not None):
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            _write(_tmp)
        _write(u'\n    ')
        attrs = _attrs_42815760
        _write(u'<script type="text/javascript">\n      jQuery(function() {\n         deform.load();\n         });\n    </script>\n    ')
        attrs = _attrs_42815824
        "join(value('link'),)"
        _write(u'<a')
        _tmp1 = econtext['link']
        if (_tmp1 is _default):
            _tmp1 = u'${link}'
        if ((_tmp1 is not None) and (_tmp1 is not False)):
            if (_tmp1.__class__ not in (str, unicode, int, float, )):
                _tmp1 = unicode(_translate(_tmp1, domain=_domain, mapping=None, target_language=target_language, default=None))
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if ('&' in _tmp1):
                if (';' in _tmp1):
                    _tmp1 = _re_amp.sub('&amp;', _tmp1)
                else:
                    _tmp1 = _tmp1.replace('&', '&amp;')
            if ('<' in _tmp1):
                _tmp1 = _tmp1.replace('<', '&lt;')
            if ('>' in _tmp1):
                _tmp1 = _tmp1.replace('>', '&gt;')
            if ('"' in _tmp1):
                _tmp1 = _tmp1.replace('"', '&quot;')
            _write(((' href="' + _tmp1) + '"'))
        _write(u'>review test</a>\n  </div>\n</body>\n</html>')
        return _out.getvalue()
    return render
コード例 #5
0
def bind():
    from cPickle import loads as _loads
    _lookup_attr = _loads('cchameleon.core.codegen\nlookup_attr\np1\n.')
    _init_scope = _loads('cchameleon.core.utils\necontext\np1\n.')
    _re_amp = _loads(
        "cre\n_compile\np1\n(S'&(?!([A-Za-z]+|#[0-9]+);)'\np2\nI0\ntRp3\n.")
    _attrs_4367955152 = _loads('(dp1\n.')
    _init_stream = _loads(
        'cchameleon.core.generation\ninitialize_stream\np1\n.')
    _attrs_4367954448 = _loads('(dp1\n.')
    _init_default = _loads(
        'cchameleon.core.generation\ninitialize_default\np1\n.')
    _attrs_4367955664 = _loads('(dp1\n.')
    _init_tal = _loads('cchameleon.core.generation\ninitialize_tal\np1\n.')

    def render(econtext, rcontext=None):
        macros = econtext.get('macros')
        _translate = econtext.get('_translate')
        _slots = econtext.get('_slots')
        target_language = econtext.get('target_language')
        u'_init_stream()'
        (
            _out,
            _write,
        ) = _init_stream()
        u'_init_tal()'
        (
            _attributes,
            repeat,
        ) = _init_tal()
        u'_init_default()'
        _default = _init_default()
        u'None'
        default = None
        u'None'
        _domain = None
        u'grid_1'
        dom_id = u'grid_1'
        u"','.join([f.metadata.get('label') for f in collection.render_fields.values()])"
        colnames = _lookup_attr(',', 'join')([
            _lookup_attr(_lookup_attr(f, 'metadata'), 'get')('label')
            for f in _lookup_attr(
                _lookup_attr(econtext['collection'], 'render_fields'),
                'values')()
        ])
        u"','.join([f.metadata.get('json') for f in collection.render_fields.values()])"
        colmodels = _lookup_attr(',', 'join')([
            _lookup_attr(_lookup_attr(f, 'metadata'), 'get')('json')
            for f in _lookup_attr(
                _lookup_attr(econtext['collection'], 'render_fields'),
                'values')()
        ])
        _write(u'\n')
        attrs = _attrs_4367955664
        u'dom_id'
        _write(u'<table')
        _tmp1 = dom_id
        if (_tmp1 is _default):
            _tmp1 = None
        if ((_tmp1 is not None) and (_tmp1 is not False)):
            if (_tmp1.__class__ not in (
                    str,
                    unicode,
                    int,
                    float,
            )):
                _tmp1 = unicode(
                    _translate(_tmp1,
                               domain=_domain,
                               mapping=None,
                               target_language=target_language,
                               default=None))
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if ('&' in _tmp1):
                if (';' in _tmp1):
                    _tmp1 = _re_amp.sub('&amp;', _tmp1)
                else:
                    _tmp1 = _tmp1.replace('&', '&amp;')
            if ('<' in _tmp1):
                _tmp1 = _tmp1.replace('<', '&lt;')
            if ('>' in _tmp1):
                _tmp1 = _tmp1.replace('>', '&gt;')
            if ('"' in _tmp1):
                _tmp1 = _tmp1.replace('"', '&quot;')
            _write(((' id="' + _tmp1) + '"'))
        _write(u'></table> ')
        attrs = _attrs_4367954448
        u'${dom_id}_jqgrid'
        _write(u'<div')
        _tmp1 = ('%s%s' % (
            dom_id,
            u'_jqgrid',
        ))
        if (_tmp1 is _default):
            _tmp1 = None
        if ((_tmp1 is not None) and (_tmp1 is not False)):
            if (_tmp1.__class__ not in (
                    str,
                    unicode,
                    int,
                    float,
            )):
                _tmp1 = unicode(
                    _translate(_tmp1,
                               domain=_domain,
                               mapping=None,
                               target_language=target_language,
                               default=None))
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if ('&' in _tmp1):
                if (';' in _tmp1):
                    _tmp1 = _re_amp.sub('&amp;', _tmp1)
                else:
                    _tmp1 = _tmp1.replace('&', '&amp;')
            if ('<' in _tmp1):
                _tmp1 = _tmp1.replace('<', '&lt;')
            if ('>' in _tmp1):
                _tmp1 = _tmp1.replace('>', '&gt;')
            if ('"' in _tmp1):
                _tmp1 = _tmp1.replace('"', '&quot;')
            _write(((' id="' + _tmp1) + '"'))
        _write(u'></div> \n')
        attrs = _attrs_4367955152
        u'dom_id'
        _write(
            u'<script>\nvar init_grid = function() {\nif (!jQuery.fa.jqgrid) {\n  setTimeout(init_grid, 100);\n  return;\n}\nvar url = window.location.href.split(\'?\')[0].split(\'/\');\nvar model = url.pop();\nurl.push(\'json\');\nurl.push(model);\nurl = url.join(\'/\');\njQuery.fa.jqgrid("'
        )
        _tmp1 = dom_id
        _tmp = _tmp1
        if (_tmp.__class__ not in (
                str,
                unicode,
                int,
                float,
        )):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp,
                                  domain=_domain,
                                  mapping=None,
                                  target_language=target_language,
                                  default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if (_tmp is not None):
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            if ('&' in _tmp):
                if (';' in _tmp):
                    _tmp = _re_amp.sub('&amp;', _tmp)
                else:
                    _tmp = _tmp.replace('&', '&amp;')
            if ('<' in _tmp):
                _tmp = _tmp.replace('<', '&lt;')
            if ('>' in _tmp):
                _tmp = _tmp.replace('>', '&gt;')
            _write(_tmp)
        u"colnames and ', %s' % colnames or u''"
        _write(u'", {\n    url: url+\'?jqgrid=true\',\n    colNames:[\'id\' ')
        _tmp1 = ((colnames and (', %s' % colnames)) or u'')
        _tmp = _tmp1
        if (_tmp.__class__ not in (
                str,
                unicode,
                int,
                float,
        )):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp,
                                  domain=_domain,
                                  mapping=None,
                                  target_language=target_language,
                                  default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if (_tmp is not None):
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            if ('&' in _tmp):
                if (';' in _tmp):
                    _tmp = _re_amp.sub('&amp;', _tmp)
                else:
                    _tmp = _tmp.replace('&', '&amp;')
            if ('<' in _tmp):
                _tmp = _tmp.replace('<', '&lt;')
            if ('>' in _tmp):
                _tmp = _tmp.replace('>', '&gt;')
            _write(_tmp)
        u"colmodels and ', %s' % colmodels or ''"
        _write(
            u'],\n    colModel:[\n      {name:"id",index:"id", width:30, align:"center", searchoptions:{sopt:["eq"]}}\n      '
        )
        _tmp1 = ((colmodels and (', %s' % colmodels)) or '')
        _tmp = _tmp1
        if (_tmp.__class__ not in (
                str,
                unicode,
                int,
                float,
        )):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp,
                                  domain=_domain,
                                  mapping=None,
                                  target_language=target_language,
                                  default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if (_tmp is not None):
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            if ('&' in _tmp):
                if (';' in _tmp):
                    _tmp = _re_amp.sub('&amp;', _tmp)
                else:
                    _tmp = _tmp.replace('&', '&amp;')
            if ('<' in _tmp):
                _tmp = _tmp.replace('<', '&lt;')
            if ('>' in _tmp):
                _tmp = _tmp.replace('>', '&gt;')
            _write(_tmp)
        _write(
            u'\n    ],\n    callback: function(table, pager, options) {\n    }\n  });\n}\nsetTimeout(init_grid, 200);\n</script>\n'
        )
        return _out.getvalue()

    return render
コード例 #6
0
ファイル: listing.pt.py プロジェクト: abourget/fa.jquery
def bind():
    from cPickle import loads as _loads
    _lookup_attr = _loads('cchameleon.core.codegen\nlookup_attr\np1\n.')
    _init_scope = _loads('cchameleon.core.utils\necontext\np1\n.')
    _re_amp = _loads("cre\n_compile\np1\n(S'&(?!([A-Za-z]+|#[0-9]+);)'\np2\nI0\ntRp3\n.")
    _attrs_4362992784 = _loads('(dp1\n.')
    _attrs_4362992848 = _loads('(dp1\nVclass\np2\nVfa_controls\np3\ns.')
    _attrs_4362992528 = _loads('(dp1\n.')
    _attrs_4362992656 = _loads('(dp1\n.')
    _init_stream = _loads('cchameleon.core.generation\ninitialize_stream\np1\n.')
    _init_default = _loads('cchameleon.core.generation\ninitialize_default\np1\n.')
    _init_tal = _loads('cchameleon.core.generation\ninitialize_tal\np1\n.')
    def render(econtext, rcontext=None):
        macros = econtext.get('macros')
        _translate = econtext.get('_translate')
        _slots = econtext.get('_slots')
        target_language = econtext.get('target_language')
        u'_init_stream()'
        (_out, _write, ) = _init_stream()
        u'_init_tal()'
        (_attributes, repeat, ) = _init_tal()
        u'_init_default()'
        _default = _init_default()
        u'None'
        default = None
        u'None'
        _domain = None
        u"main.macros['master']"
        _metal = _lookup_attr(econtext['main'], 'macros')['master']
        def _callback_javascript(econtext, _repeat, _out=_out, _write=_write, _domain=_domain, **_ignored):
            if _repeat:
                repeat.update(_repeat)
            attrs = _attrs_4362992528
            u"request.registry.settings.get('fa.use_popup') and 'true' or 'false'"
            _write(u'<script>\n      var USE_POPUP = ')
            _tmp1 = ((_lookup_attr(_lookup_attr(_lookup_attr(econtext['request'], 'registry'), 'settings'), 'get')('fa.use_popup') and 'true') or 'false')
            _tmp = _tmp1
            if (_tmp.__class__ not in (str, unicode, int, float, )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                if ('&' in _tmp):
                    if (';' in _tmp):
                        _tmp = _re_amp.sub('&amp;', _tmp)
                    else:
                        _tmp = _tmp.replace('&', '&amp;')
                if ('<' in _tmp):
                    _tmp = _tmp.replace('<', '&lt;')
                if ('>' in _tmp):
                    _tmp = _tmp.replace('>', '&gt;')
                _write(_tmp)
            u"request.static_url('fa.jquery:jquery-ui/jqgrid/js/i18n/grid.locale-en.js')"
            _write(u';\n      jQuery.fa.add_resource("')
            _tmp1 = _lookup_attr(econtext['request'], 'static_url')('fa.jquery:jquery-ui/jqgrid/js/i18n/grid.locale-en.js')
            _tmp = _tmp1
            if (_tmp.__class__ not in (str, unicode, int, float, )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                if ('&' in _tmp):
                    if (';' in _tmp):
                        _tmp = _re_amp.sub('&amp;', _tmp)
                    else:
                        _tmp = _tmp.replace('&', '&amp;')
                if ('<' in _tmp):
                    _tmp = _tmp.replace('<', '&lt;')
                if ('>' in _tmp):
                    _tmp = _tmp.replace('>', '&gt;')
                _write(_tmp)
            u"request.static_url('fa.jquery:jquery-ui/jqgrid/js/jquery.jqGrid.min.js')"
            _write(u'");\n      jQuery.fa.add_resource("')
            _tmp1 = _lookup_attr(econtext['request'], 'static_url')('fa.jquery:jquery-ui/jqgrid/js/jquery.jqGrid.min.js')
            _tmp = _tmp1
            if (_tmp.__class__ not in (str, unicode, int, float, )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                if ('&' in _tmp):
                    if (';' in _tmp):
                        _tmp = _re_amp.sub('&amp;', _tmp)
                    else:
                        _tmp = _tmp.replace('&', '&amp;')
                if ('<' in _tmp):
                    _tmp = _tmp.replace('<', '&lt;')
                if ('>' in _tmp):
                    _tmp = _tmp.replace('>', '&gt;')
                _write(_tmp)
            u"request.static_url('fa.jquery:jquery-ui/jqgrid/js/fa.jqgrid.js')"
            _write(u'");\n      jQuery.fa.add_resource("')
            _tmp1 = _lookup_attr(econtext['request'], 'static_url')('fa.jquery:jquery-ui/jqgrid/js/fa.jqgrid.js')
            _tmp = _tmp1
            if (_tmp.__class__ not in (str, unicode, int, float, )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                if ('&' in _tmp):
                    if (';' in _tmp):
                        _tmp = _re_amp.sub('&amp;', _tmp)
                    else:
                        _tmp = _tmp.replace('&', '&amp;')
                if ('<' in _tmp):
                    _tmp = _tmp.replace('<', '&lt;')
                if ('>' in _tmp):
                    _tmp = _tmp.replace('>', '&gt;')
                _write(_tmp)
            u"request.static_url('fa.jquery:jquery-ui/jqgrid/css/ui.jqgrid.css')"
            _write(u'");\n      jQuery.fa.add_resource("')
            _tmp1 = _lookup_attr(econtext['request'], 'static_url')('fa.jquery:jquery-ui/jqgrid/css/ui.jqgrid.css')
            _tmp = _tmp1
            if (_tmp.__class__ not in (str, unicode, int, float, )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                if ('&' in _tmp):
                    if (';' in _tmp):
                        _tmp = _re_amp.sub('&amp;', _tmp)
                    else:
                        _tmp = _tmp.replace('&', '&amp;')
                if ('<' in _tmp):
                    _tmp = _tmp.replace('<', '&lt;')
                if ('>' in _tmp):
                    _tmp = _tmp.replace('>', '&gt;')
                _write(_tmp)
            _write(u'");\n    </script>\n')
        def _callback_main(econtext, _repeat, _out=_out, _write=_write, _domain=_domain, **_ignored):
            if _repeat:
                repeat.update(_repeat)
            attrs = _attrs_4362992656
            u"''"
            _write(u'<div>\n      ')
            _default.value = default = ''
            u"fs.render(renderer='fa.jquery:templates/forms/jqgrid.pt', request=request)"
            _content = _lookup_attr(econtext['fs'], 'render')(renderer='fa.jquery:templates/forms/jqgrid.pt', request=econtext['request'])
            attrs = _attrs_4362992784
            u'_content'
            _write(u'<div>')
            _tmp1 = _content
            _tmp = _tmp1
            if (_tmp.__class__ not in (str, unicode, int, float, )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                _write(_tmp)
            u"u'\\n      '"
            _write(u'</div>\n      ')
            _default.value = default = u'\n      '
            u'actions.buttons(request)'
            _content = _lookup_attr(econtext['actions'], 'buttons')(econtext['request'])
            attrs = _attrs_4362992848
            u'_content'
            _write(u'<div class="fa_controls">')
            _tmp1 = _content
            _tmp = _tmp1
            if (_tmp.__class__ not in (str, unicode, int, float, )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                _write(_tmp)
            _write(u'</div>\n    </div>\n')
        u"{'main': _callback_main, 'javascript': _callback_javascript}"
        _tmp = {'main': _callback_main, 'javascript': _callback_javascript, }
        u"main.macros['master']"
        _metal.render(_tmp, _out=_out, _write=_write, _domain=_domain, econtext=econtext)
        return _out.getvalue()
    return render
コード例 #7
0
def bind():
    from cPickle import loads as _loads
    _lookup_attr = _loads('cchameleon.core.codegen\nlookup_attr\np1\n.')
    _init_scope = _loads('cchameleon.core.utils\necontext\np1\n.')
    _attrs_4353960208 = _loads('(dp1\nVclass\np2\nVlayout-grid\np3\ns.')
    _attrs_4353960144 = _loads('(dp1\nVclass\np2\nVui-pager\np3\ns.')
    _init_stream = _loads('cchameleon.core.generation\ninitialize_stream\np1\n.')
    _attrs_4353960272 = _loads('(dp1\nVclass\np2\nVfa_field\np3\ns.')
    _init_default = _loads('cchameleon.core.generation\ninitialize_default\np1\n.')
    _attrs_4353960016 = _loads('(dp1\n.')
    _init_tal = _loads('cchameleon.core.generation\ninitialize_tal\np1\n.')
    def render(econtext, rcontext=None):
        macros = econtext.get('macros')
        _translate = econtext.get('_translate')
        _slots = econtext.get('_slots')
        target_language = econtext.get('target_language')
        u'_init_stream()'
        (_out, _write, ) = _init_stream()
        u'_init_tal()'
        (_attributes, repeat, ) = _init_tal()
        u'_init_default()'
        _default = _init_default()
        u'None'
        default = None
        u'None'
        _domain = None
        u"main.macros['master']"
        _metal = _lookup_attr(econtext['main'], 'macros')['master']
        def _callback_main(econtext, _repeat, _out=_out, _write=_write, _domain=_domain, **_ignored):
            if _repeat:
                repeat.update(_repeat)
            attrs = _attrs_4353960016
            u"''"
            _write(u'<div>\n      ')
            _default.value = default = ''
            u'pager'
            _content = econtext['pager']
            attrs = _attrs_4353960144
            u'_content'
            _write(u'<div class="ui-pager">')
            _tmp1 = _content
            _tmp = _tmp1
            if (_tmp.__class__ not in (str, unicode, int, float, )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                _write(_tmp)
            u"''"
            _write(u'</div>\n      ')
            _default.value = default = ''
            u'fs.render()'
            _content = _lookup_attr(econtext['fs'], 'render')()
            attrs = _attrs_4353960208
            u'_content'
            _write(u'<table class="layout-grid">')
            _tmp1 = _content
            _tmp = _tmp1
            if (_tmp.__class__ not in (str, unicode, int, float, )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                _write(_tmp)
            u"u'\\n      '"
            _write(u'</table>\n      ')
            _default.value = default = u'\n      '
            u'actions.buttons(request)'
            _content = _lookup_attr(econtext['actions'], 'buttons')(econtext['request'])
            attrs = _attrs_4353960272
            u'_content'
            _write(u'<p class="fa_field">')
            _tmp1 = _content
            _tmp = _tmp1
            if (_tmp.__class__ not in (str, unicode, int, float, )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                _write(_tmp)
            _write(u'</p>\n    </div>\n')
        u"{'main': _callback_main}"
        _tmp = {'main': _callback_main, }
        u"main.macros['master']"
        _metal.render(_tmp, _out=_out, _write=_write, _domain=_domain, econtext=econtext)
        return _out.getvalue()
    return render
コード例 #8
0
ファイル: jqgrid.pt.py プロジェクト: bkocherov/fa.jquery
def bind():
    from cPickle import loads as _loads
    _attrs_4356464016 = _loads('(dp1\n.')
    _lookup_attr = _loads('cchameleon.core.codegen\nlookup_attr\np1\n.')
    _init_scope = _loads('cchameleon.core.utils\necontext\np1\n.')
    _re_amp = _loads("cre\n_compile\np1\n(S'&(?!([A-Za-z]+|#[0-9]+);)'\np2\nI0\ntRp3\n.")
    _attrs_4356463632 = _loads('(dp1\n.')
    _init_stream = _loads('cchameleon.core.generation\ninitialize_stream\np1\n.')
    _attrs_4356463952 = _loads('(dp1\n.')
    _init_default = _loads('cchameleon.core.generation\ninitialize_default\np1\n.')
    _attrs_4356463568 = _loads('(dp1\n.')
    _init_tal = _loads('cchameleon.core.generation\ninitialize_tal\np1\n.')
    def render(econtext, rcontext=None):
        macros = econtext.get('macros')
        _translate = econtext.get('_translate')
        _slots = econtext.get('_slots')
        target_language = econtext.get('target_language')
        u'_init_stream()'
        (_out, _write, ) = _init_stream()
        u'_init_tal()'
        (_attributes, repeat, ) = _init_tal()
        u'_init_default()'
        _default = _init_default()
        u'None'
        default = None
        u'None'
        _domain = None
        u'grid_1'
        dom_id = u'grid_1'
        u"','.join([repr(f.label_text or collection.prettify(f.key)) for f in collection.render_fields.values()])"
        colnames = _lookup_attr(',', 'join')([repr((_lookup_attr(f, 'label_text') or _lookup_attr(econtext['collection'], 'prettify')(_lookup_attr(f, 'key')))) for f in _lookup_attr(_lookup_attr(econtext['collection'], 'render_fields'), 'values')()])
        u"','.join([f.metadata.get('json') for f in collection.render_fields.values()])"
        colmodels = _lookup_attr(',', 'join')([_lookup_attr(_lookup_attr(f, 'metadata'), 'get')('json') for f in _lookup_attr(_lookup_attr(econtext['collection'], 'render_fields'), 'values')()])
        _write(u'\n')
        attrs = _attrs_4356463952
        u'dom_id'
        _write(u'<table')
        _tmp1 = dom_id
        if (_tmp1 is _default):
            _tmp1 = None
        if ((_tmp1 is not None) and (_tmp1 is not False)):
            if (_tmp1.__class__ not in (str, unicode, int, float, )):
                _tmp1 = unicode(_translate(_tmp1, domain=_domain, mapping=None, target_language=target_language, default=None))
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if ('&' in _tmp1):
                if (';' in _tmp1):
                    _tmp1 = _re_amp.sub('&amp;', _tmp1)
                else:
                    _tmp1 = _tmp1.replace('&', '&amp;')
            if ('<' in _tmp1):
                _tmp1 = _tmp1.replace('<', '&lt;')
            if ('>' in _tmp1):
                _tmp1 = _tmp1.replace('>', '&gt;')
            if ('"' in _tmp1):
                _tmp1 = _tmp1.replace('"', '&quot;')
            _write(((' id="' + _tmp1) + '"'))
        _write(u'></table> ')
        attrs = _attrs_4356464016
        u'${dom_id}_jqgrid'
        _write(u'<div')
        _tmp1 = ('%s%s' % (dom_id, u'_jqgrid', ))
        if (_tmp1 is _default):
            _tmp1 = None
        if ((_tmp1 is not None) and (_tmp1 is not False)):
            if (_tmp1.__class__ not in (str, unicode, int, float, )):
                _tmp1 = unicode(_translate(_tmp1, domain=_domain, mapping=None, target_language=target_language, default=None))
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if ('&' in _tmp1):
                if (';' in _tmp1):
                    _tmp1 = _re_amp.sub('&amp;', _tmp1)
                else:
                    _tmp1 = _tmp1.replace('&', '&amp;')
            if ('<' in _tmp1):
                _tmp1 = _tmp1.replace('<', '&lt;')
            if ('>' in _tmp1):
                _tmp1 = _tmp1.replace('>', '&gt;')
            if ('"' in _tmp1):
                _tmp1 = _tmp1.replace('"', '&quot;')
            _write(((' id="' + _tmp1) + '"'))
        _write(u'></div> \n')
        attrs = _attrs_4356463568
        u"request.static_url('fa.jquery:jquery-ui/jqgrid/css/ui.jqgrid.css')"
        _write(u'<script>\njQuery.fa.add_resource("')
        _tmp1 = _lookup_attr(econtext['request'], 'static_url')('fa.jquery:jquery-ui/jqgrid/css/ui.jqgrid.css')
        _tmp = _tmp1
        if (_tmp.__class__ not in (str, unicode, int, float, )):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if (_tmp is not None):
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            if ('&' in _tmp):
                if (';' in _tmp):
                    _tmp = _re_amp.sub('&amp;', _tmp)
                else:
                    _tmp = _tmp.replace('&', '&amp;')
            if ('<' in _tmp):
                _tmp = _tmp.replace('<', '&lt;')
            if ('>' in _tmp):
                _tmp = _tmp.replace('>', '&gt;')
            _write(_tmp)
        u"request.static_url('fa.jquery:jquery-ui/jqgrid/js/i18n/grid.locale-en.js')"
        _write(u'");\njQuery.fa.add_resource("')
        _tmp1 = _lookup_attr(econtext['request'], 'static_url')('fa.jquery:jquery-ui/jqgrid/js/i18n/grid.locale-en.js')
        _tmp = _tmp1
        if (_tmp.__class__ not in (str, unicode, int, float, )):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if (_tmp is not None):
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            if ('&' in _tmp):
                if (';' in _tmp):
                    _tmp = _re_amp.sub('&amp;', _tmp)
                else:
                    _tmp = _tmp.replace('&', '&amp;')
            if ('<' in _tmp):
                _tmp = _tmp.replace('<', '&lt;')
            if ('>' in _tmp):
                _tmp = _tmp.replace('>', '&gt;')
            _write(_tmp)
        u"request.static_url('fa.jquery:jquery-ui/jqgrid/js/jquery.jqGrid.min.js')"
        _write(u'");\njQuery.fa.add_resource("')
        _tmp1 = _lookup_attr(econtext['request'], 'static_url')('fa.jquery:jquery-ui/jqgrid/js/jquery.jqGrid.min.js')
        _tmp = _tmp1
        if (_tmp.__class__ not in (str, unicode, int, float, )):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if (_tmp is not None):
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            if ('&' in _tmp):
                if (';' in _tmp):
                    _tmp = _re_amp.sub('&amp;', _tmp)
                else:
                    _tmp = _tmp.replace('&', '&amp;')
            if ('<' in _tmp):
                _tmp = _tmp.replace('<', '&lt;')
            if ('>' in _tmp):
                _tmp = _tmp.replace('>', '&gt;')
            _write(_tmp)
        u"request.static_url('fa.jquery:jquery-ui/jqgrid/js/fa.jqgrid.js')"
        _write(u'");\njQuery.fa.add_resource("')
        _tmp1 = _lookup_attr(econtext['request'], 'static_url')('fa.jquery:jquery-ui/jqgrid/js/fa.jqgrid.js')
        _tmp = _tmp1
        if (_tmp.__class__ not in (str, unicode, int, float, )):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if (_tmp is not None):
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            if ('&' in _tmp):
                if (';' in _tmp):
                    _tmp = _re_amp.sub('&amp;', _tmp)
                else:
                    _tmp = _tmp.replace('&', '&amp;')
            if ('<' in _tmp):
                _tmp = _tmp.replace('<', '&lt;')
            if ('>' in _tmp):
                _tmp = _tmp.replace('>', '&gt;')
            _write(_tmp)
        _write(u'");\n</script>\n')
        attrs = _attrs_4356463632
        u'dom_id'
        _write(u'<script>\nvar url = window.location.href.split(\'?\')[0].split(\'/\');\nvar model = url.pop();\nurl.push(\'json\');\nurl.push(model);\nurl = url.join(\'/\');\njQuery.fa.jqgrid("')
        _tmp1 = dom_id
        _tmp = _tmp1
        if (_tmp.__class__ not in (str, unicode, int, float, )):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if (_tmp is not None):
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            if ('&' in _tmp):
                if (';' in _tmp):
                    _tmp = _re_amp.sub('&amp;', _tmp)
                else:
                    _tmp = _tmp.replace('&', '&amp;')
            if ('<' in _tmp):
                _tmp = _tmp.replace('<', '&lt;')
            if ('>' in _tmp):
                _tmp = _tmp.replace('>', '&gt;')
            _write(_tmp)
        u"colnames and ', %s' % colnames or ''"
        _write(u'", {\n    url: url+\'?jqgrid=true\',\n    colNames:[\'id\' ')
        _tmp1 = ((colnames and (', %s' % colnames)) or '')
        _tmp = _tmp1
        if (_tmp.__class__ not in (str, unicode, int, float, )):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if (_tmp is not None):
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            if ('&' in _tmp):
                if (';' in _tmp):
                    _tmp = _re_amp.sub('&amp;', _tmp)
                else:
                    _tmp = _tmp.replace('&', '&amp;')
            if ('<' in _tmp):
                _tmp = _tmp.replace('<', '&lt;')
            if ('>' in _tmp):
                _tmp = _tmp.replace('>', '&gt;')
            _write(_tmp)
        u"colmodels and ', %s' % colmodels or ''"
        _write(u'],\n    colModel:[\n      {name:"id",index:"id", width:30, align:"center", searchoptions:{sopt:["eq"]}}\n      ')
        _tmp1 = ((colmodels and (', %s' % colmodels)) or '')
        _tmp = _tmp1
        if (_tmp.__class__ not in (str, unicode, int, float, )):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if (_tmp is not None):
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            if ('&' in _tmp):
                if (';' in _tmp):
                    _tmp = _re_amp.sub('&amp;', _tmp)
                else:
                    _tmp = _tmp.replace('&', '&amp;')
            if ('<' in _tmp):
                _tmp = _tmp.replace('<', '&lt;')
            if ('>' in _tmp):
                _tmp = _tmp.replace('>', '&gt;')
            _write(_tmp)
        _write(u'\n    ],\n    callback: function(table, pager, options) {\n    }\n  });\n</script>\n')
        return _out.getvalue()
    return render
コード例 #9
0
def bind():
    from cPickle import loads as _loads
    _lookup_attr = _loads('cchameleon.core.codegen\nlookup_attr\np1\n.')
    _init_scope = _loads('cchameleon.core.utils\necontext\np1\n.')
    _re_amp = _loads("cre\n_compile\np1\n(S'&(?!([A-Za-z]+|#[0-9]+);)'\np2\nI0\ntRp3\n.")
    _attrs_4361422096 = _loads('(dp1\nVclass\np2\nVlayout-grid\np3\ns.')
    _attrs_4361422992 = _loads('(dp1\n.')
    _attrs_4361422800 = _loads('(dp1\n.')
    _init_stream = _loads('cchameleon.core.generation\ninitialize_stream\np1\n.')
    _attrs_4361422352 = _loads('(dp1\n.')
    _init_default = _loads('cchameleon.core.generation\ninitialize_default\np1\n.')
    _attrs_4361422416 = _loads('(dp1\n.')
    _attrs_4361422480 = _loads('(dp1\nVclass\np2\nVui-widget-header\np3\ns.')
    _attrs_4361422608 = _loads('(dp1\n.')
    _attrs_4361423312 = _loads('(dp1\nVclass\np2\nVgrid_error\np3\ns.')
    _init_tal = _loads('cchameleon.core.generation\ninitialize_tal\np1\n.')
    def render(econtext, rcontext=None):
        macros = econtext.get('macros')
        _translate = econtext.get('_translate')
        _slots = econtext.get('_slots')
        target_language = econtext.get('target_language')
        u'_init_stream()'
        (_out, _write, ) = _init_stream()
        u'_init_tal()'
        (_attributes, repeat, ) = _init_tal()
        u'_init_default()'
        _default = _init_default()
        u'None'
        default = None
        u'None'
        _domain = None
        attrs = _attrs_4361422096
        _write(u'<table class="layout-grid">\n')
        attrs = _attrs_4361422352
        _write(u'<thead>\n  ')
        attrs = _attrs_4361422480
        u"''"
        _write(u'<tr class="ui-widget-header">\n    ')
        _default.value = default = ''
        u'collection.render_fields.itervalues()'
        _tmp1 = _lookup_attr(_lookup_attr(econtext['collection'], 'render_fields'), 'itervalues')()
        field = None
        (_tmp1, _tmp2, ) = repeat.insert('field', _tmp1)
        for field in _tmp1:
            _tmp2 = (_tmp2 - 1)
            u'field.label()'
            _content = _lookup_attr(field, 'label')()
            attrs = _attrs_4361422608
            u'_content'
            _write(u'<th>')
            _tmp3 = _content
            _tmp = _tmp3
            if (_tmp.__class__ not in (str, unicode, int, float, )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                if ('&' in _tmp):
                    if (';' in _tmp):
                        _tmp = _re_amp.sub('&amp;', _tmp)
                    else:
                        _tmp = _tmp.replace('&', '&amp;')
                if ('<' in _tmp):
                    _tmp = _tmp.replace('<', '&lt;')
                if ('>' in _tmp):
                    _tmp = _tmp.replace('>', '&gt;')
                _write(_tmp)
            _write(u'</th>')
            if (_tmp2 == 0):
                break
            _write(' ')
        _write(u'\n  </tr>\n</thead>\n')
        attrs = _attrs_4361422416
        u'collection.rows'
        _write(u'<tbody>\n  ')
        _tmp1 = _lookup_attr(econtext['collection'], 'rows')
        row = None
        (_tmp1, _tmp2, ) = repeat.insert('row', _tmp1)
        for row in _tmp1:
            _tmp2 = (_tmp2 - 1)
            u'collection._set_active(row)'
            _write(u'')
            dummy = _lookup_attr(econtext['collection'], '_set_active')(row)
            u'collection.get_errors(row)'
            row_errors = _lookup_attr(econtext['collection'], 'get_errors')(row)
            attrs = _attrs_4361422800
            u"ui-widget-${repeat.row.even and 'even' or 'odd'}"
            _write(u'<tr')
            _tmp3 = ('%s%s' % (u'ui-widget-', ((_lookup_attr(repeat.row, 'even') and 'even') or 'odd'), ))
            if (_tmp3 is _default):
                _tmp3 = None
            if ((_tmp3 is not None) and (_tmp3 is not False)):
                if (_tmp3.__class__ not in (str, unicode, int, float, )):
                    _tmp3 = unicode(_translate(_tmp3, domain=_domain, mapping=None, target_language=target_language, default=None))
                else:
                    if not isinstance(_tmp3, unicode):
                        _tmp3 = str(_tmp3)
                if ('&' in _tmp3):
                    if (';' in _tmp3):
                        _tmp3 = _re_amp.sub('&amp;', _tmp3)
                    else:
                        _tmp3 = _tmp3.replace('&', '&amp;')
                if ('<' in _tmp3):
                    _tmp3 = _tmp3.replace('<', '&lt;')
                if ('>' in _tmp3):
                    _tmp3 = _tmp3.replace('>', '&gt;')
                if ('"' in _tmp3):
                    _tmp3 = _tmp3.replace('"', '&quot;')
                _write(((' class="' + _tmp3) + '"'))
            u'collection.render_fields.itervalues()'
            _write(u'>\n      ')
            _tmp3 = _lookup_attr(_lookup_attr(econtext['collection'], 'render_fields'), 'itervalues')()
            field = None
            (_tmp3, _tmp4, ) = repeat.insert('field', _tmp3)
            for field in _tmp3:
                _tmp4 = (_tmp4 - 1)
                attrs = _attrs_4361422992
                u"''"
                _write(u'<td>\n        ')
                _default.value = default = ''
                u'field.render()'
                _content = _lookup_attr(field, 'render')()
                u'_content'
                _tmp5 = _content
                _tmp = _tmp5
                if (_tmp.__class__ not in (str, unicode, int, float, )):
                    try:
                        _tmp = _tmp.__html__
                    except:
                        _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                    else:
                        _tmp = _tmp()
                        _write(_tmp)
                        _tmp = None
                if (_tmp is not None):
                    if not isinstance(_tmp, unicode):
                        _tmp = str(_tmp)
                    _write(_tmp)
                u'row_errors.get(field, [])'
                _write(u'\n        ')
                _tmp5 = _lookup_attr(row_errors, 'get')(field, [])
                error = None
                (_tmp5, _tmp6, ) = repeat.insert('error', _tmp5)
                for error in _tmp5:
                    _tmp6 = (_tmp6 - 1)
                    attrs = _attrs_4361423312
                    u'error'
                    _write(u'<div class="grid_error">')
                    _tmp7 = error
                    _tmp = _tmp7
                    if (_tmp.__class__ not in (str, unicode, int, float, )):
                        try:
                            _tmp = _tmp.__html__
                        except:
                            _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                        else:
                            _tmp = _tmp()
                            _write(_tmp)
                            _tmp = None
                    if (_tmp is not None):
                        if not isinstance(_tmp, unicode):
                            _tmp = str(_tmp)
                        if ('&' in _tmp):
                            if (';' in _tmp):
                                _tmp = _re_amp.sub('&amp;', _tmp)
                            else:
                                _tmp = _tmp.replace('&', '&amp;')
                        if ('<' in _tmp):
                            _tmp = _tmp.replace('<', '&lt;')
                        if ('>' in _tmp):
                            _tmp = _tmp.replace('>', '&gt;')
                        _write(_tmp)
                    _write(u'</div>')
                    if (_tmp6 == 0):
                        break
                    _write(' ')
                _write(u'\n      </td>')
                if (_tmp4 == 0):
                    break
                _write(' ')
            _write(u'\n    </tr>\n  ')
            if (_tmp2 == 0):
                break
            _write(' ')
        _write(u'\n</tbody>\n</table>')
        return _out.getvalue()
    return render
コード例 #10
0
ファイル: relation.pt.py プロジェクト: FormAlchemy/fa.jquery
def bind():
    from cPickle import loads as _loads
    _lookup_attr = _loads('cchameleon.core.codegen\nlookup_attr\np1\n.')
    _attrs_4362880848 = _loads('(dp1\nVlanguage\np2\nVjavascript\np3\ns.')
    _init_scope = _loads('cchameleon.core.utils\necontext\np1\n.')
    _re_amp = _loads("cre\n_compile\np1\n(S'&(?!([A-Za-z]+|#[0-9]+);)'\np2\nI0\ntRp3\n.")
    _attrs_4362881360 = _loads('(dp1\nVclass\np2\nVui-icon ui-icon-circle-plus\np3\ns.')
    _attrs_4362880976 = _loads('(dp1\n.')
    _attrs_4362880592 = _loads('(dp1\nVtype\np2\nVtext/javascript\np3\ns.')
    _attrs_4362880016 = _loads('(dp1\n.')
    _attrs_4362881168 = _loads('(dp1\nVclass\np2\nVui-widget-header ui-widget-link ui-corner-all\np3\ns.')
    _init_stream = _loads('cchameleon.core.generation\ninitialize_stream\np1\n.')
    _attrs_4362880912 = _loads('(dp1\n.')
    _attrs_4362880208 = _loads('(dp1\n.')
    _attrs_4362880528 = _loads('(dp1\nVrel\np2\nVstylesheet\np3\ns.')
    _init_default = _loads('cchameleon.core.generation\ninitialize_default\np1\n.')
    _attrs_4362880720 = _loads('(dp1\n.')
    _attrs_4362880464 = _loads('(dp1\nVrel\np2\nVstylesheet\np3\ns.')
    _attrs_4362880400 = _loads('(dp1\n.')
    _init_tal = _loads('cchameleon.core.generation\ninitialize_tal\np1\n.')
    def render(econtext, rcontext=None):
        macros = econtext.get('macros')
        _translate = econtext.get('_translate')
        _slots = econtext.get('_slots')
        target_language = econtext.get('target_language')
        u'_init_stream()'
        (_out, _write, ) = _init_stream()
        u'_init_tal()'
        (_attributes, repeat, ) = _init_tal()
        u'_init_default()'
        _default = _init_default()
        u'None'
        default = None
        u'None'
        _domain = None
        attrs = _attrs_4362880208
        _write(u'<html>\n  ')
        attrs = _attrs_4362880016
        _write(u'<head>\n      ')
        attrs = _attrs_4362880464
        u"request.static_url('fa.jquery:jquery-ui/css/smoothness/jquery-ui-1.8.8.custom.css')"
        _write(u'<link rel="stylesheet"')
        _tmp1 = _lookup_attr(econtext['request'], 'static_url')('fa.jquery:jquery-ui/css/smoothness/jquery-ui-1.8.8.custom.css')
        if (_tmp1 is _default):
            _tmp1 = None
        if ((_tmp1 is not None) and (_tmp1 is not False)):
            if (_tmp1.__class__ not in (str, unicode, int, float, )):
                _tmp1 = unicode(_translate(_tmp1, domain=_domain, mapping=None, target_language=target_language, default=None))
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if ('&' in _tmp1):
                if (';' in _tmp1):
                    _tmp1 = _re_amp.sub('&amp;', _tmp1)
                else:
                    _tmp1 = _tmp1.replace('&', '&amp;')
            if ('<' in _tmp1):
                _tmp1 = _tmp1.replace('<', '&lt;')
            if ('>' in _tmp1):
                _tmp1 = _tmp1.replace('>', '&gt;')
            if ('"' in _tmp1):
                _tmp1 = _tmp1.replace('"', '&quot;')
            _write(((' href="' + _tmp1) + '"'))
        _write(u' />\n      ')
        attrs = _attrs_4362880528
        u"request.static_url('fa.jquery:jquery-ui/fa.jquery.min.css')"
        _write(u'<link rel="stylesheet"')
        _tmp1 = _lookup_attr(econtext['request'], 'static_url')('fa.jquery:jquery-ui/fa.jquery.min.css')
        if (_tmp1 is _default):
            _tmp1 = None
        if ((_tmp1 is not None) and (_tmp1 is not False)):
            if (_tmp1.__class__ not in (str, unicode, int, float, )):
                _tmp1 = unicode(_translate(_tmp1, domain=_domain, mapping=None, target_language=target_language, default=None))
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if ('&' in _tmp1):
                if (';' in _tmp1):
                    _tmp1 = _re_amp.sub('&amp;', _tmp1)
                else:
                    _tmp1 = _tmp1.replace('&', '&amp;')
            if ('<' in _tmp1):
                _tmp1 = _tmp1.replace('<', '&lt;')
            if ('>' in _tmp1):
                _tmp1 = _tmp1.replace('>', '&gt;')
            if ('"' in _tmp1):
                _tmp1 = _tmp1.replace('"', '&quot;')
            _write(((' href="' + _tmp1) + '"'))
        _write(u' />\n      ')
        attrs = _attrs_4362880592
        u"request.static_url('fa.jquery:jquery-ui/fa.jquery.min.js')"
        _write(u'<script type="text/javascript"')
        _tmp1 = _lookup_attr(econtext['request'], 'static_url')('fa.jquery:jquery-ui/fa.jquery.min.js')
        if (_tmp1 is _default):
            _tmp1 = None
        if ((_tmp1 is not None) and (_tmp1 is not False)):
            if (_tmp1.__class__ not in (str, unicode, int, float, )):
                _tmp1 = unicode(_translate(_tmp1, domain=_domain, mapping=None, target_language=target_language, default=None))
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if ('&' in _tmp1):
                if (';' in _tmp1):
                    _tmp1 = _re_amp.sub('&amp;', _tmp1)
                else:
                    _tmp1 = _tmp1.replace('&', '&amp;')
            if ('<' in _tmp1):
                _tmp1 = _tmp1.replace('<', '&lt;')
            if ('>' in _tmp1):
                _tmp1 = _tmp1.replace('>', '&gt;')
            if ('"' in _tmp1):
                _tmp1 = _tmp1.replace('"', '&quot;')
            _write(((' src="' + _tmp1) + '"'))
        _write(u'></script>\n  </head>\n  ')
        attrs = _attrs_4362880400
        _write(u'<body>\n    ')
        attrs = _attrs_4362880720
        _write(u'<div>\n      ')
        attrs = _attrs_4362880848
        u"''"
        _write(u'<script language="javascript">\n        var USE_POPUP = false;\n      </script>\n      ')
        _default.value = default = ''
        u"fs.render(renderer='fa.jquery:templates/forms/jqgrid.pt', request=request)"
        _content = _lookup_attr(econtext['fs'], 'render')(renderer='fa.jquery:templates/forms/jqgrid.pt', request=econtext['request'])
        attrs = _attrs_4362880912
        u'_content'
        _write(u'<div>')
        _tmp1 = _content
        _tmp = _tmp1
        if (_tmp.__class__ not in (str, unicode, int, float, )):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if (_tmp is not None):
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            _write(_tmp)
        _write(u'</div>\n      ')
        attrs = _attrs_4362880976
        _write(u'<p>\n        ')
        attrs = _attrs_4362881168
        u"request.route_url(request.route_name, traverse='%s/new' % request.model_name)"
        _write(u'<a class="ui-widget-header ui-widget-link ui-corner-all"')
        _tmp1 = _lookup_attr(econtext['request'], 'route_url')(_lookup_attr(econtext['request'], 'route_name'), traverse=('%s/new' % _lookup_attr(econtext['request'], 'model_name')))
        if (_tmp1 is _default):
            _tmp1 = None
        if ((_tmp1 is not None) and (_tmp1 is not False)):
            if (_tmp1.__class__ not in (str, unicode, int, float, )):
                _tmp1 = unicode(_translate(_tmp1, domain=_domain, mapping=None, target_language=target_language, default=None))
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if ('&' in _tmp1):
                if (';' in _tmp1):
                    _tmp1 = _re_amp.sub('&amp;', _tmp1)
                else:
                    _tmp1 = _tmp1.replace('&', '&amp;')
            if ('<' in _tmp1):
                _tmp1 = _tmp1.replace('<', '&lt;')
            if ('>' in _tmp1):
                _tmp1 = _tmp1.replace('>', '&gt;')
            if ('"' in _tmp1):
                _tmp1 = _tmp1.replace('"', '&quot;')
            _write(((' href="' + _tmp1) + '"'))
        _write(u'>\n            ')
        attrs = _attrs_4362881360
        u"F_('New')"
        _write(u'<span class="ui-icon ui-icon-circle-plus"></span>\n            ')
        _tmp1 = econtext['F_']('New')
        _tmp = _tmp1
        if (_tmp.__class__ not in (str, unicode, int, float, )):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if (_tmp is not None):
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            if ('&' in _tmp):
                if (';' in _tmp):
                    _tmp = _re_amp.sub('&amp;', _tmp)
                else:
                    _tmp = _tmp.replace('&', '&amp;')
            if ('<' in _tmp):
                _tmp = _tmp.replace('<', '&lt;')
            if ('>' in _tmp):
                _tmp = _tmp.replace('>', '&gt;')
            _write(_tmp)
        u'model_name'
        _write(u' ')
        _tmp1 = econtext['model_name']
        _tmp = _tmp1
        if (_tmp.__class__ not in (str, unicode, int, float, )):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if (_tmp is not None):
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            if ('&' in _tmp):
                if (';' in _tmp):
                    _tmp = _re_amp.sub('&amp;', _tmp)
                else:
                    _tmp = _tmp.replace('&', '&amp;')
            if ('<' in _tmp):
                _tmp = _tmp.replace('<', '&lt;')
            if ('>' in _tmp):
                _tmp = _tmp.replace('>', '&gt;')
            _write(_tmp)
        _write(u'\n        </a>\n      </p>\n    </div>\n  </body>\n</html>')
        return _out.getvalue()
    return render
コード例 #11
0
def bind():
    from cPickle import loads as _loads
    _lookup_attr = _loads('cchameleon.core.codegen\nlookup_attr\np1\n.')
    _attrs_4354452624 = _loads('(dp1\n.')
    _init_scope = _loads('cchameleon.core.utils\necontext\np1\n.')
    _re_amp = _loads("cre\n_compile\np1\n(S'&(?!([A-Za-z]+|#[0-9]+);)'\np2\nI0\ntRp3\n.")
    _attrs_4354420816 = _loads('(dp1\nVstyle\np2\nVdisplay:none\np3\ns.')
    _attrs_4354421136 = _loads('(dp1\nVclass\np2\nVfield_readonly\np3\ns.')
    _attrs_4354421392 = _loads('(dp1\n.')
    _attrs_4354421328 = _loads('(dp1\n.')
    _init_stream = _loads('cchameleon.core.generation\ninitialize_stream\np1\n.')
    _attrs_4354421456 = _loads('(dp1\n.')
    _attrs_4354421520 = _loads('(dp1\n.')
    _init_default = _loads('cchameleon.core.generation\ninitialize_default\np1\n.')
    _attrs_4354420880 = _loads('(dp1\n.')
    _init_tal = _loads('cchameleon.core.generation\ninitialize_tal\np1\n.')
    def render(econtext, rcontext=None):
        macros = econtext.get('macros')
        _translate = econtext.get('_translate')
        _slots = econtext.get('_slots')
        target_language = econtext.get('target_language')
        u'_init_stream()'
        (_out, _write, ) = _init_stream()
        u'_init_tal()'
        (_attributes, repeat, ) = _init_tal()
        u'_init_default()'
        _default = _init_default()
        u'None'
        default = None
        u'None'
        _domain = None
        attrs = _attrs_4354452624
        u'fieldset.render_fields.itervalues()'
        _write(u'<tbody>\n  ')
        _tmp1 = _lookup_attr(_lookup_attr(econtext['fieldset'], 'render_fields'), 'itervalues')()
        field = None
        (_tmp1, _tmp2, ) = repeat.insert('field', _tmp1)
        for field in _tmp1:
            _tmp2 = (_tmp2 - 1)
            u'field.requires_label'
            _write(u'')
            _tmp3 = _lookup_attr(field, 'requires_label')
            if _tmp3:
                pass
                attrs = _attrs_4354420880
                _write(u'<tr>\n      ')
                attrs = _attrs_4354421136
                u"''"
                _write(u'<td class="field_readonly">\n        ')
                _default.value = default = ''
                u'[field.label_text, fieldset.prettify(field.key)][int(field.label_text is None)]'
                _content = [_lookup_attr(field, 'label_text'), _lookup_attr(econtext['fieldset'], 'prettify')(_lookup_attr(field, 'key')), ][int((_lookup_attr(field, 'label_text') is None))]
                attrs = _attrs_4354421328
                u'_content'
                _write(u'<label>')
                _tmp3 = _content
                _tmp = _tmp3
                if (_tmp.__class__ not in (str, unicode, int, float, )):
                    try:
                        _tmp = _tmp.__html__
                    except:
                        _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                    else:
                        _tmp = _tmp()
                        _write(_tmp)
                        _tmp = None
                if (_tmp is not None):
                    if not isinstance(_tmp, unicode):
                        _tmp = str(_tmp)
                    if ('&' in _tmp):
                        if (';' in _tmp):
                            _tmp = _re_amp.sub('&amp;', _tmp)
                        else:
                            _tmp = _tmp.replace('&', '&amp;')
                    if ('<' in _tmp):
                        _tmp = _tmp.replace('<', '&lt;')
                    if ('>' in _tmp):
                        _tmp = _tmp.replace('>', '&gt;')
                    _write(_tmp)
                u"''"
                _write(u'</label>\n      </td>\n      ')
                _default.value = default = ''
                u'field.render_readonly()'
                _content = _lookup_attr(field, 'render_readonly')()
                attrs = _attrs_4354421456
                u'_content'
                _write(u'<td>')
                _tmp3 = _content
                _tmp = _tmp3
                if (_tmp.__class__ not in (str, unicode, int, float, )):
                    try:
                        _tmp = _tmp.__html__
                    except:
                        _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                    else:
                        _tmp = _tmp()
                        _write(_tmp)
                        _tmp = None
                if (_tmp is not None):
                    if not isinstance(_tmp, unicode):
                        _tmp = str(_tmp)
                    _write(_tmp)
                _write(u'</td>\n    </tr>')
            _write(u'\n  ')
            if (_tmp2 == 0):
                break
            _write(' ')
        _write(u'\n  ')
        attrs = _attrs_4354420816
        _write(u'<tr style="display:none">')
        attrs = _attrs_4354421392
        _write(u'<td>&nbsp;</td>')
        attrs = _attrs_4354421520
        u'fieldset.render_fields.itervalues()'
        _write(u'<td>\n    ')
        _tmp1 = _lookup_attr(_lookup_attr(econtext['fieldset'], 'render_fields'), 'itervalues')()
        field = None
        (_tmp1, _tmp2, ) = repeat.insert('field', _tmp1)
        for field in _tmp1:
            _tmp2 = (_tmp2 - 1)
            u"''"
            _write(u'')
            _default.value = default = ''
            u'not field.requires_label'
            _tmp3 = not _lookup_attr(field, 'requires_label')
            if _tmp3:
                pass
                u'field.render_readonly()'
                _content = _lookup_attr(field, 'render_readonly')()
                u'_content'
                _tmp3 = _content
                _tmp = _tmp3
                if (_tmp.__class__ not in (str, unicode, int, float, )):
                    try:
                        _tmp = _tmp.__html__
                    except:
                        _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                    else:
                        _tmp = _tmp()
                        _write(_tmp)
                        _tmp = None
                if (_tmp is not None):
                    if not isinstance(_tmp, unicode):
                        _tmp = str(_tmp)
                    _write(_tmp)
            _write(u'\n    ')
            if (_tmp2 == 0):
                break
            _write(' ')
        _write(u'\n  </td>\n  </tr>\n</tbody>')
        return _out.getvalue()
    return render
コード例 #12
0
def bind():
    from cPickle import loads as _loads
    _lookup_attr = _loads('cchameleon.core.codegen\nlookup_attr\np1\n.')
    _attrs_4359457168 = _loads('(dp1\n.')
    _init_scope = _loads('cchameleon.core.utils\necontext\np1\n.')
    _re_amp = _loads("cre\n_compile\np1\n(S'&(?!([A-Za-z]+|#[0-9]+);)'\np2\nI0\ntRp3\n.")
    _attrs_4359456848 = _loads('(dp1\n.')
    _init_stream = _loads('cchameleon.core.generation\ninitialize_stream\np1\n.')
    _attrs_4359456976 = _loads('(dp1\n.')
    _attrs_4359457424 = _loads('(dp1\nVclass\np2\nVui-icon ui-icon-circle-plus\np3\ns.')
    _attrs_4359457104 = _loads('(dp1\n.')
    _init_default = _loads('cchameleon.core.generation\ninitialize_default\np1\n.')
    _attrs_4359457296 = _loads('(dp1\nVclass\np2\nVui-widget-header ui-widget-link ui-corner-all\np3\ns.')
    _init_tal = _loads('cchameleon.core.generation\ninitialize_tal\np1\n.')
    def render(econtext, rcontext=None):
        macros = econtext.get('macros')
        _translate = econtext.get('_translate')
        _slots = econtext.get('_slots')
        target_language = econtext.get('target_language')
        u'_init_stream()'
        (_out, _write, ) = _init_stream()
        u'_init_tal()'
        (_attributes, repeat, ) = _init_tal()
        u'_init_default()'
        _default = _init_default()
        u'None'
        default = None
        u'None'
        _domain = None
        u"main.macros['master']"
        _metal = _lookup_attr(econtext['main'], 'macros')['master']
        def _callback_javascript(econtext, _repeat, _out=_out, _write=_write, _domain=_domain, **_ignored):
            if _repeat:
                repeat.update(_repeat)
            attrs = _attrs_4359456848
            u"request.registry.settings.get('fa.use_popup') and 'true' or 'false'"
            _write(u'<script>\n      var USE_POPUP = ')
            _tmp1 = ((_lookup_attr(_lookup_attr(_lookup_attr(econtext['request'], 'registry'), 'settings'), 'get')('fa.use_popup') and 'true') or 'false')
            _tmp = _tmp1
            if (_tmp.__class__ not in (str, unicode, int, float, )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                if ('&' in _tmp):
                    if (';' in _tmp):
                        _tmp = _re_amp.sub('&amp;', _tmp)
                    else:
                        _tmp = _tmp.replace('&', '&amp;')
                if ('<' in _tmp):
                    _tmp = _tmp.replace('<', '&lt;')
                if ('>' in _tmp):
                    _tmp = _tmp.replace('>', '&gt;')
                _write(_tmp)
            u"request.static_url('fa.jquery:jquery-ui/jqgrid/js/i18n/grid.locale-en.js')"
            _write(u';\n      jQuery.fa.add_resource("')
            _tmp1 = _lookup_attr(econtext['request'], 'static_url')('fa.jquery:jquery-ui/jqgrid/js/i18n/grid.locale-en.js')
            _tmp = _tmp1
            if (_tmp.__class__ not in (str, unicode, int, float, )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                if ('&' in _tmp):
                    if (';' in _tmp):
                        _tmp = _re_amp.sub('&amp;', _tmp)
                    else:
                        _tmp = _tmp.replace('&', '&amp;')
                if ('<' in _tmp):
                    _tmp = _tmp.replace('<', '&lt;')
                if ('>' in _tmp):
                    _tmp = _tmp.replace('>', '&gt;')
                _write(_tmp)
            u"request.static_url('fa.jquery:jquery-ui/jqgrid/js/jquery.jqGrid.min.js')"
            _write(u'");\n      jQuery.fa.add_resource("')
            _tmp1 = _lookup_attr(econtext['request'], 'static_url')('fa.jquery:jquery-ui/jqgrid/js/jquery.jqGrid.min.js')
            _tmp = _tmp1
            if (_tmp.__class__ not in (str, unicode, int, float, )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                if ('&' in _tmp):
                    if (';' in _tmp):
                        _tmp = _re_amp.sub('&amp;', _tmp)
                    else:
                        _tmp = _tmp.replace('&', '&amp;')
                if ('<' in _tmp):
                    _tmp = _tmp.replace('<', '&lt;')
                if ('>' in _tmp):
                    _tmp = _tmp.replace('>', '&gt;')
                _write(_tmp)
            u"request.static_url('fa.jquery:jquery-ui/jqgrid/js/fa.jqgrid.js')"
            _write(u'");\n      jQuery.fa.add_resource("')
            _tmp1 = _lookup_attr(econtext['request'], 'static_url')('fa.jquery:jquery-ui/jqgrid/js/fa.jqgrid.js')
            _tmp = _tmp1
            if (_tmp.__class__ not in (str, unicode, int, float, )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                if ('&' in _tmp):
                    if (';' in _tmp):
                        _tmp = _re_amp.sub('&amp;', _tmp)
                    else:
                        _tmp = _tmp.replace('&', '&amp;')
                if ('<' in _tmp):
                    _tmp = _tmp.replace('<', '&lt;')
                if ('>' in _tmp):
                    _tmp = _tmp.replace('>', '&gt;')
                _write(_tmp)
            u"request.static_url('fa.jquery:jquery-ui/jqgrid/css/ui.jqgrid.css')"
            _write(u'");\n      jQuery.fa.add_resource("')
            _tmp1 = _lookup_attr(econtext['request'], 'static_url')('fa.jquery:jquery-ui/jqgrid/css/ui.jqgrid.css')
            _tmp = _tmp1
            if (_tmp.__class__ not in (str, unicode, int, float, )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                if ('&' in _tmp):
                    if (';' in _tmp):
                        _tmp = _re_amp.sub('&amp;', _tmp)
                    else:
                        _tmp = _tmp.replace('&', '&amp;')
                if ('<' in _tmp):
                    _tmp = _tmp.replace('<', '&lt;')
                if ('>' in _tmp):
                    _tmp = _tmp.replace('>', '&gt;')
                _write(_tmp)
            _write(u'");\n    </script>\n')
        def _callback_main(econtext, _repeat, _out=_out, _write=_write, _domain=_domain, **_ignored):
            if _repeat:
                repeat.update(_repeat)
            attrs = _attrs_4359456976
            u"''"
            _write(u'<div>\n      ')
            _default.value = default = ''
            u"fs.render(renderer='fa.jquery:templates/forms/jqgrid.pt', request=request)"
            _content = _lookup_attr(econtext['fs'], 'render')(renderer='fa.jquery:templates/forms/jqgrid.pt', request=econtext['request'])
            attrs = _attrs_4359457104
            u'_content'
            _write(u'<div>')
            _tmp1 = _content
            _tmp = _tmp1
            if (_tmp.__class__ not in (str, unicode, int, float, )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                _write(_tmp)
            _write(u'</div>\n      ')
            attrs = _attrs_4359457168
            _write(u'<p>\n        ')
            attrs = _attrs_4359457296
            u"request.fa_url(request.model_name, 'new')"
            _write(u'<a class="ui-widget-header ui-widget-link ui-corner-all"')
            _tmp1 = _lookup_attr(econtext['request'], 'fa_url')(_lookup_attr(econtext['request'], 'model_name'), 'new')
            if (_tmp1 is _default):
                _tmp1 = None
            if ((_tmp1 is not None) and (_tmp1 is not False)):
                if (_tmp1.__class__ not in (str, unicode, int, float, )):
                    _tmp1 = unicode(_translate(_tmp1, domain=_domain, mapping=None, target_language=target_language, default=None))
                else:
                    if not isinstance(_tmp1, unicode):
                        _tmp1 = str(_tmp1)
                if ('&' in _tmp1):
                    if (';' in _tmp1):
                        _tmp1 = _re_amp.sub('&amp;', _tmp1)
                    else:
                        _tmp1 = _tmp1.replace('&', '&amp;')
                if ('<' in _tmp1):
                    _tmp1 = _tmp1.replace('<', '&lt;')
                if ('>' in _tmp1):
                    _tmp1 = _tmp1.replace('>', '&gt;')
                if ('"' in _tmp1):
                    _tmp1 = _tmp1.replace('"', '&quot;')
                _write(((' href="' + _tmp1) + '"'))
            _write(u'>\n            ')
            attrs = _attrs_4359457424
            u"F_('New')"
            _write(u'<span class="ui-icon ui-icon-circle-plus"></span>\n            ')
            _tmp1 = econtext['F_']('New')
            _tmp = _tmp1
            if (_tmp.__class__ not in (str, unicode, int, float, )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                if ('&' in _tmp):
                    if (';' in _tmp):
                        _tmp = _re_amp.sub('&amp;', _tmp)
                    else:
                        _tmp = _tmp.replace('&', '&amp;')
                if ('<' in _tmp):
                    _tmp = _tmp.replace('<', '&lt;')
                if ('>' in _tmp):
                    _tmp = _tmp.replace('>', '&gt;')
                _write(_tmp)
            u'model_name'
            _write(u' ')
            _tmp1 = econtext['model_name']
            _tmp = _tmp1
            if (_tmp.__class__ not in (str, unicode, int, float, )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                if ('&' in _tmp):
                    if (';' in _tmp):
                        _tmp = _re_amp.sub('&amp;', _tmp)
                    else:
                        _tmp = _tmp.replace('&', '&amp;')
                if ('<' in _tmp):
                    _tmp = _tmp.replace('<', '&lt;')
                if ('>' in _tmp):
                    _tmp = _tmp.replace('>', '&gt;')
                _write(_tmp)
            _write(u'\n        </a>\n      </p>\n    </div>\n')
        u"{'main': _callback_main, 'javascript': _callback_javascript}"
        _tmp = {'main': _callback_main, 'javascript': _callback_javascript, }
        u"main.macros['master']"
        _metal.render(_tmp, _out=_out, _write=_write, _domain=_domain, econtext=econtext)
        return _out.getvalue()
    return render
コード例 #13
0
ファイル: new.pt.py プロジェクト: pgiraud/fa.jquery
def bind():
    from cPickle import loads as _loads
    _attrs_4362536400 = _loads(
        '(dp1\nVclass\np2\nVui-widget-header ui-widget-link ui-corner-all\np3\ns.'
    )
    _lookup_attr = _loads('cchameleon.core.codegen\nlookup_attr\np1\n.')
    _init_scope = _loads('cchameleon.core.utils\necontext\np1\n.')
    _re_amp = _loads(
        "cre\n_compile\np1\n(S'&(?!([A-Za-z]+|#[0-9]+);)'\np2\nI0\ntRp3\n.")
    _attrs_4362535568 = _loads('(dp1\nVclass\np2\nVfa_controls\np3\ns.')
    _attrs_4362535376 = _loads(
        '(dp1\nVmethod\np2\nVPOST\np3\nsVenctype\np4\nVmultipart/form-data\np5\ns.'
    )
    _attrs_4362535760 = _loads(
        "(dp1\nVhref\np2\nV#\nsVonclick\np3\nVjQuery(this).parents('form').submit();\np4\nsVclass\np5\nVui-widget-header ui-widget-link ui-widget-button ui-corner-all\np6\ns."
    )
    _attrs_4362535824 = _loads(
        "(dp1\nVhref\np2\nV#\nsVonclick\np3\nVvar f = jQuery(this).parents('form'); jQuery('#next', f).val(window.location.href);f.submit();\np4\nsVclass\np5\nVui-widget-header ui-widget-link ui-widget-button ui-corner-all\np6\ns."
    )
    _attrs_4362536336 = _loads('(dp1\nVtype\np2\nVsubmit\np3\ns.')
    _init_stream = _loads(
        'cchameleon.core.generation\ninitialize_stream\np1\n.')
    _attrs_4362536592 = _loads(
        '(dp1\nVclass\np2\nVui-icon ui-icon-circle-arrow-w\np3\ns.')
    _attrs_4362536144 = _loads(
        '(dp1\nVclass\np2\nVui-icon ui-icon-check\np3\ns.')
    _init_default = _loads(
        'cchameleon.core.generation\ninitialize_default\np1\n.')
    _attrs_4362535696 = _loads(
        '(dp1\nVname\np2\nVnext\np3\nsVvalue\np4\nV\nsVtype\np5\nVhidden\np6\nsVid\np7\nVnext\np8\ns.'
    )
    _attrs_4362535248 = _loads('(dp1\n.')
    _attrs_4362535504 = _loads('(dp1\n.')
    _attrs_4362535888 = _loads(
        '(dp1\nVclass\np2\nVui-icon ui-icon-check\np3\ns.')
    _init_tal = _loads('cchameleon.core.generation\ninitialize_tal\np1\n.')
    _attrs_4362536016 = _loads('(dp1\nVtype\np2\nVsubmit\np3\ns.')

    def render(econtext, rcontext=None):
        macros = econtext.get('macros')
        _translate = econtext.get('_translate')
        _slots = econtext.get('_slots')
        target_language = econtext.get('target_language')
        u'_init_stream()'
        (
            _out,
            _write,
        ) = _init_stream()
        u'_init_tal()'
        (
            _attributes,
            repeat,
        ) = _init_tal()
        u'_init_default()'
        _default = _init_default()
        u'None'
        default = None
        u'None'
        _domain = None
        u"main.macros['master']"
        _metal = _lookup_attr(econtext['main'], 'macros')['master']

        def _callback_main(econtext,
                           _repeat,
                           _out=_out,
                           _write=_write,
                           _domain=_domain,
                           **_ignored):
            if _repeat:
                repeat.update(_repeat)
            attrs = _attrs_4362535248
            _write(u'<div>\n      ')
            attrs = _attrs_4362535376
            u'request.fa_url(request.model_name)'
            _write(u'<form method="POST" enctype="multipart/form-data"')
            _tmp1 = _lookup_attr(econtext['request'], 'fa_url')(_lookup_attr(
                econtext['request'], 'model_name'))
            if (_tmp1 is _default):
                _tmp1 = None
            if ((_tmp1 is not None) and (_tmp1 is not False)):
                if (_tmp1.__class__ not in (
                        str,
                        unicode,
                        int,
                        float,
                )):
                    _tmp1 = unicode(
                        _translate(_tmp1,
                                   domain=_domain,
                                   mapping=None,
                                   target_language=target_language,
                                   default=None))
                else:
                    if not isinstance(_tmp1, unicode):
                        _tmp1 = str(_tmp1)
                if ('&' in _tmp1):
                    if (';' in _tmp1):
                        _tmp1 = _re_amp.sub('&amp;', _tmp1)
                    else:
                        _tmp1 = _tmp1.replace('&', '&amp;')
                if ('<' in _tmp1):
                    _tmp1 = _tmp1.replace('<', '&lt;')
                if ('>' in _tmp1):
                    _tmp1 = _tmp1.replace('>', '&gt;')
                if ('"' in _tmp1):
                    _tmp1 = _tmp1.replace('"', '&quot;')
                _write(((' action="' + _tmp1) + '"'))
            u"''"
            _write(u'>\n        ')
            _default.value = default = ''
            u'fs.render()'
            _content = _lookup_attr(econtext['fs'], 'render')()
            attrs = _attrs_4362535504
            u'_content'
            _write(u'<div>')
            _tmp1 = _content
            _tmp = _tmp1
            if (_tmp.__class__ not in (
                    str,
                    unicode,
                    int,
                    float,
            )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp,
                                      domain=_domain,
                                      mapping=None,
                                      target_language=target_language,
                                      default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                _write(_tmp)
            _write(u'</div>\n        ')
            attrs = _attrs_4362535568
            _write(u'<div class="fa_controls">\n          ')
            attrs = _attrs_4362535696
            _write(
                u'<input type="hidden" id="next" name="next" value="" />\n          '
            )
            attrs = _attrs_4362535760
            _write(
                u'<a class="ui-widget-header ui-widget-link ui-widget-button ui-corner-all" href="#" onclick="jQuery(this).parents(\'form\').submit();">\n            '
            )
            attrs = _attrs_4362535888
            u"''"
            _write(
                u'<span class="ui-icon ui-icon-check"></span>\n            ')
            _default.value = default = ''
            u'Save'
            _content = u'Save'
            u'_content'
            _tmp1 = _content
            _tmp = _tmp1
            if (_tmp.__class__ not in (
                    str,
                    unicode,
                    int,
                    float,
            )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp,
                                      domain=_domain,
                                      mapping=None,
                                      target_language=target_language,
                                      default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                if ('&' in _tmp):
                    if (';' in _tmp):
                        _tmp = _re_amp.sub('&amp;', _tmp)
                    else:
                        _tmp = _tmp.replace('&', '&amp;')
                if ('<' in _tmp):
                    _tmp = _tmp.replace('<', '&lt;')
                if ('>' in _tmp):
                    _tmp = _tmp.replace('>', '&gt;')
                _write(_tmp)
            _write(u'\n            ')
            attrs = _attrs_4362536016
            _write(u'<input type="submit" />\n          </a>\n          ')
            attrs = _attrs_4362535824
            _write(
                u'<a class="ui-widget-header ui-widget-link ui-widget-button ui-corner-all" href="#" onclick="var f = jQuery(this).parents(\'form\'); jQuery(\'#next\', f).val(window.location.href);f.submit();">\n            '
            )
            attrs = _attrs_4362536144
            u"''"
            _write(
                u'<span class="ui-icon ui-icon-check"></span>\n            ')
            _default.value = default = ''
            u'Save and add another'
            _content = u'Save and add another'
            u'_content'
            _tmp1 = _content
            _tmp = _tmp1
            if (_tmp.__class__ not in (
                    str,
                    unicode,
                    int,
                    float,
            )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp,
                                      domain=_domain,
                                      mapping=None,
                                      target_language=target_language,
                                      default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                if ('&' in _tmp):
                    if (';' in _tmp):
                        _tmp = _re_amp.sub('&amp;', _tmp)
                    else:
                        _tmp = _tmp.replace('&', '&amp;')
                if ('<' in _tmp):
                    _tmp = _tmp.replace('<', '&lt;')
                if ('>' in _tmp):
                    _tmp = _tmp.replace('>', '&gt;')
                _write(_tmp)
            _write(u'\n            ')
            attrs = _attrs_4362536336
            _write(u'<input type="submit" />\n          </a>\n          ')
            attrs = _attrs_4362536400
            u'request.fa_url(request.model_name)'
            _write(u'<a class="ui-widget-header ui-widget-link ui-corner-all"')
            _tmp1 = _lookup_attr(econtext['request'], 'fa_url')(_lookup_attr(
                econtext['request'], 'model_name'))
            if (_tmp1 is _default):
                _tmp1 = None
            if ((_tmp1 is not None) and (_tmp1 is not False)):
                if (_tmp1.__class__ not in (
                        str,
                        unicode,
                        int,
                        float,
                )):
                    _tmp1 = unicode(
                        _translate(_tmp1,
                                   domain=_domain,
                                   mapping=None,
                                   target_language=target_language,
                                   default=None))
                else:
                    if not isinstance(_tmp1, unicode):
                        _tmp1 = str(_tmp1)
                if ('&' in _tmp1):
                    if (';' in _tmp1):
                        _tmp1 = _re_amp.sub('&amp;', _tmp1)
                    else:
                        _tmp1 = _tmp1.replace('&', '&amp;')
                if ('<' in _tmp1):
                    _tmp1 = _tmp1.replace('<', '&lt;')
                if ('>' in _tmp1):
                    _tmp1 = _tmp1.replace('>', '&gt;')
                if ('"' in _tmp1):
                    _tmp1 = _tmp1.replace('"', '&quot;')
                _write(((' href="' + _tmp1) + '"'))
            _write(u'>\n            ')
            attrs = _attrs_4362536592
            u"''"
            _write(
                u'<span class="ui-icon ui-icon-circle-arrow-w"></span>\n            '
            )
            _default.value = default = ''
            u'Cancel'
            _content = u'Cancel'
            u'_content'
            _tmp1 = _content
            _tmp = _tmp1
            if (_tmp.__class__ not in (
                    str,
                    unicode,
                    int,
                    float,
            )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp,
                                      domain=_domain,
                                      mapping=None,
                                      target_language=target_language,
                                      default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                if ('&' in _tmp):
                    if (';' in _tmp):
                        _tmp = _re_amp.sub('&amp;', _tmp)
                    else:
                        _tmp = _tmp.replace('&', '&amp;')
                if ('<' in _tmp):
                    _tmp = _tmp.replace('<', '&lt;')
                if ('>' in _tmp):
                    _tmp = _tmp.replace('>', '&gt;')
                _write(_tmp)
            _write(
                u'\n          </a>\n        </div>\n      </form>\n    </div>\n'
            )

        u"{'main': _callback_main}"
        _tmp = {
            'main': _callback_main,
        }
        u"main.macros['master']"
        _metal.render(_tmp,
                      _out=_out,
                      _write=_write,
                      _domain=_domain,
                      econtext=econtext)
        return _out.getvalue()

    return render
コード例 #14
0
def bind():
    from cPickle import loads as _loads
    _attrs_4369730256 = _loads('(dp1\nVtype\np2\nVtext/css\np3\ns.')
    _lookup_attr = _loads('cchameleon.core.codegen\nlookup_attr\np1\n.')
    _re_amp = _loads("cre\n_compile\np1\n(S'&(?!([A-Za-z]+|#[0-9]+);)'\np2\nI0\ntRp3\n.")
    _attrs_4369731408 = _loads('(dp1\n.')
    _init_stream = _loads('cchameleon.core.generation\ninitialize_stream\np1\n.')
    _attrs_4369729936 = _loads('(dp1\nVtype\np2\nVtext/javascript\np3\ns.')
    _attrs_4369727696 = _loads('(dp1\nVstyle\np2\nVdisplay:none;\np3\nsVid\np4\nVmodels\np5\ns.')
    _attrs_4369730832 = _loads('(dp1\n.')
    _attrs_4369729296 = _loads('(dp1\nVid\np2\nVlanguages\np3\ns.')
    _init_default = _loads('cchameleon.core.generation\ninitialize_default\np1\n.')
    _attrs_4369730768 = _loads('(dp1\n.')
    _attrs_4369730960 = _loads('(dp1\n.')
    _init_tal = _loads('cchameleon.core.generation\ninitialize_tal\np1\n.')
    _attrs_4369727824 = _loads('(dp1\nVclass\np2\nVbreadcrumb\np3\ns.')
    _marker = _loads("ccopy_reg\n_reconstructor\np1\n(cchameleon.core.i18n\nStringMarker\np2\nc__builtin__\nstr\np3\nS''\ntRp4\n.")
    _attrs_4369728720 = _loads('(dp1\nVclass\np2\nVfooter-actions\np3\ns.')
    _attrs_4369729040 = _loads('(dp1\n.')
    _attrs_4369731536 = _loads('(dp1\nVid\np2\nVcontent\np3\nsVclass\np4\nVui-admin ui-widget\np5\ns.')
    _attrs_4369730000 = _loads('(dp1\nVtype\np2\nVtext/javascript\np3\ns.')
    _attrs_4369728784 = _loads('(dp1\n.')
    _attrs_4369728400 = _loads('(dp1\nVstyle\np2\nVdisplay:none\np3\nsVclass\np4\nVroot_url\np5\ns.')
    _attrs_4369730512 = _loads('(dp1\n.')
    _attrs_4369729808 = _loads('(dp1\nVid\np2\nVheader\np3\nsVclass\np4\nVui-widget-header ui-corner-all\np5\ns.')
    _init_scope = _loads('cchameleon.core.utils\necontext\np1\n.')
    _attrs_4369729872 = _loads('(dp1\nVid\np2\nVthemes\np3\ns.')
    _attrs_4369730896 = _loads('(dp1\n.')
    _attrs_4369727952 = _loads('(dp1\n.')
    def render(econtext, rcontext=None):
        macros = econtext.get('macros')
        _translate = econtext.get('_translate')
        _slots = econtext.get('_slots')
        target_language = econtext.get('target_language')
        u"%(scope)s['%(out)s'], %(scope)s['%(write)s']"
        (_out, _write, ) = (econtext['_out'], econtext['_write'], )
        u'_init_tal()'
        (_attributes, repeat, ) = _init_tal()
        u'_init_default()'
        _default = _init_default()
        u'None'
        default = None
        u'None'
        _domain = None
        attrs = _attrs_4369728784
        _write(u'<html>\n    ')
        attrs = _attrs_4369731408
        u"''"
        _write(u'<head>\n      ')
        _default.value = default = ''
        u'request.model_name'
        _tmp1 = _lookup_attr(econtext['request'], 'model_name')
        if _tmp1:
            pass
            u'model_class.plural'
            _content = _lookup_attr(econtext['model_class'], 'plural')
            attrs = _attrs_4369730768
            u'_content'
            _write(u'<title>')
            _tmp1 = _content
            _tmp = _tmp1
            if (_tmp.__class__ not in (str, unicode, int, float, )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                if ('&' in _tmp):
                    if (';' in _tmp):
                        _tmp = _re_amp.sub('&amp;', _tmp)
                    else:
                        _tmp = _tmp.replace('&', '&amp;')
                if ('<' in _tmp):
                    _tmp = _tmp.replace('<', '&lt;')
                if ('>' in _tmp):
                    _tmp = _tmp.replace('>', '&gt;')
                _write(_tmp)
            _write(u'</title>')
        _write(u'\n      ')
        _tmp_domain0 = _domain
        u"u'fa_jquery'"
        _domain = u'fa_jquery'
        u'request.model_name is None'
        _tmp1 = (_lookup_attr(econtext['request'], 'model_name') is None)
        if _tmp1:
            pass
            attrs = _attrs_4369730960
            u"u'Models index'"
            _write(u'<title>')
            _msgid = u'Models index'
            u"%(translate)s(' '.join(%(msgid)s.split()), domain=%(domain)s, mapping=None, target_language=%(language)s, default=%(msgid)s)"
            _result = _translate(_lookup_attr(' ', 'join')(_msgid.split()), domain=_domain, mapping=None, target_language=target_language, default=_msgid)
            u'_result'
            _tmp1 = _result
            _write((_tmp1 + u'</title>'))
        _write(u'\n      ')
        _domain = _tmp_domain0
        attrs = _attrs_4369730000
        u"%(slots)s.get(u'javascript')"
        _write(u'<script type="text/javascript">\n        jQuery(document).ready(function() {\n          $(\'select#models, select#themes\')\n            .change(function() { window.location.href = $(this).val(); })\n            .selectmenu({\'style\':\'dropdown\', \'menuWidth\':\'20%\', \'width\':\'100%\'});\n        });\n      </script>\n      ')
        _tmp = _slots.get(u'javascript')
        u'%(tmp)s is not None'
        _tmp1 = (_tmp is not None)
        if _tmp1:
            pass
            u'isinstance(%(tmp)s, basestring)'
            _tmp2 = isinstance(_tmp, basestring)
            if not _tmp2:
                pass
                econtext.update(dict(rcontext=rcontext, _domain=_domain))
                _tmp(econtext, repeat)
            else:
                pass
                u'%(tmp)s'
                _tmp2 = _tmp
                _tmp = _tmp2
                if (_tmp.__class__ not in (str, unicode, int, float, )):
                    try:
                        _tmp = _tmp.__html__
                    except:
                        _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                    else:
                        _tmp = _tmp()
                        _write(_tmp)
                        _tmp = None
                if (_tmp is not None):
                    if not isinstance(_tmp, unicode):
                        _tmp = str(_tmp)
                    _write(_tmp)
        else:
            pass
            attrs = _attrs_4369729936
            _write(u'<script type="text/javascript"></script>')
        _write(u'\n      ')
        attrs = _attrs_4369730256
        _write(u'<style type="text/css">\n        label {font-weight:bold;}\n        h1, h3 {padding:0.1 0.3em;}\n        h1 a, h3 a {text-decoration:none;}\n        #header { height: 2em; font-size:1.5em; }\n        #header div { font-size:1.5em; }\n        #header a { font-size:1em; }\n        ul#languages {float:right;}\n        ul#languages li {display: inline;}\n        ul#languages a {text-decoration:none; color: grey;}\n        ul#languages a.lang_active {text-decoration:underline;}\n        div.footer-actions {float:right;width: 300px;}\n        div.breadcrumb {float:right;width:20%;margin-right:20px;}\n        div.breadcrumb a {text-decoration:none;}\n        h1 a.ui-selectmenu {height:1em;}\n        a.ui-state-default {padding:0.1em 0.3em;}\n        a.fm-button {padding:0.4em 0.5em;}\n        a.fm-button-icon-left {padding-left:1.9em;}\n      </style>\n    </head>\n    ')
        attrs = _attrs_4369730896
        _write(u'<body>\n      ')
        attrs = _attrs_4369731536
        _write(u'<div id="content" class="ui-admin ui-widget">\n        ')
        attrs = _attrs_4369729808
        u'request.model_name and breadcrumb'
        _write(u'<h1 id="header" class="ui-widget-header ui-corner-all">\n          ')
        _tmp1 = (_lookup_attr(econtext['request'], 'model_name') and econtext['breadcrumb'])
        if _tmp1:
            pass
            attrs = _attrs_4369727824
            u"''"
            _write(u'<div class="breadcrumb">\n            ')
            _default.value = default = ''
            u'breadcrumb.render(request)'
            _content = _lookup_attr(econtext['breadcrumb'], 'render')(econtext['request'])
            attrs = _attrs_4369727696
            u'_content'
            _write(u'<select id="models" style="display:none;">')
            _tmp1 = _content
            _tmp = _tmp1
            if (_tmp.__class__ not in (str, unicode, int, float, )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                _write(_tmp)
            _write(u'</select>\n          </div>')
        u'request.model_name'
        _write(u'\n          ')
        _tmp1 = _lookup_attr(econtext['request'], 'model_name')
        if _tmp1:
            pass
            attrs = _attrs_4369727952
            u"''"
            _write(u'<div>\n            ')
            _default.value = default = ''
            u'model_class.plural'
            _content = _lookup_attr(econtext['model_class'], 'plural')
            attrs = _attrs_4369730832
            u'request.fa_url(model_name)'
            _write(u'<a')
            _tmp1 = _lookup_attr(econtext['request'], 'fa_url')(econtext['model_name'])
            if (_tmp1 is _default):
                _tmp1 = None
            if ((_tmp1 is not None) and (_tmp1 is not False)):
                if (_tmp1.__class__ not in (str, unicode, int, float, )):
                    _tmp1 = unicode(_translate(_tmp1, domain=_domain, mapping=None, target_language=target_language, default=None))
                else:
                    if not isinstance(_tmp1, unicode):
                        _tmp1 = str(_tmp1)
                if ('&' in _tmp1):
                    if (';' in _tmp1):
                        _tmp1 = _re_amp.sub('&amp;', _tmp1)
                    else:
                        _tmp1 = _tmp1.replace('&', '&amp;')
                if ('<' in _tmp1):
                    _tmp1 = _tmp1.replace('<', '&lt;')
                if ('>' in _tmp1):
                    _tmp1 = _tmp1.replace('>', '&gt;')
                if ('"' in _tmp1):
                    _tmp1 = _tmp1.replace('"', '&quot;')
                _write(((' href="' + _tmp1) + '"'))
            u'_content'
            _write('>')
            _tmp1 = _content
            _tmp = _tmp1
            if (_tmp.__class__ not in (str, unicode, int, float, )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                if ('&' in _tmp):
                    if (';' in _tmp):
                        _tmp = _re_amp.sub('&amp;', _tmp)
                    else:
                        _tmp = _tmp.replace('&', '&amp;')
                if ('<' in _tmp):
                    _tmp = _tmp.replace('<', '&lt;')
                if ('>' in _tmp):
                    _tmp = _tmp.replace('>', '&gt;')
                _write(_tmp)
            u"''"
            _write(u'</a>\n            ')
            _default.value = default = ''
            u"request.model_id and hasattr(request.model_class, '__unicode__')"
            _tmp1 = (_lookup_attr(econtext['request'], 'model_id') and hasattr(_lookup_attr(econtext['request'], 'model_class'), '__unicode__'))
            if _tmp1:
                pass
                u'unicode(request.model_instance)'
                _content = unicode(_lookup_attr(econtext['request'], 'model_instance'))
                u'_content'
                _tmp1 = _content
                _tmp = _tmp1
                if (_tmp.__class__ not in (str, unicode, int, float, )):
                    try:
                        _tmp = _tmp.__html__
                    except:
                        _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                    else:
                        _tmp = _tmp()
                        _write(_tmp)
                        _tmp = None
                if (_tmp is not None):
                    if not isinstance(_tmp, unicode):
                        _tmp = str(_tmp)
                    if ('&' in _tmp):
                        if (';' in _tmp):
                            _tmp = _re_amp.sub('&amp;', _tmp)
                        else:
                            _tmp = _tmp.replace('&', '&amp;')
                    if ('<' in _tmp):
                        _tmp = _tmp.replace('<', '&lt;')
                    if ('>' in _tmp):
                        _tmp = _tmp.replace('>', '&gt;')
                    _write(_tmp)
            u"''"
            _write(u'\n            ')
            _default.value = default = ''
            u"request.model_id and not hasattr(request.model_class, '__unicode__')"
            _tmp1 = (_lookup_attr(econtext['request'], 'model_id') and not hasattr(_lookup_attr(econtext['request'], 'model_class'), '__unicode__'))
            if _tmp1:
                pass
                u'request.model_id'
                _content = _lookup_attr(econtext['request'], 'model_id')
                u'_content'
                _tmp1 = _content
                _tmp = _tmp1
                if (_tmp.__class__ not in (str, unicode, int, float, )):
                    try:
                        _tmp = _tmp.__html__
                    except:
                        _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                    else:
                        _tmp = _tmp()
                        _write(_tmp)
                        _tmp = None
                if (_tmp is not None):
                    if not isinstance(_tmp, unicode):
                        _tmp = str(_tmp)
                    if ('&' in _tmp):
                        if (';' in _tmp):
                            _tmp = _re_amp.sub('&amp;', _tmp)
                        else:
                            _tmp = _tmp.replace('&', '&amp;')
                    if ('<' in _tmp):
                        _tmp = _tmp.replace('<', '&lt;')
                    if ('>' in _tmp):
                        _tmp = _tmp.replace('>', '&gt;')
                    _write(_tmp)
            _write(u'\n          </div>')
        _write(u'\n          ')
        _tmp_domain0 = _domain
        u"u'fa_jquery'"
        _domain = u'fa_jquery'
        u'not request.model_name'
        _tmp1 = not _lookup_attr(econtext['request'], 'model_name')
        if _tmp1:
            pass
            attrs = _attrs_4369729040
            u"u'Models index'"
            _write(u'<div>')
            _msgid = u'Models index'
            u"%(translate)s(' '.join(%(msgid)s.split()), domain=%(domain)s, mapping=None, target_language=%(language)s, default=%(msgid)s)"
            _result = _translate(_lookup_attr(' ', 'join')(_msgid.split()), domain=_domain, mapping=None, target_language=target_language, default=_msgid)
            u'_result'
            _tmp1 = _result
            _write((_tmp1 + u'</div>'))
        _write(u'\n        ')
        _domain = _tmp_domain0
        u"%(slots)s.get(u'main')"
        _write(u'</h1>\n        ')
        _tmp = _slots.get(u'main')
        u'%(tmp)s is not None'
        _tmp1 = (_tmp is not None)
        if _tmp1:
            pass
            u'isinstance(%(tmp)s, basestring)'
            _tmp2 = isinstance(_tmp, basestring)
            if not _tmp2:
                pass
                econtext.update(dict(rcontext=rcontext, _domain=_domain))
                _tmp(econtext, repeat)
            else:
                pass
                u'%(tmp)s'
                _tmp2 = _tmp
                _tmp = _tmp2
                if (_tmp.__class__ not in (str, unicode, int, float, )):
                    try:
                        _tmp = _tmp.__html__
                    except:
                        _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                    else:
                        _tmp = _tmp()
                        _write(_tmp)
                        _tmp = None
                if (_tmp is not None):
                    if not isinstance(_tmp, unicode):
                        _tmp = str(_tmp)
                    _write(_tmp)
        else:
            pass
            attrs = _attrs_4369730512
            _write(u'<div>\n        </div>')
        _write(u'\n        ')
        attrs = _attrs_4369728720
        u"''"
        _write(u'<div class="footer-actions">\n          ')
        _default.value = default = ''
        u'actions.languages'
        _tmp1 = _lookup_attr(econtext['actions'], 'languages')
        if _tmp1:
            pass
            u'actions.languages(request)'
            _content = _lookup_attr(econtext['actions'], 'languages')(econtext['request'])
            attrs = _attrs_4369729296
            u'_content'
            _write(u'<ul id="languages">')
            _tmp1 = _content
            _tmp = _tmp1
            if (_tmp.__class__ not in (str, unicode, int, float, )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                _write(_tmp)
            _write(u'</ul>')
        u"''"
        _write(u'\n          ')
        _default.value = default = ''
        u'actions.themes'
        _tmp1 = _lookup_attr(econtext['actions'], 'themes')
        if _tmp1:
            pass
            u'actions.themes(request)'
            _content = _lookup_attr(econtext['actions'], 'themes')(econtext['request'])
            attrs = _attrs_4369729872
            u'_content'
            _write(u'<select id="themes">')
            _tmp1 = _content
            _tmp = _tmp1
            if (_tmp.__class__ not in (str, unicode, int, float, )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                _write(_tmp)
            _write(u'</select>')
        _write(u'\n        </div>\n        ')
        attrs = _attrs_4369728400
        u'request.fa_url()'
        _write(u'<a style="display:none" class="root_url"')
        _tmp1 = _lookup_attr(econtext['request'], 'fa_url')()
        if (_tmp1 is _default):
            _tmp1 = None
        if ((_tmp1 is not None) and (_tmp1 is not False)):
            if (_tmp1.__class__ not in (str, unicode, int, float, )):
                _tmp1 = unicode(_translate(_tmp1, domain=_domain, mapping=None, target_language=target_language, default=None))
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if ('&' in _tmp1):
                if (';' in _tmp1):
                    _tmp1 = _re_amp.sub('&amp;', _tmp1)
                else:
                    _tmp1 = _tmp1.replace('&', '&amp;')
            if ('<' in _tmp1):
                _tmp1 = _tmp1.replace('<', '&lt;')
            if ('>' in _tmp1):
                _tmp1 = _tmp1.replace('>', '&gt;')
            if ('"' in _tmp1):
                _tmp1 = _tmp1.replace('"', '&quot;')
            _write(((' href="' + _tmp1) + '"'))
        _write(u'></a>\n      </div>\n    </body>\n</html>')
        return
    return render
コード例 #15
0
ファイル: edit.pt.py プロジェクト: samuelchen/fa.jquery
def bind():
    from cPickle import loads as _loads
    _lookup_attr = _loads('cchameleon.core.codegen\nlookup_attr\np1\n.')
    _init_scope = _loads('cchameleon.core.utils\necontext\np1\n.')
    _attrs_4362773520 = _loads('(dp1\nVaction\np2\nV\nsVmethod\np3\nVPOST\np4\nsVenctype\np5\nVmultipart/form-data\np6\ns.')
    _attrs_4362773776 = _loads('(dp1\nVname\np2\nVnext\np3\nsVvalue\np4\nV\nsVtype\np5\nVhidden\np6\nsVid\np7\nVnext\np8\ns.')
    _attrs_4362773712 = _loads('(dp1\nVname\np2\nV_method\np3\nsVtype\np4\nVhidden\np5\nsVvalue\np6\nVPUT\np7\ns.')
    _init_stream = _loads('cchameleon.core.generation\ninitialize_stream\np1\n.')
    _attrs_4362773392 = _loads('(dp1\n.')
    _init_default = _loads('cchameleon.core.generation\ninitialize_default\np1\n.')
    _attrs_4362773648 = _loads('(dp1\n.')
    _init_tal = _loads('cchameleon.core.generation\ninitialize_tal\np1\n.')
    _attrs_4362773840 = _loads('(dp1\nVclass\np2\nVfa_controls\np3\ns.')
    def render(econtext, rcontext=None):
        macros = econtext.get('macros')
        _translate = econtext.get('_translate')
        _slots = econtext.get('_slots')
        target_language = econtext.get('target_language')
        u'_init_stream()'
        (_out, _write, ) = _init_stream()
        u'_init_tal()'
        (_attributes, repeat, ) = _init_tal()
        u'_init_default()'
        _default = _init_default()
        u'None'
        default = None
        u'None'
        _domain = None
        u"main.macros['master']"
        _metal = _lookup_attr(econtext['main'], 'macros')['master']
        def _callback_main(econtext, _repeat, _out=_out, _write=_write, _domain=_domain, **_ignored):
            if _repeat:
                repeat.update(_repeat)
            attrs = _attrs_4362773392
            _write(u'<div>\n      ')
            attrs = _attrs_4362773520
            u"''"
            _write(u'<form action="" method="POST" enctype="multipart/form-data">\n        ')
            _default.value = default = ''
            u'fs.render()'
            _content = _lookup_attr(econtext['fs'], 'render')()
            attrs = _attrs_4362773648
            u'_content'
            _write(u'<div>')
            _tmp1 = _content
            _tmp = _tmp1
            if (_tmp.__class__ not in (str, unicode, int, float, )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                _write(_tmp)
            _write(u'</div>\n        ')
            attrs = _attrs_4362773712
            _write(u'<input type="hidden" name="_method" value="PUT" />\n        ')
            attrs = _attrs_4362773776
            u"u'\\n        '"
            _write(u'<input type="hidden" id="next" name="next" value="" />\n        ')
            _default.value = default = u'\n        '
            u'request.buttons.render(request)'
            _content = _lookup_attr(_lookup_attr(econtext['request'], 'buttons'), 'render')(econtext['request'])
            attrs = _attrs_4362773840
            u'_content'
            _write(u'<div class="fa_controls">')
            _tmp1 = _content
            _tmp = _tmp1
            if (_tmp.__class__ not in (str, unicode, int, float, )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                _write(_tmp)
            _write(u'</div>\n      </form>\n    </div>\n')
        u"{'main': _callback_main}"
        _tmp = {'main': _callback_main, }
        u"main.macros['master']"
        _metal.render(_tmp, _out=_out, _write=_write, _domain=_domain, econtext=econtext)
        return _out.getvalue()
    return render
コード例 #16
0
def bind():
    from cPickle import loads as _loads
    _lookup_attr = _loads('cchameleon.core.codegen\nlookup_attr\np1\n.')
    _init_scope = _loads('cchameleon.core.utils\necontext\np1\n.')
    _re_amp = _loads("cre\n_compile\np1\n(S'&(?!([A-Za-z]+|#[0-9]+);)'\np2\nI0\ntRp3\n.")
    _attrs_4356515344 = _loads('(dp1\n.')
    _attrs_4356515728 = _loads('(dp1\nVclass\np2\nVui-widget-header ui-widget-link ui-corner-all\np3\ns.')
    _attrs_4356515408 = _loads('(dp1\n.')
    _init_stream = _loads('cchameleon.core.generation\ninitialize_stream\np1\n.')
    _attrs_4356515920 = _loads('(dp1\nVclass\np2\nVui-icon ui-icon-circle-arrow-w\np3\ns.')
    _attrs_4356515664 = _loads('(dp1\nVhref\np2\nV#\nsVclass\np3\nVui-widget-header ui-widget-link ui-widget-button ui-corner-all\np4\ns.')
    _attrs_4356515216 = _loads('(dp1\n.')
    _init_default = _loads('cchameleon.core.generation\ninitialize_default\np1\n.')
    _attrs_4356515536 = _loads('(dp1\nVclass\np2\nVfa_field\np3\ns.')
    _attrs_4356515792 = _loads("(dp1\nVtype\np2\nVsubmit\np3\nsVvalue\np4\nV${F_('Edit')}\np5\ns.")
    _init_tal = _loads('cchameleon.core.generation\ninitialize_tal\np1\n.')
    def render(econtext, rcontext=None):
        macros = econtext.get('macros')
        _translate = econtext.get('_translate')
        _slots = econtext.get('_slots')
        target_language = econtext.get('target_language')
        u'_init_stream()'
        (_out, _write, ) = _init_stream()
        u'_init_tal()'
        (_attributes, repeat, ) = _init_tal()
        u'_init_default()'
        _default = _init_default()
        u'None'
        default = None
        u'None'
        _domain = None
        u"main.macros['master']"
        _metal = _lookup_attr(econtext['main'], 'macros')['master']
        def _callback_main(econtext, _repeat, _out=_out, _write=_write, _domain=_domain, **_ignored):
            if _repeat:
                repeat.update(_repeat)
            attrs = _attrs_4356515216
            u"''"
            _write(u'<div>\n      Custom Foo view\n      ')
            _default.value = default = ''
            u'fs.render()'
            _content = _lookup_attr(econtext['fs'], 'render')()
            attrs = _attrs_4356515344
            u'_content'
            _write(u'<div>')
            _tmp1 = _content
            _tmp = _tmp1
            if (_tmp.__class__ not in (str, unicode, int, float, )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                _write(_tmp)
            _write(u'</div>\n      ')
            attrs = _attrs_4356515408
            _write(u'<div>\n        ')
            attrs = _attrs_4356515536
            _write(u'<p class="fa_field">\n          ')
            attrs = _attrs_4356515664
            u"request.fa_url(request.model_name, request.model_id, 'edit')"
            _write(u'<a class="ui-widget-header ui-widget-link ui-widget-button ui-corner-all"')
            _tmp1 = _lookup_attr(econtext['request'], 'fa_url')(_lookup_attr(econtext['request'], 'model_name'), _lookup_attr(econtext['request'], 'model_id'), 'edit')
            if (_tmp1 is _default):
                _tmp1 = u'#'
            if ((_tmp1 is not None) and (_tmp1 is not False)):
                if (_tmp1.__class__ not in (str, unicode, int, float, )):
                    _tmp1 = unicode(_translate(_tmp1, domain=_domain, mapping=None, target_language=target_language, default=None))
                else:
                    if not isinstance(_tmp1, unicode):
                        _tmp1 = str(_tmp1)
                if ('&' in _tmp1):
                    if (';' in _tmp1):
                        _tmp1 = _re_amp.sub('&amp;', _tmp1)
                    else:
                        _tmp1 = _tmp1.replace('&', '&amp;')
                if ('<' in _tmp1):
                    _tmp1 = _tmp1.replace('<', '&lt;')
                if ('>' in _tmp1):
                    _tmp1 = _tmp1.replace('>', '&gt;')
                if ('"' in _tmp1):
                    _tmp1 = _tmp1.replace('"', '&quot;')
                _write(((' href="' + _tmp1) + '"'))
            _write(u'>\n              ')
            attrs = _attrs_4356515792
            'join(value("F_(\'Edit\')"),)'
            _write(u'<input type="submit"')
            _tmp1 = econtext['F_']('Edit')
            if (_tmp1 is _default):
                _tmp1 = u"${F_('Edit')}"
            if ((_tmp1 is not None) and (_tmp1 is not False)):
                if (_tmp1.__class__ not in (str, unicode, int, float, )):
                    _tmp1 = unicode(_translate(_tmp1, domain=_domain, mapping=None, target_language=target_language, default=None))
                else:
                    if not isinstance(_tmp1, unicode):
                        _tmp1 = str(_tmp1)
                if ('&' in _tmp1):
                    if (';' in _tmp1):
                        _tmp1 = _re_amp.sub('&amp;', _tmp1)
                    else:
                        _tmp1 = _tmp1.replace('&', '&amp;')
                if ('<' in _tmp1):
                    _tmp1 = _tmp1.replace('<', '&lt;')
                if ('>' in _tmp1):
                    _tmp1 = _tmp1.replace('>', '&gt;')
                if ('"' in _tmp1):
                    _tmp1 = _tmp1.replace('"', '&quot;')
                _write(((' value="' + _tmp1) + '"'))
            _write(u' />\n          </a>\n          ')
            attrs = _attrs_4356515728
            u'request.fa_url(request.model_name)'
            _write(u'<a class="ui-widget-header ui-widget-link ui-corner-all"')
            _tmp1 = _lookup_attr(econtext['request'], 'fa_url')(_lookup_attr(econtext['request'], 'model_name'))
            if (_tmp1 is _default):
                _tmp1 = None
            if ((_tmp1 is not None) and (_tmp1 is not False)):
                if (_tmp1.__class__ not in (str, unicode, int, float, )):
                    _tmp1 = unicode(_translate(_tmp1, domain=_domain, mapping=None, target_language=target_language, default=None))
                else:
                    if not isinstance(_tmp1, unicode):
                        _tmp1 = str(_tmp1)
                if ('&' in _tmp1):
                    if (';' in _tmp1):
                        _tmp1 = _re_amp.sub('&amp;', _tmp1)
                    else:
                        _tmp1 = _tmp1.replace('&', '&amp;')
                if ('<' in _tmp1):
                    _tmp1 = _tmp1.replace('<', '&lt;')
                if ('>' in _tmp1):
                    _tmp1 = _tmp1.replace('>', '&gt;')
                if ('"' in _tmp1):
                    _tmp1 = _tmp1.replace('"', '&quot;')
                _write(((' href="' + _tmp1) + '"'))
            _write(u'>\n            ')
            attrs = _attrs_4356515920
            u"F_('Back')"
            _write(u'<span class="ui-icon ui-icon-circle-arrow-w"></span>\n            ')
            _tmp1 = econtext['F_']('Back')
            _tmp = _tmp1
            if (_tmp.__class__ not in (str, unicode, int, float, )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                if ('&' in _tmp):
                    if (';' in _tmp):
                        _tmp = _re_amp.sub('&amp;', _tmp)
                    else:
                        _tmp = _tmp.replace('&', '&amp;')
                if ('<' in _tmp):
                    _tmp = _tmp.replace('<', '&lt;')
                if ('>' in _tmp):
                    _tmp = _tmp.replace('>', '&gt;')
                _write(_tmp)
            _write(u'\n          </a>\n        </p>\n      </div>\n    </div>\n')
        u"{'main': _callback_main}"
        _tmp = {'main': _callback_main, }
        u"main.macros['master']"
        _metal.render(_tmp, _out=_out, _write=_write, _domain=_domain, econtext=econtext)
        return _out.getvalue()
    return render
コード例 #17
0
ファイル: index.pt.py プロジェクト: jcress410/academe
def bind():
    from cPickle import loads as _loads
    _lookup_attr = _loads('cchameleon.core.codegen\nlookup_attr\np1\n.')
    _attrs_153130828 = _loads('(dp1\nVclass\np2\nVapp-name\np3\ns.')
    _re_amp = _loads("cre\n_compile\np1\n(S'&(?!([A-Za-z]+|#[0-9]+);)'\np2\nI0\ntRp3\n.")
    _attrs_153132204 = _loads('(dp1\nVid\np2\nVleft\np3\nsVclass\np4\nValign-right\np5\ns.')
    _attrs_153132492 = _loads('(dp1\n.')
    _attrs_153129708 = _loads('(dp1\n.')
    _init_stream = _loads('cchameleon.core.generation\ninitialize_stream\np1\n.')
    _attrs_153106732 = _loads('(dp1\n.')
    _attrs_153150156 = _loads('(dp1\n.')
    _attrs_153132940 = _loads('(dp1\nVid\np2\nVright\np3\nsVclass\np4\nValign-left\np5\ns.')
    _attrs_153129036 = _loads('(dp1\n.')
    _attrs_153107468 = _loads('(dp1\nVid\np2\nVheader\np3\ns.')
    _attrs_153152524 = _loads('(dp1\n.')
    _attrs_153105100 = _loads('(dp1\nVxml:lang\np2\nVen\np3\nsVxmlns\np4\nVhttp://www.w3.org/1999/xhtml\np5\ns.')
    _attrs_153106188 = _loads('(dp1\nVcontent\np2\nVblog roller and personal content         managment for academics\np3\nsVname\np4\nVdescription\np5\ns.')
    _attrs_153153228 = _loads('(dp1\nVhref\np2\nVhttp://docs.pylonshq.com/pyramid/dev/#change-history\np3\ns.')
    _attrs_153106956 = _loads('(dp1\nVid\np2\nVwrap\np3\ns.')
    _attrs_153105324 = _loads('(dp1\n.')
    _attrs_153130156 = _loads('(dp1\n.')
    _attrs_153133036 = _loads('(dp1\nVname\np2\nVq\nsVvalue\np3\nV\nsVtype\np4\nVtext\np5\nsVid\np6\nVq\ns.')
    _attrs_153105580 = _loads('(dp1\n.')
    _attrs_153151436 = _loads('(dp1\nVhref\np2\nVhttp://docs.pylonshq.com/\np3\ns.')
    _attrs_153151884 = _loads('(dp1\nVhref\np2\nVhttp://docs.pylonshq.com/pyramid/dev/#narrative-documentation\np3\ns.')
    _attrs_153106572 = _loads('(dp1\nVmedia\np2\nVscreen\np3\nsVcharset\np4\nVutf-8\np5\nsVhref\np6\nV${css_path}\np7\nsVrel\np8\nVstylesheet\np9\nsVtype\np10\nVtext/css\np11\ns.')
    _attrs_153131500 = _loads('(dp1\n.')
    _attrs_153105996 = _loads('(dp1\nVcontent\np2\nVblog academic\np3\nsVname\np4\nVkeywords\np5\ns.')
    _init_default = _loads('cchameleon.core.generation\ninitialize_default\np1\n.')
    _attrs_153107980 = _loads('(dp1\nVid\np2\nVtop\np3\ns.')
    _attrs_153130604 = _loads('(dp1\n.')
    _attrs_153107212 = _loads('(dp1\nVsrc\np2\nV${logo}\np3\nsVid\np4\nVmain-image\np5\ns.')
    _init_tal = _loads('cchameleon.core.generation\ninitialize_tal\np1\n.')
    _attrs_153129932 = _loads('(dp1\nVclass\np2\nVapp-name\np3\ns.')
    _attrs_153132140 = _loads('(dp1\nVid\np2\nVfooter\np3\ns.')
    _attrs_153151180 = _loads('(dp1\n.')
    _attrs_153131692 = _loads('(dp1\nVid\np2\nVbottom\np3\ns.')
    _attrs_153130380 = _loads('(dp1\nVclass\np2\nVapp-name\np3\ns.')
    _attrs_153106380 = _loads('(dp1\nVhref\np2\nV${request.application_url}/static/images/favicon.ico\np3\nsVrel\np4\nVshortcut icon\np5\ns.')
    _attrs_153129260 = _loads('(dp1\n.')
    _attrs_153152780 = _loads('(dp1\nVhref\np2\nVhttp://docs.pylonshq.com/pyramid/dev/#tutorials\np3\ns.')
    _attrs_153152972 = _loads('(dp1\n.')
    _attrs_153105804 = _loads('(dp1\nVcontent\np2\nVtext/html;charset=UTF-8\np3\nsVhttp-equiv\np4\nVContent-Type\np5\ns.')
    _attrs_153152076 = _loads('(dp1\n.')
    _attrs_153149740 = _loads('(dp1\nVtype\np2\nVsubmit\np3\nsVid\np4\nVx\nsVvalue\np5\nVSearch\np6\ns.')
    _attrs_153174828 = _loads('(dp1\n.')
    _attrs_153174636 = _loads('(dp1\nVhref\np2\nVhttp://docs.pylonshq.com/pyramid/dev/#support-and-development\np3\ns.')
    _attrs_153175084 = _loads('(dp1\nVhref\np2\nVirc://irc.freenode.net#pyramid\np3\ns.')
    _attrs_153131052 = _loads('(dp1\n.')
    _init_scope = _loads('cchameleon.core.utils\necontext\np1\n.')
    _attrs_153175404 = _loads('(dp1\nVclass\np2\nVfooter\np3\ns.')
    _attrs_153174188 = _loads('(dp1\nVhref\np2\nVhttp://docs.pylonshq.com/pyramid/dev/#sample-applications\np3\ns.')
    _attrs_153150380 = _loads('(dp1\nVclass\np2\nVlinks\np3\ns.')
    _attrs_153131948 = _loads('(dp1\nVclass\np2\nVbottom\np3\ns.')
    _attrs_153150924 = _loads('(dp1\nVhref\np2\nVhttp://pylonshq.com\np3\ns.')
    _attrs_153153420 = _loads('(dp1\n.')
    _attrs_153174380 = _loads('(dp1\n.')
    _attrs_153129484 = _loads('(dp1\nVclass\np2\nVapp-name\np3\ns.')
    _attrs_153151628 = _loads('(dp1\n.')
    _attrs_153107756 = _loads('(dp1\nVclass\np2\nVheader\np3\ns.')
    _attrs_153150636 = _loads('(dp1\n.')
    _attrs_153152332 = _loads('(dp1\nVhref\np2\nVhttp://docs.pylonshq.com/pyramid/dev/#api-documentation\np3\ns.')
    _attrs_153132748 = _loads('(dp1\nVaction\np2\nVhttp://docs.pylonshq.com/pyramid/dev/search.html\np3\nsVmethod\np4\nVget\np5\ns.')
    _attrs_153131276 = _loads('(dp1\nVclass\np2\nVapp-name\np3\ns.')
    _attrs_153108076 = _loads('(dp1\n.')
    def render(econtext, rcontext=None):
        macros = econtext.get('macros')
        _translate = econtext.get('_translate')
        _slots = econtext.get('_slots')
        target_language = econtext.get('target_language')
        u'_init_stream()'
        (_out, _write, ) = _init_stream()
        u'_init_tal()'
        (_attributes, repeat, ) = _init_tal()
        u'_init_default()'
        _default = _init_default()
        u'None'
        default = None
        u'None'
        _domain = None
        _write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n')
        attrs = _attrs_153105100
        _write(u'<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">\n')
        attrs = _attrs_153105324
        _write(u'<head>\n    ')
        attrs = _attrs_153105580
        _write(u'<title>A blogrolla</title>\n    ')
        attrs = _attrs_153105804
        _write(u'<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />\n    ')
        attrs = _attrs_153105996
        _write(u'<meta name="keywords" content="blog academic" />\n    ')
        attrs = _attrs_153106188
        _write(u'<meta name="description" content="blog roller and personal content         managment for academics" />\n    ')
        attrs = _attrs_153106380
        "join(value('request.application_url'), u'/static/images/favicon.ico')"
        _write(u'<link rel="shortcut icon"')
        _tmp1 = ('%s%s' % (_lookup_attr(econtext['request'], 'application_url'), u'/static/images/favicon.ico', ))
        if (_tmp1 is _default):
            _tmp1 = u'${request.application_url}/static/images/favicon.ico'
        if ((_tmp1 is not None) and (_tmp1 is not False)):
            if (_tmp1.__class__ not in (str, unicode, int, float, )):
                _tmp1 = unicode(_translate(_tmp1, domain=_domain, mapping=None, target_language=target_language, default=None))
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if ('&' in _tmp1):
                if (';' in _tmp1):
                    _tmp1 = _re_amp.sub('&amp;', _tmp1)
                else:
                    _tmp1 = _tmp1.replace('&', '&amp;')
            if ('<' in _tmp1):
                _tmp1 = _tmp1.replace('<', '&lt;')
            if ('>' in _tmp1):
                _tmp1 = _tmp1.replace('>', '&gt;')
            if ('"' in _tmp1):
                _tmp1 = _tmp1.replace('"', '&quot;')
            _write(((' href="' + _tmp1) + '"'))
        _write(u' />\n    ')
        attrs = _attrs_153106572
        "join(value('css_path'),)"
        _write(u'<link rel="stylesheet"')
        _tmp1 = econtext['css_path']
        if (_tmp1 is _default):
            _tmp1 = u'${css_path}'
        if ((_tmp1 is not None) and (_tmp1 is not False)):
            if (_tmp1.__class__ not in (str, unicode, int, float, )):
                _tmp1 = unicode(_translate(_tmp1, domain=_domain, mapping=None, target_language=target_language, default=None))
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if ('&' in _tmp1):
                if (';' in _tmp1):
                    _tmp1 = _re_amp.sub('&amp;', _tmp1)
                else:
                    _tmp1 = _tmp1.replace('&', '&amp;')
            if ('<' in _tmp1):
                _tmp1 = _tmp1.replace('<', '&lt;')
            if ('>' in _tmp1):
                _tmp1 = _tmp1.replace('>', '&gt;')
            if ('"' in _tmp1):
                _tmp1 = _tmp1.replace('"', '&quot;')
            _write(((' href="' + _tmp1) + '"'))
        _write(u' type="text/css" media="screen" charset="utf-8" />\n</head>\n\n')
        attrs = _attrs_153106732
        _write(u'<body>\n')
        attrs = _attrs_153106956
        _write(u'<div id="wrap">\n')
        attrs = _attrs_153107212
        "join(value('logo'),)"
        _write(u'<img')
        _tmp1 = econtext['logo']
        if (_tmp1 is _default):
            _tmp1 = u'${logo}'
        if ((_tmp1 is not None) and (_tmp1 is not False)):
            if (_tmp1.__class__ not in (str, unicode, int, float, )):
                _tmp1 = unicode(_translate(_tmp1, domain=_domain, mapping=None, target_language=target_language, default=None))
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if ('&' in _tmp1):
                if (';' in _tmp1):
                    _tmp1 = _re_amp.sub('&amp;', _tmp1)
                else:
                    _tmp1 = _tmp1.replace('&', '&amp;')
            if ('<' in _tmp1):
                _tmp1 = _tmp1.replace('<', '&lt;')
            if ('>' in _tmp1):
                _tmp1 = _tmp1.replace('>', '&gt;')
            if ('"' in _tmp1):
                _tmp1 = _tmp1.replace('"', '&quot;')
            _write(((' src="' + _tmp1) + '"'))
        _write(u' id="main-image" />\n')
        attrs = _attrs_153107468
        _write(u'<div id="header">\n')
        attrs = _attrs_153107756
        _write(u'<div class="header">')
        attrs = _attrs_153108076
        u'name'
        _write(u'<h1>')
        _tmp1 = econtext['name']
        _tmp = _tmp1
        if (_tmp.__class__ not in (str, unicode, int, float, )):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if (_tmp is not None):
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            if ('&' in _tmp):
                if (';' in _tmp):
                    _tmp = _re_amp.sub('&amp;', _tmp)
                else:
                    _tmp = _tmp.replace('&', '&amp;')
            if ('<' in _tmp):
                _tmp = _tmp.replace('<', '&lt;')
            if ('>' in _tmp):
                _tmp = _tmp.replace('>', '&gt;')
            _write(_tmp)
        _write(u'</h1>The Pyramid Web Application Development Framework</div>\n\n</div>\n\n')
        attrs = _attrs_153107980
        _write(u'<div id="top">\nWelcome to ')
        attrs = _attrs_153129036
        u'project'
        _write(u'<h1>')
        _tmp1 = econtext['project']
        _tmp = _tmp1
        if (_tmp.__class__ not in (str, unicode, int, float, )):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if (_tmp is not None):
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            if ('&' in _tmp):
                if (';' in _tmp):
                    _tmp = _re_amp.sub('&amp;', _tmp)
                else:
                    _tmp = _tmp.replace('&', '&amp;')
            if ('<' in _tmp):
                _tmp = _tmp.replace('<', '&lt;')
            if ('>' in _tmp):
                _tmp = _tmp.replace('>', '&gt;')
            _write(_tmp)
        _write(u'</h1>, an application generated by')
        attrs = _attrs_153129260
        _write(u'<br />\nthe Pyramid web application development framework.\nWelcome to ')
        attrs = _attrs_153129484
        u'project'
        _write(u'<span class="app-name">')
        _tmp1 = econtext['project']
        _tmp = _tmp1
        if (_tmp.__class__ not in (str, unicode, int, float, )):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if (_tmp is not None):
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            if ('&' in _tmp):
                if (';' in _tmp):
                    _tmp = _re_amp.sub('&amp;', _tmp)
                else:
                    _tmp = _tmp.replace('&', '&amp;')
            if ('<' in _tmp):
                _tmp = _tmp.replace('<', '&lt;')
            if ('>' in _tmp):
                _tmp = _tmp.replace('>', '&gt;')
            _write(_tmp)
        _write(u'</span>, an application generated by')
        attrs = _attrs_153129708
        _write(u'<br />\nthe Pyramid web application development framework.\nWelcome to ')
        attrs = _attrs_153129932
        u'project'
        _write(u'<span class="app-name">')
        _tmp1 = econtext['project']
        _tmp = _tmp1
        if (_tmp.__class__ not in (str, unicode, int, float, )):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if (_tmp is not None):
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            if ('&' in _tmp):
                if (';' in _tmp):
                    _tmp = _re_amp.sub('&amp;', _tmp)
                else:
                    _tmp = _tmp.replace('&', '&amp;')
            if ('<' in _tmp):
                _tmp = _tmp.replace('<', '&lt;')
            if ('>' in _tmp):
                _tmp = _tmp.replace('>', '&gt;')
            _write(_tmp)
        _write(u'</span>, an application generated by')
        attrs = _attrs_153130156
        _write(u'<br />\nthe Pyramid web application development framework.\nWelcome to ')
        attrs = _attrs_153130380
        u'project'
        _write(u'<span class="app-name">')
        _tmp1 = econtext['project']
        _tmp = _tmp1
        if (_tmp.__class__ not in (str, unicode, int, float, )):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if (_tmp is not None):
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            if ('&' in _tmp):
                if (';' in _tmp):
                    _tmp = _re_amp.sub('&amp;', _tmp)
                else:
                    _tmp = _tmp.replace('&', '&amp;')
            if ('<' in _tmp):
                _tmp = _tmp.replace('<', '&lt;')
            if ('>' in _tmp):
                _tmp = _tmp.replace('>', '&gt;')
            _write(_tmp)
        _write(u'</span>, an application generated by')
        attrs = _attrs_153130604
        _write(u'<br />\nthe Pyramid web application development framework.\nWelcome to ')
        attrs = _attrs_153130828
        u'project'
        _write(u'<span class="app-name">')
        _tmp1 = econtext['project']
        _tmp = _tmp1
        if (_tmp.__class__ not in (str, unicode, int, float, )):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if (_tmp is not None):
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            if ('&' in _tmp):
                if (';' in _tmp):
                    _tmp = _re_amp.sub('&amp;', _tmp)
                else:
                    _tmp = _tmp.replace('&', '&amp;')
            if ('<' in _tmp):
                _tmp = _tmp.replace('<', '&lt;')
            if ('>' in _tmp):
                _tmp = _tmp.replace('>', '&gt;')
            _write(_tmp)
        _write(u'</span>, an application generated by')
        attrs = _attrs_153131052
        _write(u'<br />\nthe Pyramid web application development framework.\nWelcome to ')
        attrs = _attrs_153131276
        u'project'
        _write(u'<span class="app-name">')
        _tmp1 = econtext['project']
        _tmp = _tmp1
        if (_tmp.__class__ not in (str, unicode, int, float, )):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if (_tmp is not None):
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            if ('&' in _tmp):
                if (';' in _tmp):
                    _tmp = _re_amp.sub('&amp;', _tmp)
                else:
                    _tmp = _tmp.replace('&', '&amp;')
            if ('<' in _tmp):
                _tmp = _tmp.replace('<', '&lt;')
            if ('>' in _tmp):
                _tmp = _tmp.replace('>', '&gt;')
            _write(_tmp)
        _write(u'</span>, an application generated by')
        attrs = _attrs_153131500
        _write(u'<br />\nthe Pyramid web application development framework.\n</div>\n\n')
        attrs = _attrs_153131692
        _write(u'<div id="bottom">\n')
        attrs = _attrs_153131948
        _write(u'<div class="bottom">\n')
        attrs = _attrs_153132204
        _write(u'<div id="left" class="align-right">\n')
        attrs = _attrs_153132492
        _write(u'<h3>Search Pyramid documentation</h3>\n')
        attrs = _attrs_153132748
        _write(u'<form method="get" action="http://docs.pylonshq.com/pyramid/dev/search.html">\n')
        attrs = _attrs_153133036
        _write(u'<input type="text" id="q" name="q" value="" />\n')
        attrs = _attrs_153149740
        _write(u'<input type="submit" id="x" value="Search" />\n</form>\n</div>\n')
        attrs = _attrs_153132940
        _write(u'<div id="right" class="align-left">\n')
        attrs = _attrs_153150156
        _write(u'<h3>Pyramid links</h3>\n')
        attrs = _attrs_153150380
        _write(u'<ul class="links">\n')
        attrs = _attrs_153150636
        _write(u'<li>\n')
        attrs = _attrs_153150924
        _write(u'<a href="http://pylonshq.com">Pylons Website</a>\n</li>\n')
        attrs = _attrs_153151180
        _write(u'<li>\n')
        attrs = _attrs_153151436
        _write(u'<a href="http://docs.pylonshq.com/">The Pylons Project Documentation</a>\n</li>\n')
        attrs = _attrs_153151628
        _write(u'<li>\n')
        attrs = _attrs_153151884
        _write(u'<a href="http://docs.pylonshq.com/pyramid/dev/#narrative-documentation">Narrative Documentation</a>\n</li>\n')
        attrs = _attrs_153152076
        _write(u'<li>\n')
        attrs = _attrs_153152332
        _write(u'<a href="http://docs.pylonshq.com/pyramid/dev/#api-documentation">API Documentation</a>\n</li>\n')
        attrs = _attrs_153152524
        _write(u'<li>\n')
        attrs = _attrs_153152780
        _write(u'<a href="http://docs.pylonshq.com/pyramid/dev/#tutorials">Tutorials</a>\n</li>\n')
        attrs = _attrs_153152972
        _write(u'<li>\n')
        attrs = _attrs_153153228
        _write(u'<a href="http://docs.pylonshq.com/pyramid/dev/#change-history">Change History</a>\n</li>\n')
        attrs = _attrs_153153420
        _write(u'<li>\n')
        attrs = _attrs_153174188
        _write(u'<a href="http://docs.pylonshq.com/pyramid/dev/#sample-applications">Sample Applications</a>\n</li>\n')
        attrs = _attrs_153174380
        _write(u'<li>\n')
        attrs = _attrs_153174636
        _write(u'<a href="http://docs.pylonshq.com/pyramid/dev/#support-and-development">Support and Development</a>\n</li>\n')
        attrs = _attrs_153174828
        _write(u'<li>\n')
        attrs = _attrs_153175084
        _write(u'<a href="irc://irc.freenode.net#pyramid">IRC Channel</a>\n</li>\n</ul>\n</div>\n</div>\n</div>\n\n')
        attrs = _attrs_153132140
        _write(u'<div id="footer">\n')
        attrs = _attrs_153175404
        _write(u'<div class="footer">&copy; Copyright 2010, j. cress</div>\n</div>\n</div>\n</body>\n</html>')
        return _out.getvalue()
    return render
コード例 #18
0
def bind():
    from cPickle import loads as _loads
    _lookup_attr = _loads('cchameleon.core.codegen\nlookup_attr\np1\n.')
    _init_scope = _loads('cchameleon.core.utils\necontext\np1\n.')
    _re_amp = _loads(
        "cre\n_compile\np1\n(S'&(?!([A-Za-z]+|#[0-9]+);)'\np2\nI0\ntRp3\n.")
    _attrs_4364380688 = _loads('(dp1\nVclass\np2\nVfa_controls\np3\ns.')
    _init_stream = _loads(
        'cchameleon.core.generation\ninitialize_stream\np1\n.')
    _init_default = _loads(
        'cchameleon.core.generation\ninitialize_default\np1\n.')
    _attrs_4364382032 = _loads('(dp1\n.')
    _attrs_4364379408 = _loads(
        '(dp1\nVmethod\np2\nVPOST\np3\nsVenctype\np4\nVmultipart/form-data\np5\ns.'
    )
    _attrs_4364380368 = _loads(
        '(dp1\nVname\np2\nVnext\np3\nsVvalue\np4\nV\nsVtype\np5\nVhidden\np6\nsVid\np7\nVnext\np8\ns.'
    )
    _attrs_4364380048 = _loads('(dp1\n.')
    _init_tal = _loads('cchameleon.core.generation\ninitialize_tal\np1\n.')

    def render(econtext, rcontext=None):
        macros = econtext.get('macros')
        _translate = econtext.get('_translate')
        _slots = econtext.get('_slots')
        target_language = econtext.get('target_language')
        u'_init_stream()'
        (
            _out,
            _write,
        ) = _init_stream()
        u'_init_tal()'
        (
            _attributes,
            repeat,
        ) = _init_tal()
        u'_init_default()'
        _default = _init_default()
        u'None'
        default = None
        u'None'
        _domain = None
        u"main.macros['master']"
        _metal = _lookup_attr(econtext['main'], 'macros')['master']

        def _callback_main(econtext,
                           _repeat,
                           _out=_out,
                           _write=_write,
                           _domain=_domain,
                           **_ignored):
            if _repeat:
                repeat.update(_repeat)
            attrs = _attrs_4364382032
            _write(u'<div>\n      ')
            attrs = _attrs_4364379408
            u'request.fa_url(request.model_name)'
            _write(u'<form method="POST" enctype="multipart/form-data"')
            _tmp1 = _lookup_attr(econtext['request'], 'fa_url')(_lookup_attr(
                econtext['request'], 'model_name'))
            if (_tmp1 is _default):
                _tmp1 = None
            if ((_tmp1 is not None) and (_tmp1 is not False)):
                if (_tmp1.__class__ not in (
                        str,
                        unicode,
                        int,
                        float,
                )):
                    _tmp1 = unicode(
                        _translate(_tmp1,
                                   domain=_domain,
                                   mapping=None,
                                   target_language=target_language,
                                   default=None))
                else:
                    if not isinstance(_tmp1, unicode):
                        _tmp1 = str(_tmp1)
                if ('&' in _tmp1):
                    if (';' in _tmp1):
                        _tmp1 = _re_amp.sub('&amp;', _tmp1)
                    else:
                        _tmp1 = _tmp1.replace('&', '&amp;')
                if ('<' in _tmp1):
                    _tmp1 = _tmp1.replace('<', '&lt;')
                if ('>' in _tmp1):
                    _tmp1 = _tmp1.replace('>', '&gt;')
                if ('"' in _tmp1):
                    _tmp1 = _tmp1.replace('"', '&quot;')
                _write(((' action="' + _tmp1) + '"'))
            u"''"
            _write(u'>\n        ')
            _default.value = default = ''
            u'fs.render()'
            _content = _lookup_attr(econtext['fs'], 'render')()
            attrs = _attrs_4364380048
            u'_content'
            _write(u'<div>')
            _tmp1 = _content
            _tmp = _tmp1
            if (_tmp.__class__ not in (
                    str,
                    unicode,
                    int,
                    float,
            )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp,
                                      domain=_domain,
                                      mapping=None,
                                      target_language=target_language,
                                      default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                _write(_tmp)
            _write(u'</div>\n        ')
            attrs = _attrs_4364380368
            u"u'\\n        '"
            _write(
                u'<input type="hidden" id="next" name="next" value="" />\n        '
            )
            _default.value = default = u'\n        '
            u'actions.buttons(request)'
            _content = _lookup_attr(econtext['actions'],
                                    'buttons')(econtext['request'])
            attrs = _attrs_4364380688
            u'_content'
            _write(u'<div class="fa_controls">')
            _tmp1 = _content
            _tmp = _tmp1
            if (_tmp.__class__ not in (
                    str,
                    unicode,
                    int,
                    float,
            )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp,
                                      domain=_domain,
                                      mapping=None,
                                      target_language=target_language,
                                      default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                _write(_tmp)
            _write(u'</div>\n      </form>\n    </div>\n')

        u"{'main': _callback_main}"
        _tmp = {
            'main': _callback_main,
        }
        u"main.macros['master']"
        _metal.render(_tmp,
                      _out=_out,
                      _write=_write,
                      _domain=_domain,
                      econtext=econtext)
        return _out.getvalue()

    return render
コード例 #19
0
ファイル: grid.pt.py プロジェクト: FormAlchemy/fa.jquery
def bind():
    from cPickle import loads as _loads
    _lookup_attr = _loads('cchameleon.core.codegen\nlookup_attr\np1\n.')
    _init_scope = _loads('cchameleon.core.utils\necontext\np1\n.')
    _re_amp = _loads("cre\n_compile\np1\n(S'&(?!([A-Za-z]+|#[0-9]+);)'\np2\nI0\ntRp3\n.")
    _attrs_4355504080 = _loads('(dp1\n.')
    _attrs_4355531408 = _loads('(dp1\n.')
    _attrs_4355533904 = _loads('(dp1\n.')
    _attrs_4355533264 = _loads('(dp1\nVclass\np2\nVlayout-grid\np3\ns.')
    _attrs_4355533520 = _loads('(dp1\n.')
    _init_stream = _loads('cchameleon.core.generation\ninitialize_stream\np1\n.')
    _attrs_4355533648 = _loads('(dp1\nVclass\np2\nVui-widget-header\np3\ns.')
    _attrs_4355504144 = _loads('(dp1\n.')
    _init_default = _loads('cchameleon.core.generation\ninitialize_default\np1\n.')
    _attrs_4355503824 = _loads('(dp1\n.')
    _init_tal = _loads('cchameleon.core.generation\ninitialize_tal\np1\n.')
    _attrs_4355534032 = _loads('(dp1\nVclass\np2\nVgrid_error\np3\ns.')
    def render(econtext, rcontext=None):
        macros = econtext.get('macros')
        _translate = econtext.get('_translate')
        _slots = econtext.get('_slots')
        target_language = econtext.get('target_language')
        u'_init_stream()'
        (_out, _write, ) = _init_stream()
        u'_init_tal()'
        (_attributes, repeat, ) = _init_tal()
        u'_init_default()'
        _default = _init_default()
        u'None'
        default = None
        u'None'
        _domain = None
        attrs = _attrs_4355533264
        _write(u'<table class="layout-grid">\n')
        attrs = _attrs_4355533520
        _write(u'<thead>\n  ')
        attrs = _attrs_4355533648
        u"''"
        _write(u'<tr class="ui-widget-header">\n    ')
        _default.value = default = ''
        u'collection.render_fields.itervalues()'
        _tmp1 = _lookup_attr(_lookup_attr(econtext['collection'], 'render_fields'), 'itervalues')()
        field = None
        (_tmp1, _tmp2, ) = repeat.insert('field', _tmp1)
        for field in _tmp1:
            _tmp2 = (_tmp2 - 1)
            u'field.label()'
            _content = _lookup_attr(field, 'label')()
            attrs = _attrs_4355503824
            u'_content'
            _write(u'<th>')
            _tmp3 = _content
            _tmp = _tmp3
            if (_tmp.__class__ not in (str, unicode, int, float, )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                if ('&' in _tmp):
                    if (';' in _tmp):
                        _tmp = _re_amp.sub('&amp;', _tmp)
                    else:
                        _tmp = _tmp.replace('&', '&amp;')
                if ('<' in _tmp):
                    _tmp = _tmp.replace('<', '&lt;')
                if ('>' in _tmp):
                    _tmp = _tmp.replace('>', '&gt;')
                _write(_tmp)
            _write(u'</th>')
            if (_tmp2 == 0):
                break
            _write(' ')
        _write(u'\n  </tr>\n</thead>\n')
        attrs = _attrs_4355504080
        u'collection.rows'
        _write(u'<tbody>\n  ')
        _tmp1 = _lookup_attr(econtext['collection'], 'rows')
        row = None
        (_tmp1, _tmp2, ) = repeat.insert('row', _tmp1)
        for row in _tmp1:
            _tmp2 = (_tmp2 - 1)
            u'collection._set_active(row)'
            _write(u'')
            dummy = _lookup_attr(econtext['collection'], '_set_active')(row)
            u'collection.get_errors(row)'
            row_errors = _lookup_attr(econtext['collection'], 'get_errors')(row)
            attrs = _attrs_4355504144
            u"ui-widget-${repeat.row.even and 'even' or 'odd'}"
            _write(u'<tr')
            _tmp3 = ('%s%s' % (u'ui-widget-', ((_lookup_attr(repeat.row, 'even') and 'even') or 'odd'), ))
            if (_tmp3 is _default):
                _tmp3 = None
            if ((_tmp3 is not None) and (_tmp3 is not False)):
                if (_tmp3.__class__ not in (str, unicode, int, float, )):
                    _tmp3 = unicode(_translate(_tmp3, domain=_domain, mapping=None, target_language=target_language, default=None))
                else:
                    if not isinstance(_tmp3, unicode):
                        _tmp3 = str(_tmp3)
                if ('&' in _tmp3):
                    if (';' in _tmp3):
                        _tmp3 = _re_amp.sub('&amp;', _tmp3)
                    else:
                        _tmp3 = _tmp3.replace('&', '&amp;')
                if ('<' in _tmp3):
                    _tmp3 = _tmp3.replace('<', '&lt;')
                if ('>' in _tmp3):
                    _tmp3 = _tmp3.replace('>', '&gt;')
                if ('"' in _tmp3):
                    _tmp3 = _tmp3.replace('"', '&quot;')
                _write(((' class="' + _tmp3) + '"'))
            u'collection.render_fields.itervalues()'
            _write(u'>\n      ')
            _tmp3 = _lookup_attr(_lookup_attr(econtext['collection'], 'render_fields'), 'itervalues')()
            field = None
            (_tmp3, _tmp4, ) = repeat.insert('field', _tmp3)
            for field in _tmp3:
                _tmp4 = (_tmp4 - 1)
                attrs = _attrs_4355531408
                u"''"
                _write(u'<td>\n        ')
                _default.value = default = ''
                u'field.render()'
                _content = _lookup_attr(field, 'render')()
                attrs = _attrs_4355533904
                u'_content'
                _write(u'<div>')
                _tmp5 = _content
                _tmp = _tmp5
                if (_tmp.__class__ not in (str, unicode, int, float, )):
                    try:
                        _tmp = _tmp.__html__
                    except:
                        _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                    else:
                        _tmp = _tmp()
                        _write(_tmp)
                        _tmp = None
                if (_tmp is not None):
                    if not isinstance(_tmp, unicode):
                        _tmp = str(_tmp)
                    _write(_tmp)
                u'row_errors.get(field, [])'
                _write(u'</div>\n        ')
                _tmp5 = _lookup_attr(row_errors, 'get')(field, [])
                error = None
                (_tmp5, _tmp6, ) = repeat.insert('error', _tmp5)
                for error in _tmp5:
                    _tmp6 = (_tmp6 - 1)
                    attrs = _attrs_4355534032
                    u'error'
                    _write(u'<span class="grid_error">')
                    _tmp7 = error
                    _tmp = _tmp7
                    if (_tmp.__class__ not in (str, unicode, int, float, )):
                        try:
                            _tmp = _tmp.__html__
                        except:
                            _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                        else:
                            _tmp = _tmp()
                            _write(_tmp)
                            _tmp = None
                    if (_tmp is not None):
                        if not isinstance(_tmp, unicode):
                            _tmp = str(_tmp)
                        if ('&' in _tmp):
                            if (';' in _tmp):
                                _tmp = _re_amp.sub('&amp;', _tmp)
                            else:
                                _tmp = _tmp.replace('&', '&amp;')
                        if ('<' in _tmp):
                            _tmp = _tmp.replace('<', '&lt;')
                        if ('>' in _tmp):
                            _tmp = _tmp.replace('>', '&gt;')
                        _write(_tmp)
                    _write(u'</span>')
                    if (_tmp6 == 0):
                        break
                    _write(' ')
                _write(u'\n      </td>')
                if (_tmp4 == 0):
                    break
                _write(' ')
            _write(u'\n    </tr>\n  ')
            if (_tmp2 == 0):
                break
            _write(' ')
        _write(u'\n</tbody>\n</table>')
        return _out.getvalue()
    return render
コード例 #20
0
ファイル: master.pt.py プロジェクト: bkocherov/fa.jquery
def bind():
    from cPickle import loads as _loads
    _attrs_4356773776 = _loads('(dp1\n.')
    _lookup_attr = _loads('cchameleon.core.codegen\nlookup_attr\np1\n.')
    _init_scope = _loads('cchameleon.core.utils\necontext\np1\n.')
    _re_amp = _loads("cre\n_compile\np1\n(S'&(?!([A-Za-z]+|#[0-9]+);)'\np2\nI0\ntRp3\n.")
    _attrs_4356773712 = _loads('(dp1\nVclass\np2\nVbreadcrumb\np3\ns.')
    _attrs_4356773584 = _loads('(dp1\nVid\np2\nVheader\np3\nsVclass\np4\nVui-widget-header ui-corner-all\np5\ns.')
    _attrs_4356773840 = _loads('(dp1\nVtype\np2\nVtext/css\np3\ns.')
    _attrs_4356772944 = _loads('(dp1\n.')
    _attrs_4356774096 = _loads('(dp1\n.')
    _attrs_4356773648 = _loads('(dp1\n.')
    _attrs_4356772624 = _loads('(dp1\n.')
    _init_stream = _loads('cchameleon.core.generation\ninitialize_stream\np1\n.')
    _attrs_4356774544 = _loads('(dp1\n.')
    _attrs_4356773200 = _loads('(dp1\nVrel\np2\nVstylesheet\np3\ns.')
    _init_default = _loads('cchameleon.core.generation\ninitialize_default\np1\n.')
    _attrs_4356773328 = _loads('(dp1\nVrel\np2\nVstylesheet\np3\ns.')
    _attrs_4356772816 = _loads('(dp1\n.')
    _attrs_4356773072 = _loads('(dp1\n.')
    _attrs_4356773968 = _loads('(dp1\nVid\np2\nVcontent\np3\nsVclass\np4\nVui-admin ui-widget\np5\ns.')
    _init_tal = _loads('cchameleon.core.generation\ninitialize_tal\np1\n.')
    _attrs_4356773456 = _loads('(dp1\nVtype\np2\nVtext/javascript\np3\ns.')
    def render(econtext, rcontext=None):
        macros = econtext.get('macros')
        _translate = econtext.get('_translate')
        _slots = econtext.get('_slots')
        target_language = econtext.get('target_language')
        u"%(scope)s['%(out)s'], %(scope)s['%(write)s']"
        (_out, _write, ) = (econtext['_out'], econtext['_write'], )
        u'_init_tal()'
        (_attributes, repeat, ) = _init_tal()
        u'_init_default()'
        _default = _init_default()
        u'None'
        default = None
        u'None'
        _domain = None
        attrs = _attrs_4356772624
        _write(u'<html>\n    ')
        attrs = _attrs_4356772816
        u"''"
        _write(u'<head>\n      ')
        _default.value = default = ''
        u"request.model_name or 'root'"
        _content = (_lookup_attr(econtext['request'], 'model_name') or 'root')
        attrs = _attrs_4356773072
        u'_content'
        _write(u'<title>')
        _tmp1 = _content
        _tmp = _tmp1
        if (_tmp.__class__ not in (str, unicode, int, float, )):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if (_tmp is not None):
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            if ('&' in _tmp):
                if (';' in _tmp):
                    _tmp = _re_amp.sub('&amp;', _tmp)
                else:
                    _tmp = _tmp.replace('&', '&amp;')
            if ('<' in _tmp):
                _tmp = _tmp.replace('<', '&lt;')
            if ('>' in _tmp):
                _tmp = _tmp.replace('>', '&gt;')
            _write(_tmp)
        _write(u'</title>\n      ')
        attrs = _attrs_4356773200
        u"request.static_url('fa.jquery:jquery-ui/css/smoothness/jquery-ui-1.8.8.custom.css')"
        _write(u'<link rel="stylesheet"')
        _tmp1 = _lookup_attr(econtext['request'], 'static_url')('fa.jquery:jquery-ui/css/smoothness/jquery-ui-1.8.8.custom.css')
        if (_tmp1 is _default):
            _tmp1 = None
        if ((_tmp1 is not None) and (_tmp1 is not False)):
            if (_tmp1.__class__ not in (str, unicode, int, float, )):
                _tmp1 = unicode(_translate(_tmp1, domain=_domain, mapping=None, target_language=target_language, default=None))
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if ('&' in _tmp1):
                if (';' in _tmp1):
                    _tmp1 = _re_amp.sub('&amp;', _tmp1)
                else:
                    _tmp1 = _tmp1.replace('&', '&amp;')
            if ('<' in _tmp1):
                _tmp1 = _tmp1.replace('<', '&lt;')
            if ('>' in _tmp1):
                _tmp1 = _tmp1.replace('>', '&gt;')
            if ('"' in _tmp1):
                _tmp1 = _tmp1.replace('"', '&quot;')
            _write(((' href="' + _tmp1) + '"'))
        _write(u' />\n      ')
        attrs = _attrs_4356773328
        u"request.static_url('fa.jquery:jquery-ui/fa.jquery.min.css')"
        _write(u'<link rel="stylesheet"')
        _tmp1 = _lookup_attr(econtext['request'], 'static_url')('fa.jquery:jquery-ui/fa.jquery.min.css')
        if (_tmp1 is _default):
            _tmp1 = None
        if ((_tmp1 is not None) and (_tmp1 is not False)):
            if (_tmp1.__class__ not in (str, unicode, int, float, )):
                _tmp1 = unicode(_translate(_tmp1, domain=_domain, mapping=None, target_language=target_language, default=None))
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if ('&' in _tmp1):
                if (';' in _tmp1):
                    _tmp1 = _re_amp.sub('&amp;', _tmp1)
                else:
                    _tmp1 = _tmp1.replace('&', '&amp;')
            if ('<' in _tmp1):
                _tmp1 = _tmp1.replace('<', '&lt;')
            if ('>' in _tmp1):
                _tmp1 = _tmp1.replace('>', '&gt;')
            if ('"' in _tmp1):
                _tmp1 = _tmp1.replace('"', '&quot;')
            _write(((' href="' + _tmp1) + '"'))
        _write(u' />\n      ')
        attrs = _attrs_4356773456
        u"request.static_url('fa.jquery:jquery-ui/fa.jquery.min.js')"
        _write(u'<script type="text/javascript"')
        _tmp1 = _lookup_attr(econtext['request'], 'static_url')('fa.jquery:jquery-ui/fa.jquery.min.js')
        if (_tmp1 is _default):
            _tmp1 = None
        if ((_tmp1 is not None) and (_tmp1 is not False)):
            if (_tmp1.__class__ not in (str, unicode, int, float, )):
                _tmp1 = unicode(_translate(_tmp1, domain=_domain, mapping=None, target_language=target_language, default=None))
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if ('&' in _tmp1):
                if (';' in _tmp1):
                    _tmp1 = _re_amp.sub('&amp;', _tmp1)
                else:
                    _tmp1 = _tmp1.replace('&', '&amp;')
            if ('<' in _tmp1):
                _tmp1 = _tmp1.replace('<', '&lt;')
            if ('>' in _tmp1):
                _tmp1 = _tmp1.replace('>', '&gt;')
            if ('"' in _tmp1):
                _tmp1 = _tmp1.replace('"', '&quot;')
            _write(((' src="' + _tmp1) + '"'))
        _write(u'></script>\n      ')
        attrs = _attrs_4356773840
        _write(u'<style type="text/css">\n        label {font-weight:bold;}\n        h1, h3 {padding:0.1 0.3em;}\n        h1 a, h3 a {text-decoration:none;}\n        a.ui-state-default {padding:0.1em 0.3em;}\n        a.fm-button {padding:0.4em 0.5em;}\n        a.fm-button-icon-left {padding-left:1.9em;}\n        div.breadcrumb {float:right; font-size:0.7em;}\n        div.breadcrumb a {text-decoration:underline}\n        #header { height: 2em; font-size:1.5em; }\n        #header div { font-size:1.5em; }\n      </style>\n    </head>\n    ')
        attrs = _attrs_4356772944
        _write(u'<body>\n      ')
        attrs = _attrs_4356773968
        _write(u'<div id="content" class="ui-admin ui-widget">\n        ')
        attrs = _attrs_4356773584
        _write(u'<h1 id="header" class="ui-widget-header ui-corner-all">\n          ')
        attrs = _attrs_4356773712
        u'breadcrumb'
        _write(u'<div class="breadcrumb">\n            ')
        _tmp1 = econtext['breadcrumb']
        item = None
        (_tmp1, _tmp2, ) = repeat.insert('item', _tmp1)
        for item in _tmp1:
            _tmp2 = (_tmp2 - 1)
            u"''"
            _write(u'')
            _default.value = default = ''
            u'item[1]'
            _content = item[1]
            attrs = _attrs_4356774096
            u'item[0]'
            _write(u'<a')
            _tmp3 = item[0]
            if (_tmp3 is _default):
                _tmp3 = None
            if ((_tmp3 is not None) and (_tmp3 is not False)):
                if (_tmp3.__class__ not in (str, unicode, int, float, )):
                    _tmp3 = unicode(_translate(_tmp3, domain=_domain, mapping=None, target_language=target_language, default=None))
                else:
                    if not isinstance(_tmp3, unicode):
                        _tmp3 = str(_tmp3)
                if ('&' in _tmp3):
                    if (';' in _tmp3):
                        _tmp3 = _re_amp.sub('&amp;', _tmp3)
                    else:
                        _tmp3 = _tmp3.replace('&', '&amp;')
                if ('<' in _tmp3):
                    _tmp3 = _tmp3.replace('<', '&lt;')
                if ('>' in _tmp3):
                    _tmp3 = _tmp3.replace('>', '&gt;')
                if ('"' in _tmp3):
                    _tmp3 = _tmp3.replace('"', '&quot;')
                _write(((' href="' + _tmp3) + '"'))
            u'_content'
            _write('>')
            _tmp3 = _content
            _tmp = _tmp3
            if (_tmp.__class__ not in (str, unicode, int, float, )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                if ('&' in _tmp):
                    if (';' in _tmp):
                        _tmp = _re_amp.sub('&amp;', _tmp)
                    else:
                        _tmp = _tmp.replace('&', '&amp;')
                if ('<' in _tmp):
                    _tmp = _tmp.replace('<', '&lt;')
                if ('>' in _tmp):
                    _tmp = _tmp.replace('>', '&gt;')
                _write(_tmp)
            u'not repeat.item.end'
            _write(u'</a>\n                ')
            _tmp3 = not _lookup_attr(repeat.item, 'end')
            if _tmp3:
                pass
                attrs = _attrs_4356774544
                _write(u'<span>/</span>')
            _write(u'\n            ')
            if (_tmp2 == 0):
                break
            _write(' ')
        u"''"
        _write(u'\n          </div>\n          ')
        _default.value = default = ''
        u"request.model_name or 'root'"
        _content = (_lookup_attr(econtext['request'], 'model_name') or 'root')
        attrs = _attrs_4356773776
        u'_content'
        _write(u'<div>')
        _tmp1 = _content
        _tmp = _tmp1
        if (_tmp.__class__ not in (str, unicode, int, float, )):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if (_tmp is not None):
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            if ('&' in _tmp):
                if (';' in _tmp):
                    _tmp = _re_amp.sub('&amp;', _tmp)
                else:
                    _tmp = _tmp.replace('&', '&amp;')
            if ('<' in _tmp):
                _tmp = _tmp.replace('<', '&lt;')
            if ('>' in _tmp):
                _tmp = _tmp.replace('>', '&gt;')
            _write(_tmp)
        u"%(slots)s.get(u'main')"
        _write(u'</div>\n        </h1>\n        ')
        _tmp = _slots.get(u'main')
        u'%(tmp)s is not None'
        _tmp1 = (_tmp is not None)
        if _tmp1:
            pass
            u'isinstance(%(tmp)s, basestring)'
            _tmp2 = isinstance(_tmp, basestring)
            if not _tmp2:
                pass
                econtext.update(dict(rcontext=rcontext, _domain=_domain))
                _tmp(econtext, repeat)
            else:
                pass
                u'%(tmp)s'
                _tmp2 = _tmp
                _tmp = _tmp2
                if (_tmp.__class__ not in (str, unicode, int, float, )):
                    try:
                        _tmp = _tmp.__html__
                    except:
                        _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                    else:
                        _tmp = _tmp()
                        _write(_tmp)
                        _tmp = None
                if (_tmp is not None):
                    if not isinstance(_tmp, unicode):
                        _tmp = str(_tmp)
                    _write(_tmp)
        else:
            pass
            attrs = _attrs_4356773648
            _write(u'<div>\n        </div>')
        _write(u'\n      </div>\n    </body>\n</html>')
        return
    return render
コード例 #21
0
ファイル: front_page.pt.py プロジェクト: cswank/brewserver
def bind():
    from cPickle import loads as _loads
    _attrs_4366375696 = _loads('(dp1\nVid\np2\nVlineage\np3\ns.')
    _lookup_attr = _loads('cchameleon.core.codegen\nlookup_attr\np1\n.')
    _re_amp = _loads("cre\n_compile\np1\n(S'&(?!([A-Za-z]+|#[0-9]+);)'\np2\nI0\ntRp3\n.")
    _attrs_4366394832 = _loads('(dp1\n.')
    _attrs_4366396368 = _loads('(dp1\n.')
    _attrs_4366395280 = _loads('(dp1\n.')
    _attrs_4366374992 = _loads('(dp1\nVsrc\np2\nV${request.application_url}/static/js/frontpage.js\np3\nsVtype\np4\nVtext/javascript\np5\ns.')
    _attrs_4366395408 = _loads('(dp1\nVid\np2\nVtun-volume\np3\ns.')
    _attrs_4366397328 = _loads('(dp1\nVid\np2\nVfermenter-temperature\np3\ns.')
    _attrs_4366396432 = _loads('(dp1\n.')
    _init_stream = _loads('cchameleon.core.generation\ninitialize_stream\np1\n.')
    _attrs_4366393872 = _loads('(dp1\nVid\np2\nVhlt-temperature\np3\ns.')
    _attrs_4366396304 = _loads('(dp1\n.')
    _attrs_4366395024 = _loads('(dp1\nVid\np2\nVtun-temperature\np3\ns.')
    _attrs_4366376208 = _loads('(dp1\nVstyle\np2\nVwidth:400px;height:200px\np3\nsVclass\np4\nVanalog-history\np5\nsVid\np6\nVtemperature-table\np7\ns.')
    _attrs_4366395152 = _loads('(dp1\n.')
    _attrs_4366376464 = _loads('(dp1\n.')
    _attrs_4366374416 = _loads('(dp1\n.')
    _attrs_4366374800 = _loads('(dp1\nVhref\np2\nV${request.application_url}/static/css/custom-theme/jquery-ui.css\np3\nsVrel\np4\nVstylesheet\np5\nsVtype\np6\nVtext/css\np7\ns.')
    _attrs_4366374736 = _loads('(dp1\nVhref\np2\nV${request.application_url}/static/css/default.css\np3\nsVrel\np4\nVstylesheet\np5\nsVtype\np6\nVtext/css\np7\ns.')
    _attrs_4366394256 = _loads('(dp1\nVid\np2\nVhlt-volume\np3\ns.')
    _init_default = _loads('cchameleon.core.generation\ninitialize_default\np1\n.')
    _attrs_4366397072 = _loads('(dp1\nVhref\np2\nVfermenter\np3\ns.')
    _attrs_4366375248 = _loads('(dp1\nVtype\np2\nVtext/javascript\np3\ns.')
    _init_tal = _loads('cchameleon.core.generation\ninitialize_tal\np1\n.')
    _attrs_4366396880 = _loads('(dp1\n.')
    _attrs_4366375504 = _loads('(dp1\n.')
    _attrs_4366395536 = _loads('(dp1\n.')
    _attrs_4366393424 = _loads('(dp1\n.')
    _attrs_4366396688 = _loads('(dp1\n.')
    _attrs_4366396560 = _loads('(dp1\nVid\np2\nVboiler-volume\np3\ns.')
    _attrs_4366394064 = _loads('(dp1\n.')
    _attrs_4366395920 = _loads('(dp1\nVhref\np2\nVboiler\np3\ns.')
    _attrs_4366395728 = _loads('(dp1\n.')
    _attrs_4366374352 = _loads('(dp1\n.')
    _attrs_4366397392 = _loads('(dp1\n.')
    _attrs_4366393616 = _loads('(dp1\nVhref\np2\nVhlt\np3\ns.')
    _attrs_4366396176 = _loads('(dp1\nVid\np2\nVboiler-temperature\np3\ns.')
    _attrs_4366376016 = _loads('(dp1\nVid\np2\nVmain\np3\ns.')
    _attrs_4366376784 = _loads('(dp1\n.')
    _attrs_4366374864 = _loads('(dp1\nVsrc\np2\nV${request.application_url}/static/js/jquery-1.4.2.min.js\np3\nsVtype\np4\nVtext/javascript\np5\ns.')
    _attrs_4366405840 = _loads('(dp1\nVid\np2\nVfermenter-volume\np3\ns.')
    _attrs_4366375760 = _loads('(dp1\nVid\np2\nVside-bar\np3\ns.')
    _init_scope = _loads('cchameleon.core.utils\necontext\np1\n.')
    _attrs_4366394128 = _loads('(dp1\n.')
    _attrs_4366375120 = _loads('(dp1\nVsrc\np2\nV${request.application_url}/static/js/flot/jquery.flot.js\np3\nsVlanguage\np4\nVjavascript\np5\nsVtype\np6\nVtext/javascript\np7\ns.')
    _attrs_4366376336 = _loads('(dp1\nVstyle\np2\nVwidth:400px;height:200px\np3\nsVclass\np4\nVanalog-history\np5\nsVid\np6\nVvolume-table\np7\ns.')
    _attrs_4366375312 = _loads('(dp1\n.')
    _attrs_4366376592 = _loads('(dp1\n.')
    _attrs_4366393680 = _loads('(dp1\n.')
    _attrs_4366397136 = _loads('(dp1\n.')
    _attrs_4366374672 = _loads('(dp1\nVhref\np2\nV${request.application_url}/static/css/ui-lightness/jquery-ui-1.8.6.custom.css\np3\nsVrel\np4\nVstylesheet\np5\nsVtype\np6\nVtext/css\np7\ns.')
    _attrs_4366395216 = _loads('(dp1\n.')
    _attrs_4366394768 = _loads('(dp1\nVhref\np2\nVtun\np3\ns.')
    _attrs_4366394576 = _loads('(dp1\n.')
    _attrs_4366394000 = _loads('(dp1\n.')
    _attrs_4366395984 = _loads('(dp1\n.')
    _attrs_4366394384 = _loads('(dp1\n.')
    def render(econtext, rcontext=None):
        macros = econtext.get('macros')
        _translate = econtext.get('_translate')
        _slots = econtext.get('_slots')
        target_language = econtext.get('target_language')
        u'_init_stream()'
        (_out, _write, ) = _init_stream()
        u'_init_tal()'
        (_attributes, repeat, ) = _init_tal()
        u'_init_default()'
        _default = _init_default()
        u'None'
        default = None
        u'None'
        _domain = None
        attrs = _attrs_4366374352
        _write(u'<html>\n  ')
        attrs = _attrs_4366374416
        _write(u'<head>\n    ')
        attrs = _attrs_4366374672
        "join(value('request.application_url'), u'/static/css/ui-lightness/jquery-ui-1.8.6.custom.css')"
        _write(u'<link')
        _tmp1 = ('%s%s' % (_lookup_attr(econtext['request'], 'application_url'), u'/static/css/ui-lightness/jquery-ui-1.8.6.custom.css', ))
        if (_tmp1 is _default):
            _tmp1 = u'${request.application_url}/static/css/ui-lightness/jquery-ui-1.8.6.custom.css'
        if ((_tmp1 is not None) and (_tmp1 is not False)):
            if (_tmp1.__class__ not in (str, unicode, int, float, )):
                _tmp1 = unicode(_translate(_tmp1, domain=_domain, mapping=None, target_language=target_language, default=None))
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if ('&' in _tmp1):
                if (';' in _tmp1):
                    _tmp1 = _re_amp.sub('&amp;', _tmp1)
                else:
                    _tmp1 = _tmp1.replace('&', '&amp;')
            if ('<' in _tmp1):
                _tmp1 = _tmp1.replace('<', '&lt;')
            if ('>' in _tmp1):
                _tmp1 = _tmp1.replace('>', '&gt;')
            if ('"' in _tmp1):
                _tmp1 = _tmp1.replace('"', '&quot;')
            _write(((' href="' + _tmp1) + '"'))
        _write(u' rel="stylesheet" type="text/css" />\n    ')
        attrs = _attrs_4366374736
        _write(u'<link')
        default = u'${request.application_url}/static/css/default.css'
        "join(value('request.application_url'), u'/static/css/default.css')"
        _tmp1 = ('%s%s' % (_lookup_attr(econtext['request'], 'application_url'), u'/static/css/default.css', ))
        default = None
        if (_tmp1 is _default):
            _tmp1 = u'${request.application_url}/static/css/default.css'
        if ((_tmp1 is not None) and (_tmp1 is not False)):
            if (_tmp1.__class__ not in (str, unicode, int, float, )):
                _tmp1 = unicode(_translate(_tmp1, domain=_domain, mapping=None, target_language=target_language, default=None))
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if ('&' in _tmp1):
                if (';' in _tmp1):
                    _tmp1 = _re_amp.sub('&amp;', _tmp1)
                else:
                    _tmp1 = _tmp1.replace('&', '&amp;')
            if ('<' in _tmp1):
                _tmp1 = _tmp1.replace('<', '&lt;')
            if ('>' in _tmp1):
                _tmp1 = _tmp1.replace('>', '&gt;')
            if ('"' in _tmp1):
                _tmp1 = _tmp1.replace('"', '&quot;')
            _write(((' href="' + _tmp1) + '"'))
        _write(u' rel="stylesheet" type="text/css" />\n    ')
        attrs = _attrs_4366374800
        "join(value('request.application_url'), u'/static/css/custom-theme/jquery-ui.css')"
        _write(u'<link')
        _tmp1 = ('%s%s' % (_lookup_attr(econtext['request'], 'application_url'), u'/static/css/custom-theme/jquery-ui.css', ))
        if (_tmp1 is _default):
            _tmp1 = u'${request.application_url}/static/css/custom-theme/jquery-ui.css'
        if ((_tmp1 is not None) and (_tmp1 is not False)):
            if (_tmp1.__class__ not in (str, unicode, int, float, )):
                _tmp1 = unicode(_translate(_tmp1, domain=_domain, mapping=None, target_language=target_language, default=None))
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if ('&' in _tmp1):
                if (';' in _tmp1):
                    _tmp1 = _re_amp.sub('&amp;', _tmp1)
                else:
                    _tmp1 = _tmp1.replace('&', '&amp;')
            if ('<' in _tmp1):
                _tmp1 = _tmp1.replace('<', '&lt;')
            if ('>' in _tmp1):
                _tmp1 = _tmp1.replace('>', '&gt;')
            if ('"' in _tmp1):
                _tmp1 = _tmp1.replace('"', '&quot;')
            _write(((' href="' + _tmp1) + '"'))
        _write(u' rel="stylesheet" type="text/css" />\n    ')
        attrs = _attrs_4366374864
        "join(value('request.application_url'), u'/static/js/jquery-1.4.2.min.js')"
        _write(u'<script type="text/javascript"')
        _tmp1 = ('%s%s' % (_lookup_attr(econtext['request'], 'application_url'), u'/static/js/jquery-1.4.2.min.js', ))
        if (_tmp1 is _default):
            _tmp1 = u'${request.application_url}/static/js/jquery-1.4.2.min.js'
        if ((_tmp1 is not None) and (_tmp1 is not False)):
            if (_tmp1.__class__ not in (str, unicode, int, float, )):
                _tmp1 = unicode(_translate(_tmp1, domain=_domain, mapping=None, target_language=target_language, default=None))
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if ('&' in _tmp1):
                if (';' in _tmp1):
                    _tmp1 = _re_amp.sub('&amp;', _tmp1)
                else:
                    _tmp1 = _tmp1.replace('&', '&amp;')
            if ('<' in _tmp1):
                _tmp1 = _tmp1.replace('<', '&lt;')
            if ('>' in _tmp1):
                _tmp1 = _tmp1.replace('>', '&gt;')
            if ('"' in _tmp1):
                _tmp1 = _tmp1.replace('"', '&quot;')
            _write(((' src="' + _tmp1) + '"'))
        _write(u'></script>\n    ')
        attrs = _attrs_4366374992
        "join(value('request.application_url'), u'/static/js/frontpage.js')"
        _write(u'<script type="text/javascript"')
        _tmp1 = ('%s%s' % (_lookup_attr(econtext['request'], 'application_url'), u'/static/js/frontpage.js', ))
        if (_tmp1 is _default):
            _tmp1 = u'${request.application_url}/static/js/frontpage.js'
        if ((_tmp1 is not None) and (_tmp1 is not False)):
            if (_tmp1.__class__ not in (str, unicode, int, float, )):
                _tmp1 = unicode(_translate(_tmp1, domain=_domain, mapping=None, target_language=target_language, default=None))
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if ('&' in _tmp1):
                if (';' in _tmp1):
                    _tmp1 = _re_amp.sub('&amp;', _tmp1)
                else:
                    _tmp1 = _tmp1.replace('&', '&amp;')
            if ('<' in _tmp1):
                _tmp1 = _tmp1.replace('<', '&lt;')
            if ('>' in _tmp1):
                _tmp1 = _tmp1.replace('>', '&gt;')
            if ('"' in _tmp1):
                _tmp1 = _tmp1.replace('"', '&quot;')
            _write(((' src="' + _tmp1) + '"'))
        _write(u'></script>\n    ')
        attrs = _attrs_4366375120
        "join(value('request.application_url'), u'/static/js/flot/jquery.flot.js')"
        _write(u'<script language="javascript" type="text/javascript"')
        _tmp1 = ('%s%s' % (_lookup_attr(econtext['request'], 'application_url'), u'/static/js/flot/jquery.flot.js', ))
        if (_tmp1 is _default):
            _tmp1 = u'${request.application_url}/static/js/flot/jquery.flot.js'
        if ((_tmp1 is not None) and (_tmp1 is not False)):
            if (_tmp1.__class__ not in (str, unicode, int, float, )):
                _tmp1 = unicode(_translate(_tmp1, domain=_domain, mapping=None, target_language=target_language, default=None))
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if ('&' in _tmp1):
                if (';' in _tmp1):
                    _tmp1 = _re_amp.sub('&amp;', _tmp1)
                else:
                    _tmp1 = _tmp1.replace('&', '&amp;')
            if ('<' in _tmp1):
                _tmp1 = _tmp1.replace('<', '&lt;')
            if ('>' in _tmp1):
                _tmp1 = _tmp1.replace('>', '&gt;')
            if ('"' in _tmp1):
                _tmp1 = _tmp1.replace('"', '&quot;')
            _write(((' src="' + _tmp1) + '"'))
        _write(u'></script>\n    ')
        attrs = _attrs_4366375248
        u'state_url'
        _write(u'<script type="text/javascript">\n      var stateUrl = "')
        _tmp1 = econtext['state_url']
        _tmp = _tmp1
        if (_tmp.__class__ not in (str, unicode, int, float, )):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if (_tmp is not None):
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            if ('&' in _tmp):
                if (';' in _tmp):
                    _tmp = _re_amp.sub('&amp;', _tmp)
                else:
                    _tmp = _tmp.replace('&', '&amp;')
            if ('<' in _tmp):
                _tmp = _tmp.replace('<', '&lt;')
            if ('>' in _tmp):
                _tmp = _tmp.replace('>', '&gt;')
            _write(_tmp)
        u'notification_url'
        _write(u'";\n      var notificationUrl = "')
        _tmp1 = econtext['notification_url']
        _tmp = _tmp1
        if (_tmp.__class__ not in (str, unicode, int, float, )):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if (_tmp is not None):
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            if ('&' in _tmp):
                if (';' in _tmp):
                    _tmp = _re_amp.sub('&amp;', _tmp)
                else:
                    _tmp = _tmp.replace('&', '&amp;')
            if ('<' in _tmp):
                _tmp = _tmp.replace('<', '&lt;')
            if ('>' in _tmp):
                _tmp = _tmp.replace('>', '&gt;')
            _write(_tmp)
        _write(u'";\n    </script>\n  </head>\n  ')
        attrs = _attrs_4366375312
        _write(u'<body>\n    ')
        attrs = _attrs_4366375504
        _write(u'<header>\n      ')
        attrs = _attrs_4366375696
        u"''"
        _write(u'<div id="lineage">')
        _default.value = default = ''
        u'lineage'
        _content = econtext['lineage']
        u'_content'
        _tmp1 = _content
        _tmp = _tmp1
        if (_tmp.__class__ not in (str, unicode, int, float, )):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if (_tmp is not None):
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            _write(_tmp)
        _write(u'</div>\n    </header>\n    ')
        attrs = _attrs_4366375760
        _write(u'<div id="side-bar">\n    </div>\n    ')
        attrs = _attrs_4366376016
        _write(u'<section id="main">\n      ')
        attrs = _attrs_4366376208
        _write(u'<div style="width:400px;height:200px" class="analog-history" id="temperature-table"></div>\n      ')
        attrs = _attrs_4366376336
        _write(u'<div style="width:400px;height:200px" class="analog-history" id="volume-table"></div>\n      ')
        attrs = _attrs_4366376464
        _write(u'<h1>Tanks</h1>\n      ')
        attrs = _attrs_4366376592
        _write(u'<table>\n        ')
        attrs = _attrs_4366376784
        _write(u'<tr>\n          ')
        attrs = _attrs_4366393424
        _write(u'<td>')
        attrs = _attrs_4366393616
        _write(u'<a href="hlt">Hot Liquor Tank</a></td>\n          ')
        attrs = _attrs_4366393680
        _write(u'<td>')
        attrs = _attrs_4366393872
        _write(u'<a id="hlt-temperature"></a>')
        attrs = _attrs_4366394000
        _write(u'<a> &deg;C</a></td>\n          ')
        attrs = _attrs_4366394064
        _write(u'<td>')
        attrs = _attrs_4366394256
        _write(u'<a id="hlt-volume"></a>')
        attrs = _attrs_4366394384
        _write(u'<a> L</a></td>\n        </tr>\n        ')
        attrs = _attrs_4366394128
        _write(u'<tr>\n          ')
        attrs = _attrs_4366394576
        _write(u'<td>')
        attrs = _attrs_4366394768
        _write(u'<a href="tun">Mash/Lauder Tun</a></td>\n          ')
        attrs = _attrs_4366394832
        _write(u'<td>')
        attrs = _attrs_4366395024
        _write(u'<a id="tun-temperature"></a>')
        attrs = _attrs_4366395152
        _write(u'<a> &deg;C</a></td>\n          ')
        attrs = _attrs_4366395216
        _write(u'<td>')
        attrs = _attrs_4366395408
        _write(u'<a id="tun-volume"></a>')
        attrs = _attrs_4366395536
        _write(u'<a> L</a></td>\n        </tr>\n        ')
        attrs = _attrs_4366395280
        _write(u'<tr>\n          ')
        attrs = _attrs_4366395728
        _write(u'<td>')
        attrs = _attrs_4366395920
        _write(u'<a href="boiler">Boiler</a></td>\n          ')
        attrs = _attrs_4366395984
        _write(u'<td>')
        attrs = _attrs_4366396176
        _write(u'<a id="boiler-temperature"></a>')
        attrs = _attrs_4366396304
        _write(u'<a> &deg;C</a></td>\n          ')
        attrs = _attrs_4366396368
        _write(u'<td>')
        attrs = _attrs_4366396560
        _write(u'<a id="boiler-volume"></a>')
        attrs = _attrs_4366396688
        _write(u'<a> L</a></td>\n        </tr>\n        ')
        attrs = _attrs_4366396432
        _write(u'<tr>\n          ')
        attrs = _attrs_4366396880
        _write(u'<td>')
        attrs = _attrs_4366397072
        _write(u'<a href="fermenter">Fermenter</a></td>\n          ')
        attrs = _attrs_4366397136
        _write(u'<td>')
        attrs = _attrs_4366397328
        _write(u'<a id="fermenter-temperature"></a></td>\n          ')
        attrs = _attrs_4366397392
        _write(u'<td>')
        attrs = _attrs_4366405840
        _write(u'<a id="fermenter-volume"></a></td>\n        </tr>\n      </table>\n    </section>\n  </body>\n</html>')
        return _out.getvalue()
    return render
コード例 #22
0
def bind():
    from cPickle import loads as _loads
    _lookup_attr = _loads('cchameleon.core.codegen\nlookup_attr\np1\n.')
    _init_scope = _loads('cchameleon.core.utils\necontext\np1\n.')
    _init_default = _loads('cchameleon.core.generation\ninitialize_default\np1\n.')
    _attrs_4355418576 = _loads('(dp1\nVstyle\np2\nVdisplay:none\np3\ns.')
    _attrs_4355401296 = _loads('(dp1\n.')
    _init_stream = _loads('cchameleon.core.generation\ninitialize_stream\np1\n.')
    _attrs_4355399952 = _loads('(dp1\n.')
    _attrs_4355441232 = _loads('(dp1\n.')
    _attrs_4355400784 = _loads('(dp1\n.')
    _attrs_4355400912 = _loads('(dp1\nVclass\np2\nVfield_readonly\np3\ns.')
    _init_tal = _loads('cchameleon.core.generation\ninitialize_tal\np1\n.')
    _attrs_4355400848 = _loads('(dp1\n.')
    def render(econtext, rcontext=None):
        macros = econtext.get('macros')
        _translate = econtext.get('_translate')
        _slots = econtext.get('_slots')
        target_language = econtext.get('target_language')
        u'_init_stream()'
        (_out, _write, ) = _init_stream()
        u'_init_tal()'
        (_attributes, repeat, ) = _init_tal()
        u'_init_default()'
        _default = _init_default()
        u'None'
        default = None
        u'None'
        _domain = None
        attrs = _attrs_4355441232
        u'fieldset.render_fields.itervalues()'
        _write(u'<tbody>\n  ')
        _tmp1 = _lookup_attr(_lookup_attr(econtext['fieldset'], 'render_fields'), 'itervalues')()
        field = None
        (_tmp1, _tmp2, ) = repeat.insert('field', _tmp1)
        for field in _tmp1:
            _tmp2 = (_tmp2 - 1)
            u'field.requires_label'
            _write(u'')
            _tmp3 = _lookup_attr(field, 'requires_label')
            if _tmp3:
                pass
                attrs = _attrs_4355401296
                _write(u'<tr>\n      ')
                attrs = _attrs_4355400912
                u"''"
                _write(u'<td class="field_readonly">\n        ')
                _default.value = default = ''
                u'field.label_tag()'
                _content = _lookup_attr(field, 'label_tag')()
                u'_content'
                _tmp3 = _content
                _tmp = _tmp3
                if (_tmp.__class__ not in (str, unicode, int, float, )):
                    try:
                        _tmp = _tmp.__html__
                    except:
                        _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                    else:
                        _tmp = _tmp()
                        _write(_tmp)
                        _tmp = None
                if (_tmp is not None):
                    if not isinstance(_tmp, unicode):
                        _tmp = str(_tmp)
                    _write(_tmp)
                u"''"
                _write(u'\n      </td>\n      ')
                _default.value = default = ''
                u'field.render_readonly()'
                _content = _lookup_attr(field, 'render_readonly')()
                attrs = _attrs_4355400848
                u'_content'
                _write(u'<td>')
                _tmp3 = _content
                _tmp = _tmp3
                if (_tmp.__class__ not in (str, unicode, int, float, )):
                    try:
                        _tmp = _tmp.__html__
                    except:
                        _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                    else:
                        _tmp = _tmp()
                        _write(_tmp)
                        _tmp = None
                if (_tmp is not None):
                    if not isinstance(_tmp, unicode):
                        _tmp = str(_tmp)
                    _write(_tmp)
                _write(u'</td>\n    </tr>')
            _write(u'\n  ')
            if (_tmp2 == 0):
                break
            _write(' ')
        _write(u'\n  ')
        attrs = _attrs_4355418576
        _write(u'<tr style="display:none">')
        attrs = _attrs_4355400784
        _write(u'<td>&nbsp;</td>')
        attrs = _attrs_4355399952
        u'fieldset.render_fields.itervalues()'
        _write(u'<td>\n    ')
        _tmp1 = _lookup_attr(_lookup_attr(econtext['fieldset'], 'render_fields'), 'itervalues')()
        field = None
        (_tmp1, _tmp2, ) = repeat.insert('field', _tmp1)
        for field in _tmp1:
            _tmp2 = (_tmp2 - 1)
            u"''"
            _write(u'')
            _default.value = default = ''
            u'not field.requires_label'
            _tmp3 = not _lookup_attr(field, 'requires_label')
            if _tmp3:
                pass
                u'field.render_readonly()'
                _content = _lookup_attr(field, 'render_readonly')()
                u'_content'
                _tmp3 = _content
                _tmp = _tmp3
                if (_tmp.__class__ not in (str, unicode, int, float, )):
                    try:
                        _tmp = _tmp.__html__
                    except:
                        _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                    else:
                        _tmp = _tmp()
                        _write(_tmp)
                        _tmp = None
                if (_tmp is not None):
                    if not isinstance(_tmp, unicode):
                        _tmp = str(_tmp)
                    _write(_tmp)
            _write(u'\n    ')
            if (_tmp2 == 0):
                break
            _write(' ')
        _write(u'\n  </td>\n  </tr>\n</tbody>')
        return _out.getvalue()
    return render
コード例 #23
0
def bind():
    from cPickle import loads as _loads

    _attrs_4353373456 = _loads("(dp1\nVrel\np2\nVstylesheet\np3\ns.")
    _lookup_attr = _loads("cchameleon.core.codegen\nlookup_attr\np1\n.")
    _init_scope = _loads("cchameleon.core.utils\necontext\np1\n.")
    _re_amp = _loads("cre\n_compile\np1\n(S'&(?!([A-Za-z]+|#[0-9]+);)'\np2\nI0\ntRp3\n.")
    _attrs_4353342480 = _loads("(dp1\n.")
    _attrs_4345507344 = _loads("(dp1\nVid\np2\nVheader\np3\nsVclass\np4\nVui-widget-header ui-corner-all\np5\ns.")
    _attrs_4353343184 = _loads("(dp1\nVclass\np2\nVbreadcrumb\np3\ns.")
    _attrs_4353342544 = _loads("(dp1\n.")
    _attrs_4353376016 = _loads("(dp1\n.")
    _init_stream = _loads("cchameleon.core.generation\ninitialize_stream\np1\n.")
    _attrs_4353376144 = _loads("(dp1\n.")
    _attrs_4353376208 = _loads("(dp1\n.")
    _attrs_4353372432 = _loads(
        "(dp1\nVsrc\np2\nVhttps://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js\np3\ns."
    )
    _init_default = _loads("cchameleon.core.generation\ninitialize_default\np1\n.")
    _attrs_4353372560 = _loads("(dp1\nVid\np2\nVcontent\np3\nsVclass\np4\nVui-admin ui-widget\np5\ns.")
    _attrs_4345507600 = _loads("(dp1\n.")
    _attrs_4353342352 = _loads("(dp1\n.")
    _attrs_4353413200 = _loads("(dp1\n.")
    _init_tal = _loads("cchameleon.core.generation\ninitialize_tal\np1\n.")

    def render(econtext, rcontext=None):
        macros = econtext.get("macros")
        _translate = econtext.get("_translate")
        _slots = econtext.get("_slots")
        target_language = econtext.get("target_language")
        u"%(scope)s['%(out)s'], %(scope)s['%(write)s']"
        (_out, _write) = (econtext["_out"], econtext["_write"])
        u"_init_tal()"
        (_attributes, repeat) = _init_tal()
        u"_init_default()"
        _default = _init_default()
        u"None"
        default = None
        u"None"
        _domain = None
        attrs = _attrs_4353376016
        _write(u"<html>\n    ")
        attrs = _attrs_4353376144
        u"''"
        _write(u"<head>\n      ")
        _default.value = default = ""
        u"request.model_name or 'root'"
        _content = _lookup_attr(econtext["request"], "model_name") or "root"
        attrs = _attrs_4353413200
        u"_content"
        _write(u"<title>")
        _tmp1 = _content
        _tmp = _tmp1
        if _tmp.__class__ not in (str, unicode, int, float):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if _tmp is not None:
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            if "&" in _tmp:
                if ";" in _tmp:
                    _tmp = _re_amp.sub("&amp;", _tmp)
                else:
                    _tmp = _tmp.replace("&", "&amp;")
            if "<" in _tmp:
                _tmp = _tmp.replace("<", "&lt;")
            if ">" in _tmp:
                _tmp = _tmp.replace(">", "&gt;")
            _write(_tmp)
        _write(u"</title>\n      ")
        attrs = _attrs_4353373456
        u"request.static_url('pyramid_formalchemy:static/admin.css')"
        _write(u'<link rel="stylesheet"')
        _tmp1 = _lookup_attr(econtext["request"], "static_url")("pyramid_formalchemy:static/admin.css")
        if _tmp1 is _default:
            _tmp1 = None
        if (_tmp1 is not None) and (_tmp1 is not False):
            if _tmp1.__class__ not in (str, unicode, int, float):
                _tmp1 = unicode(
                    _translate(_tmp1, domain=_domain, mapping=None, target_language=target_language, default=None)
                )
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if "&" in _tmp1:
                if ";" in _tmp1:
                    _tmp1 = _re_amp.sub("&amp;", _tmp1)
                else:
                    _tmp1 = _tmp1.replace("&", "&amp;")
            if "<" in _tmp1:
                _tmp1 = _tmp1.replace("<", "&lt;")
            if ">" in _tmp1:
                _tmp1 = _tmp1.replace(">", "&gt;")
            if '"' in _tmp1:
                _tmp1 = _tmp1.replace('"', "&quot;")
            _write(((' href="' + _tmp1) + '"'))
        _write(u"></link>\n      ")
        attrs = _attrs_4353372432
        _write(
            u'<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>\n    </head>\n    '
        )
        attrs = _attrs_4353376208
        _write(u"<body>\n      ")
        attrs = _attrs_4353372560
        _write(u'<div id="content" class="ui-admin ui-widget">\n        ')
        attrs = _attrs_4345507344
        _write(u'<h1 id="header" class="ui-widget-header ui-corner-all">\n          ')
        attrs = _attrs_4353343184
        u"breadcrumb"
        _write(u'<div class="breadcrumb">\n            ')
        _tmp1 = econtext["breadcrumb"]
        item = None
        (_tmp1, _tmp2) = repeat.insert("item", _tmp1)
        for item in _tmp1:
            _tmp2 = _tmp2 - 1
            u"''"
            _write(u"")
            _default.value = default = ""
            u"item[1]"
            _content = item[1]
            attrs = _attrs_4353342480
            u"item[0]"
            _write(u"<a")
            _tmp3 = item[0]
            if _tmp3 is _default:
                _tmp3 = None
            if (_tmp3 is not None) and (_tmp3 is not False):
                if _tmp3.__class__ not in (str, unicode, int, float):
                    _tmp3 = unicode(
                        _translate(_tmp3, domain=_domain, mapping=None, target_language=target_language, default=None)
                    )
                else:
                    if not isinstance(_tmp3, unicode):
                        _tmp3 = str(_tmp3)
                if "&" in _tmp3:
                    if ";" in _tmp3:
                        _tmp3 = _re_amp.sub("&amp;", _tmp3)
                    else:
                        _tmp3 = _tmp3.replace("&", "&amp;")
                if "<" in _tmp3:
                    _tmp3 = _tmp3.replace("<", "&lt;")
                if ">" in _tmp3:
                    _tmp3 = _tmp3.replace(">", "&gt;")
                if '"' in _tmp3:
                    _tmp3 = _tmp3.replace('"', "&quot;")
                _write(((' href="' + _tmp3) + '"'))
            u"_content"
            _write(">")
            _tmp3 = _content
            _tmp = _tmp3
            if _tmp.__class__ not in (str, unicode, int, float):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if _tmp is not None:
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                if "&" in _tmp:
                    if ";" in _tmp:
                        _tmp = _re_amp.sub("&amp;", _tmp)
                    else:
                        _tmp = _tmp.replace("&", "&amp;")
                if "<" in _tmp:
                    _tmp = _tmp.replace("<", "&lt;")
                if ">" in _tmp:
                    _tmp = _tmp.replace(">", "&gt;")
                _write(_tmp)
            u"not repeat.item.end"
            _write(u"</a>\n                ")
            _tmp3 = not _lookup_attr(repeat.item, "end")
            if _tmp3:
                pass
                attrs = _attrs_4353342544
                _write(u"<span>/</span>")
            _write(u"\n            ")
            if _tmp2 == 0:
                break
            _write(" ")
        u"''"
        _write(u"\n          </div>\n          ")
        _default.value = default = ""
        u"request.model_name or 'root'"
        _content = _lookup_attr(econtext["request"], "model_name") or "root"
        attrs = _attrs_4353342352
        u"_content"
        _write(u"<div>")
        _tmp1 = _content
        _tmp = _tmp1
        if _tmp.__class__ not in (str, unicode, int, float):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if _tmp is not None:
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            if "&" in _tmp:
                if ";" in _tmp:
                    _tmp = _re_amp.sub("&amp;", _tmp)
                else:
                    _tmp = _tmp.replace("&", "&amp;")
            if "<" in _tmp:
                _tmp = _tmp.replace("<", "&lt;")
            if ">" in _tmp:
                _tmp = _tmp.replace(">", "&gt;")
            _write(_tmp)
        u"%(slots)s.get(u'main')"
        _write(u"</div>\n        </h1>\n        ")
        _tmp = _slots.get(u"main")
        u"%(tmp)s is not None"
        _tmp1 = _tmp is not None
        if _tmp1:
            pass
            u"isinstance(%(tmp)s, basestring)"
            _tmp2 = isinstance(_tmp, basestring)
            if not _tmp2:
                pass
                econtext.update(dict(rcontext=rcontext, _domain=_domain))
                _tmp(econtext, repeat)
            else:
                pass
                u"%(tmp)s"
                _tmp2 = _tmp
                _tmp = _tmp2
                if _tmp.__class__ not in (str, unicode, int, float):
                    try:
                        _tmp = _tmp.__html__
                    except:
                        _tmp = _translate(
                            _tmp, domain=_domain, mapping=None, target_language=target_language, default=None
                        )
                    else:
                        _tmp = _tmp()
                        _write(_tmp)
                        _tmp = None
                if _tmp is not None:
                    if not isinstance(_tmp, unicode):
                        _tmp = str(_tmp)
                    _write(_tmp)
        else:
            pass
            attrs = _attrs_4345507600
            _write(u"<div>\n        </div>")
        _write(u"\n      </div>\n    </body>\n</html>")
        return

    return render
コード例 #24
0
def bind():
    from cPickle import loads as _loads
    _attrs_4365408720 = _loads(
        '(dp1\nVname\np2\nVnext\np3\nsVvalue\np4\nV\nsVtype\np5\nVhidden\np6\nsVid\np7\nVnext\np8\ns.'
    )
    _lookup_attr = _loads('cchameleon.core.codegen\nlookup_attr\np1\n.')
    _init_scope = _loads('cchameleon.core.utils\necontext\np1\n.')
    _attrs_4365409424 = _loads('(dp1\nVclass\np2\nVfa_controls\np3\ns.')
    _attrs_4365406672 = _loads('(dp1\n.')
    _attrs_4365407632 = _loads('(dp1\n.')
    _attrs_4365408080 = _loads(
        '(dp1\nVname\np2\nV_method\np3\nsVtype\np4\nVhidden\np5\nsVvalue\np6\nVPUT\np7\ns.'
    )
    _init_stream = _loads(
        'cchameleon.core.generation\ninitialize_stream\np1\n.')
    _init_default = _loads(
        'cchameleon.core.generation\ninitialize_default\np1\n.')
    _attrs_4365407056 = _loads(
        '(dp1\nVaction\np2\nV\nsVmethod\np3\nVPOST\np4\nsVenctype\np5\nVmultipart/form-data\np6\ns.'
    )
    _init_tal = _loads('cchameleon.core.generation\ninitialize_tal\np1\n.')

    def render(econtext, rcontext=None):
        macros = econtext.get('macros')
        _translate = econtext.get('_translate')
        _slots = econtext.get('_slots')
        target_language = econtext.get('target_language')
        u'_init_stream()'
        (
            _out,
            _write,
        ) = _init_stream()
        u'_init_tal()'
        (
            _attributes,
            repeat,
        ) = _init_tal()
        u'_init_default()'
        _default = _init_default()
        u'None'
        default = None
        u'None'
        _domain = None
        u"main.macros['master']"
        _metal = _lookup_attr(econtext['main'], 'macros')['master']

        def _callback_main(econtext,
                           _repeat,
                           _out=_out,
                           _write=_write,
                           _domain=_domain,
                           **_ignored):
            if _repeat:
                repeat.update(_repeat)
            attrs = _attrs_4365406672
            _write(u'<div>\n      ')
            attrs = _attrs_4365407056
            u"''"
            _write(
                u'<form action="" method="POST" enctype="multipart/form-data">\n        '
            )
            _default.value = default = ''
            u'fs.render()'
            _content = _lookup_attr(econtext['fs'], 'render')()
            attrs = _attrs_4365407632
            u'_content'
            _write(u'<div>')
            _tmp1 = _content
            _tmp = _tmp1
            if (_tmp.__class__ not in (
                    str,
                    unicode,
                    int,
                    float,
            )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp,
                                      domain=_domain,
                                      mapping=None,
                                      target_language=target_language,
                                      default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                _write(_tmp)
            _write(u'</div>\n        ')
            attrs = _attrs_4365408080
            _write(
                u'<input type="hidden" name="_method" value="PUT" />\n        '
            )
            attrs = _attrs_4365408720
            u"u'\\n        '"
            _write(
                u'<input type="hidden" id="next" name="next" value="" />\n        '
            )
            _default.value = default = u'\n        '
            u'actions.buttons(request)'
            _content = _lookup_attr(econtext['actions'],
                                    'buttons')(econtext['request'])
            attrs = _attrs_4365409424
            u'_content'
            _write(u'<div class="fa_controls">')
            _tmp1 = _content
            _tmp = _tmp1
            if (_tmp.__class__ not in (
                    str,
                    unicode,
                    int,
                    float,
            )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp,
                                      domain=_domain,
                                      mapping=None,
                                      target_language=target_language,
                                      default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                _write(_tmp)
            _write(u'</div>\n      </form>\n    </div>\n')

        u"{'main': _callback_main}"
        _tmp = {
            'main': _callback_main,
        }
        u"main.macros['master']"
        _metal.render(_tmp,
                      _out=_out,
                      _write=_write,
                      _domain=_domain,
                      econtext=econtext)
        return _out.getvalue()

    return render
コード例 #25
0
ファイル: models.pt.py プロジェクト: pgiraud/fa.jquery
def bind():
    from cPickle import loads as _loads
    _lookup_attr = _loads('cchameleon.core.codegen\nlookup_attr\np1\n.')
    _attrs_4356586192 = _loads('(dp1\n.')
    _init_scope = _loads('cchameleon.core.utils\necontext\np1\n.')
    _re_amp = _loads("cre\n_compile\np1\n(S'&(?!([A-Za-z]+|#[0-9]+);)'\np2\nI0\ntRp3\n.")
    _attrs_4356586064 = _loads('(dp1\n.')
    _init_stream = _loads('cchameleon.core.generation\ninitialize_stream\np1\n.')
    _init_default = _loads('cchameleon.core.generation\ninitialize_default\np1\n.')
    _attrs_4356586320 = _loads('(dp1\nVclass\np2\nVfa_model ui-widget-header ui-corner-all\np3\ns.')
    _init_tal = _loads('cchameleon.core.generation\ninitialize_tal\np1\n.')
    def render(econtext, rcontext=None):
        macros = econtext.get('macros')
        _translate = econtext.get('_translate')
        _slots = econtext.get('_slots')
        target_language = econtext.get('target_language')
        u'_init_stream()'
        (_out, _write, ) = _init_stream()
        u'_init_tal()'
        (_attributes, repeat, ) = _init_tal()
        u'_init_default()'
        _default = _init_default()
        u'None'
        default = None
        u'None'
        _domain = None
        u"main.macros['master']"
        _metal = _lookup_attr(econtext['main'], 'macros')['master']
        def _callback_main(econtext, _repeat, _out=_out, _write=_write, _domain=_domain, **_ignored):
            if _repeat:
                repeat.update(_repeat)
            attrs = _attrs_4356586064
            u'models'
            _write(u'<div>\n      ')
            _tmp1 = econtext['models']
            item = None
            (_tmp1, _tmp2, ) = repeat.insert('item', _tmp1)
            for item in _tmp1:
                _tmp2 = (_tmp2 - 1)
                attrs = _attrs_4356586192
                u"''"
                _write(u'<div>\n        ')
                _default.value = default = ''
                u'item'
                _content = item
                attrs = _attrs_4356586320
                u'request.route_url(request.route_name, traverse=item)'
                _write(u'<a class="fa_model ui-widget-header ui-corner-all"')
                _tmp3 = _lookup_attr(econtext['request'], 'route_url')(_lookup_attr(econtext['request'], 'route_name'), traverse=item)
                if (_tmp3 is _default):
                    _tmp3 = None
                if ((_tmp3 is not None) and (_tmp3 is not False)):
                    if (_tmp3.__class__ not in (str, unicode, int, float, )):
                        _tmp3 = unicode(_translate(_tmp3, domain=_domain, mapping=None, target_language=target_language, default=None))
                    else:
                        if not isinstance(_tmp3, unicode):
                            _tmp3 = str(_tmp3)
                    if ('&' in _tmp3):
                        if (';' in _tmp3):
                            _tmp3 = _re_amp.sub('&amp;', _tmp3)
                        else:
                            _tmp3 = _tmp3.replace('&', '&amp;')
                    if ('<' in _tmp3):
                        _tmp3 = _tmp3.replace('<', '&lt;')
                    if ('>' in _tmp3):
                        _tmp3 = _tmp3.replace('>', '&gt;')
                    if ('"' in _tmp3):
                        _tmp3 = _tmp3.replace('"', '&quot;')
                    _write(((' href="' + _tmp3) + '"'))
                u'_content'
                _write('>')
                _tmp3 = _content
                _tmp = _tmp3
                if (_tmp.__class__ not in (str, unicode, int, float, )):
                    try:
                        _tmp = _tmp.__html__
                    except:
                        _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                    else:
                        _tmp = _tmp()
                        _write(_tmp)
                        _tmp = None
                if (_tmp is not None):
                    if not isinstance(_tmp, unicode):
                        _tmp = str(_tmp)
                    if ('&' in _tmp):
                        if (';' in _tmp):
                            _tmp = _re_amp.sub('&amp;', _tmp)
                        else:
                            _tmp = _tmp.replace('&', '&amp;')
                    if ('<' in _tmp):
                        _tmp = _tmp.replace('<', '&lt;')
                    if ('>' in _tmp):
                        _tmp = _tmp.replace('>', '&gt;')
                    _write(_tmp)
                _write(u'</a>\n      </div>')
                if (_tmp2 == 0):
                    break
                _write(' ')
            _write(u'\n    </div>\n')
        u"{'main': _callback_main}"
        _tmp = {'main': _callback_main, }
        u"main.macros['master']"
        _metal.render(_tmp, _out=_out, _write=_write, _domain=_domain, econtext=econtext)
        return _out.getvalue()
    return render
コード例 #26
0
ファイル: new.pt.py プロジェクト: samuelchen/fa.jquery
def bind():
    from cPickle import loads as _loads
    _attrs_4363310928 = _loads('(dp1\n.')
    _lookup_attr = _loads('cchameleon.core.codegen\nlookup_attr\np1\n.')
    _init_scope = _loads('cchameleon.core.utils\necontext\np1\n.')
    _re_amp = _loads("cre\n_compile\np1\n(S'&(?!([A-Za-z]+|#[0-9]+);)'\np2\nI0\ntRp3\n.")
    _attrs_4363311760 = _loads('(dp1\nVclass\np2\nVfa_controls\np3\ns.')
    _attrs_4363313104 = _loads('(dp1\nVmethod\np2\nVPOST\np3\nsVenctype\np4\nVmultipart/form-data\np5\ns.')
    _init_stream = _loads('cchameleon.core.generation\ninitialize_stream\np1\n.')
    _attrs_4363312528 = _loads('(dp1\n.')
    _init_default = _loads('cchameleon.core.generation\ninitialize_default\np1\n.')
    _attrs_4363312144 = _loads('(dp1\nVname\np2\nVnext\np3\nsVvalue\np4\nV\nsVtype\np5\nVhidden\np6\nsVid\np7\nVnext\np8\ns.')
    _init_tal = _loads('cchameleon.core.generation\ninitialize_tal\np1\n.')
    def render(econtext, rcontext=None):
        macros = econtext.get('macros')
        _translate = econtext.get('_translate')
        _slots = econtext.get('_slots')
        target_language = econtext.get('target_language')
        u'_init_stream()'
        (_out, _write, ) = _init_stream()
        u'_init_tal()'
        (_attributes, repeat, ) = _init_tal()
        u'_init_default()'
        _default = _init_default()
        u'None'
        default = None
        u'None'
        _domain = None
        u"main.macros['master']"
        _metal = _lookup_attr(econtext['main'], 'macros')['master']
        def _callback_main(econtext, _repeat, _out=_out, _write=_write, _domain=_domain, **_ignored):
            if _repeat:
                repeat.update(_repeat)
            attrs = _attrs_4363310928
            _write(u'<div>\n      ')
            attrs = _attrs_4363313104
            u'request.fa_url(request.model_name)'
            _write(u'<form method="POST" enctype="multipart/form-data"')
            _tmp1 = _lookup_attr(econtext['request'], 'fa_url')(_lookup_attr(econtext['request'], 'model_name'))
            if (_tmp1 is _default):
                _tmp1 = None
            if ((_tmp1 is not None) and (_tmp1 is not False)):
                if (_tmp1.__class__ not in (str, unicode, int, float, )):
                    _tmp1 = unicode(_translate(_tmp1, domain=_domain, mapping=None, target_language=target_language, default=None))
                else:
                    if not isinstance(_tmp1, unicode):
                        _tmp1 = str(_tmp1)
                if ('&' in _tmp1):
                    if (';' in _tmp1):
                        _tmp1 = _re_amp.sub('&amp;', _tmp1)
                    else:
                        _tmp1 = _tmp1.replace('&', '&amp;')
                if ('<' in _tmp1):
                    _tmp1 = _tmp1.replace('<', '&lt;')
                if ('>' in _tmp1):
                    _tmp1 = _tmp1.replace('>', '&gt;')
                if ('"' in _tmp1):
                    _tmp1 = _tmp1.replace('"', '&quot;')
                _write(((' action="' + _tmp1) + '"'))
            u"''"
            _write(u'>\n        ')
            _default.value = default = ''
            u'fs.render()'
            _content = _lookup_attr(econtext['fs'], 'render')()
            attrs = _attrs_4363312528
            u'_content'
            _write(u'<div>')
            _tmp1 = _content
            _tmp = _tmp1
            if (_tmp.__class__ not in (str, unicode, int, float, )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                _write(_tmp)
            _write(u'</div>\n        ')
            attrs = _attrs_4363312144
            u"u'\\n        '"
            _write(u'<input type="hidden" id="next" name="next" value="" />\n        ')
            _default.value = default = u'\n        '
            u'request.buttons.render(request)'
            _content = _lookup_attr(_lookup_attr(econtext['request'], 'buttons'), 'render')(econtext['request'])
            attrs = _attrs_4363311760
            u'_content'
            _write(u'<div class="fa_controls">')
            _tmp1 = _content
            _tmp = _tmp1
            if (_tmp.__class__ not in (str, unicode, int, float, )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                _write(_tmp)
            _write(u'</div>\n      </form>\n    </div>\n')
        u"{'main': _callback_main}"
        _tmp = {'main': _callback_main, }
        u"main.macros['master']"
        _metal.render(_tmp, _out=_out, _write=_write, _domain=_domain, econtext=econtext)
        return _out.getvalue()
    return render
コード例 #27
0
def bind():
    from cPickle import loads as _loads
    _lookup_attr = _loads('cchameleon.core.codegen\nlookup_attr\np1\n.')
    _init_scope = _loads('cchameleon.core.utils\necontext\np1\n.')
    _re_amp = _loads("cre\n_compile\np1\n(S'&(?!([A-Za-z]+|#[0-9]+);)'\np2\nI0\ntRp3\n.")
    _attrs_4358968400 = _loads('(dp1\n.')
    _attrs_4358849552 = _loads('(dp1\n.')
    _attrs_4358967760 = _loads('(dp1\nVid\np2\nVheader\np3\nsVclass\np4\nVui-widget-header ui-corner-all\np5\ns.')
    _attrs_4358720592 = _loads('(dp1\nVrel\np2\nVstylesheet\np3\ns.')
    _attrs_4358967504 = _loads('(dp1\nVid\np2\nVcontent\np3\nsVclass\np4\nVui-admin ui-widget\np5\ns.')
    _attrs_4358967888 = _loads('(dp1\nVclass\np2\nVbreadcrumb\np3\ns.')
    _init_stream = _loads('cchameleon.core.generation\ninitialize_stream\np1\n.')
    _attrs_4358968272 = _loads('(dp1\n.')
    _attrs_4358721104 = _loads('(dp1\n.')
    _attrs_4358721040 = _loads('(dp1\n.')
    _init_default = _loads('cchameleon.core.generation\ninitialize_default\np1\n.')
    _attrs_4358721232 = _loads('(dp1\n.')
    _attrs_4358967696 = _loads('(dp1\n.')
    _init_tal = _loads('cchameleon.core.generation\ninitialize_tal\np1\n.')
    _attrs_4358967952 = _loads('(dp1\n.')
    def render(econtext, rcontext=None):
        macros = econtext.get('macros')
        _translate = econtext.get('_translate')
        _slots = econtext.get('_slots')
        target_language = econtext.get('target_language')
        u"%(scope)s['%(out)s'], %(scope)s['%(write)s']"
        (_out, _write, ) = (econtext['_out'], econtext['_write'], )
        u'_init_tal()'
        (_attributes, repeat, ) = _init_tal()
        u'_init_default()'
        _default = _init_default()
        u'None'
        default = None
        u'None'
        _domain = None
        attrs = _attrs_4358849552
        _write(u'<html>\n    ')
        attrs = _attrs_4358721040
        u"''"
        _write(u'<head>\n      ')
        _default.value = default = ''
        u"request.model_name or 'root'"
        _content = (_lookup_attr(econtext['request'], 'model_name') or 'root')
        attrs = _attrs_4358721104
        u'_content'
        _write(u'<title>')
        _tmp1 = _content
        _tmp = _tmp1
        if (_tmp.__class__ not in (str, unicode, int, float, )):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if (_tmp is not None):
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            if ('&' in _tmp):
                if (';' in _tmp):
                    _tmp = _re_amp.sub('&amp;', _tmp)
                else:
                    _tmp = _tmp.replace('&', '&amp;')
            if ('<' in _tmp):
                _tmp = _tmp.replace('<', '&lt;')
            if ('>' in _tmp):
                _tmp = _tmp.replace('>', '&gt;')
            _write(_tmp)
        _write(u'</title>\n      ')
        attrs = _attrs_4358720592
        u"request.static_url('pyramid_formalchemy:static/admin.css')"
        _write(u'<link rel="stylesheet"')
        _tmp1 = _lookup_attr(econtext['request'], 'static_url')('pyramid_formalchemy:static/admin.css')
        if (_tmp1 is _default):
            _tmp1 = None
        if ((_tmp1 is not None) and (_tmp1 is not False)):
            if (_tmp1.__class__ not in (str, unicode, int, float, )):
                _tmp1 = unicode(_translate(_tmp1, domain=_domain, mapping=None, target_language=target_language, default=None))
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if ('&' in _tmp1):
                if (';' in _tmp1):
                    _tmp1 = _re_amp.sub('&amp;', _tmp1)
                else:
                    _tmp1 = _tmp1.replace('&', '&amp;')
            if ('<' in _tmp1):
                _tmp1 = _tmp1.replace('<', '&lt;')
            if ('>' in _tmp1):
                _tmp1 = _tmp1.replace('>', '&gt;')
            if ('"' in _tmp1):
                _tmp1 = _tmp1.replace('"', '&quot;')
            _write(((' href="' + _tmp1) + '"'))
        _write(u'></link>\n    </head>\n    ')
        attrs = _attrs_4358721232
        _write(u'<body>\n      ')
        attrs = _attrs_4358967504
        _write(u'<div id="content" class="ui-admin ui-widget">\n        ')
        attrs = _attrs_4358967760
        _write(u'<h1 id="header" class="ui-widget-header ui-corner-all">\n          ')
        attrs = _attrs_4358967888
        u'breadcrumb'
        _write(u'<div class="breadcrumb">\n            ')
        _tmp1 = econtext['breadcrumb']
        item = None
        (_tmp1, _tmp2, ) = repeat.insert('item', _tmp1)
        for item in _tmp1:
            _tmp2 = (_tmp2 - 1)
            u"''"
            _write(u'')
            _default.value = default = ''
            u'item[1]'
            _content = item[1]
            attrs = _attrs_4358968400
            u'item[0]'
            _write(u'<a')
            _tmp3 = item[0]
            if (_tmp3 is _default):
                _tmp3 = None
            if ((_tmp3 is not None) and (_tmp3 is not False)):
                if (_tmp3.__class__ not in (str, unicode, int, float, )):
                    _tmp3 = unicode(_translate(_tmp3, domain=_domain, mapping=None, target_language=target_language, default=None))
                else:
                    if not isinstance(_tmp3, unicode):
                        _tmp3 = str(_tmp3)
                if ('&' in _tmp3):
                    if (';' in _tmp3):
                        _tmp3 = _re_amp.sub('&amp;', _tmp3)
                    else:
                        _tmp3 = _tmp3.replace('&', '&amp;')
                if ('<' in _tmp3):
                    _tmp3 = _tmp3.replace('<', '&lt;')
                if ('>' in _tmp3):
                    _tmp3 = _tmp3.replace('>', '&gt;')
                if ('"' in _tmp3):
                    _tmp3 = _tmp3.replace('"', '&quot;')
                _write(((' href="' + _tmp3) + '"'))
            u'_content'
            _write('>')
            _tmp3 = _content
            _tmp = _tmp3
            if (_tmp.__class__ not in (str, unicode, int, float, )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                if ('&' in _tmp):
                    if (';' in _tmp):
                        _tmp = _re_amp.sub('&amp;', _tmp)
                    else:
                        _tmp = _tmp.replace('&', '&amp;')
                if ('<' in _tmp):
                    _tmp = _tmp.replace('<', '&lt;')
                if ('>' in _tmp):
                    _tmp = _tmp.replace('>', '&gt;')
                _write(_tmp)
            u'not repeat.item.end'
            _write(u'</a>\n                ')
            _tmp3 = not _lookup_attr(repeat.item, 'end')
            if _tmp3:
                pass
                attrs = _attrs_4358968272
                _write(u'<span>/</span>')
            _write(u'\n            ')
            if (_tmp2 == 0):
                break
            _write(' ')
        u"''"
        _write(u'\n          </div>\n          ')
        _default.value = default = ''
        u"request.model_name or 'root'"
        _content = (_lookup_attr(econtext['request'], 'model_name') or 'root')
        attrs = _attrs_4358967952
        u'_content'
        _write(u'<div>')
        _tmp1 = _content
        _tmp = _tmp1
        if (_tmp.__class__ not in (str, unicode, int, float, )):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if (_tmp is not None):
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            if ('&' in _tmp):
                if (';' in _tmp):
                    _tmp = _re_amp.sub('&amp;', _tmp)
                else:
                    _tmp = _tmp.replace('&', '&amp;')
            if ('<' in _tmp):
                _tmp = _tmp.replace('<', '&lt;')
            if ('>' in _tmp):
                _tmp = _tmp.replace('>', '&gt;')
            _write(_tmp)
        u"%(slots)s.get(u'main')"
        _write(u'</div>\n        </h1>\n        ')
        _tmp = _slots.get(u'main')
        u'%(tmp)s is not None'
        _tmp1 = (_tmp is not None)
        if _tmp1:
            pass
            u'isinstance(%(tmp)s, basestring)'
            _tmp2 = isinstance(_tmp, basestring)
            if not _tmp2:
                pass
                econtext.update(dict(rcontext=rcontext, _domain=_domain))
                _tmp(econtext, repeat)
            else:
                pass
                u'%(tmp)s'
                _tmp2 = _tmp
                _tmp = _tmp2
                if (_tmp.__class__ not in (str, unicode, int, float, )):
                    try:
                        _tmp = _tmp.__html__
                    except:
                        _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                    else:
                        _tmp = _tmp()
                        _write(_tmp)
                        _tmp = None
                if (_tmp is not None):
                    if not isinstance(_tmp, unicode):
                        _tmp = str(_tmp)
                    _write(_tmp)
        else:
            pass
            attrs = _attrs_4358967696
            _write(u'<div>\n        </div>')
        _write(u'\n      </div>\n    </body>\n</html>')
        return
    return render
コード例 #28
0
ファイル: _py2_pickle.py プロジェクト: abradle/rdkit
def loads(s, **kwargs):
  return _loads(s)
コード例 #29
0
def bind():
    from cPickle import loads as _loads
    _attrs_4353373456 = _loads('(dp1\nVrel\np2\nVstylesheet\np3\ns.')
    _lookup_attr = _loads('cchameleon.core.codegen\nlookup_attr\np1\n.')
    _init_scope = _loads('cchameleon.core.utils\necontext\np1\n.')
    _re_amp = _loads("cre\n_compile\np1\n(S'&(?!([A-Za-z]+|#[0-9]+);)'\np2\nI0\ntRp3\n.")
    _attrs_4353342480 = _loads('(dp1\n.')
    _attrs_4345507344 = _loads('(dp1\nVid\np2\nVheader\np3\nsVclass\np4\nVui-widget-header ui-corner-all\np5\ns.')
    _attrs_4353343184 = _loads('(dp1\nVclass\np2\nVbreadcrumb\np3\ns.')
    _attrs_4353342544 = _loads('(dp1\n.')
    _attrs_4353376016 = _loads('(dp1\n.')
    _init_stream = _loads('cchameleon.core.generation\ninitialize_stream\np1\n.')
    _attrs_4353376144 = _loads('(dp1\n.')
    _attrs_4353376208 = _loads('(dp1\n.')
    _attrs_4353372432 = _loads('(dp1\nVsrc\np2\nVhttps://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js\np3\ns.')
    _init_default = _loads('cchameleon.core.generation\ninitialize_default\np1\n.')
    _attrs_4353372560 = _loads('(dp1\nVid\np2\nVcontent\np3\nsVclass\np4\nVui-admin ui-widget\np5\ns.')
    _attrs_4345507600 = _loads('(dp1\n.')
    _attrs_4353342352 = _loads('(dp1\n.')
    _attrs_4353413200 = _loads('(dp1\n.')
    _init_tal = _loads('cchameleon.core.generation\ninitialize_tal\np1\n.')
    def render(econtext, rcontext=None):
        macros = econtext.get('macros')
        _translate = econtext.get('_translate')
        _slots = econtext.get('_slots')
        target_language = econtext.get('target_language')
        u"%(scope)s['%(out)s'], %(scope)s['%(write)s']"
        (_out, _write, ) = (econtext['_out'], econtext['_write'], )
        u'_init_tal()'
        (_attributes, repeat, ) = _init_tal()
        u'_init_default()'
        _default = _init_default()
        u'None'
        default = None
        u'None'
        _domain = None
        attrs = _attrs_4353376016
        _write(u'<html>\n    ')
        attrs = _attrs_4353376144
        u"''"
        _write(u'<head>\n      ')
        _default.value = default = ''
        u"request.model_name or 'root'"
        _content = (_lookup_attr(econtext['request'], 'model_name') or 'root')
        attrs = _attrs_4353413200
        u'_content'
        _write(u'<title>')
        _tmp1 = _content
        _tmp = _tmp1
        if (_tmp.__class__ not in (str, unicode, int, float, )):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if (_tmp is not None):
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            if ('&' in _tmp):
                if (';' in _tmp):
                    _tmp = _re_amp.sub('&amp;', _tmp)
                else:
                    _tmp = _tmp.replace('&', '&amp;')
            if ('<' in _tmp):
                _tmp = _tmp.replace('<', '&lt;')
            if ('>' in _tmp):
                _tmp = _tmp.replace('>', '&gt;')
            _write(_tmp)
        _write(u'</title>\n      ')
        attrs = _attrs_4353373456
        u"request.static_url('pyramid_formalchemy:static/admin.css')"
        _write(u'<link rel="stylesheet"')
        _tmp1 = _lookup_attr(econtext['request'], 'static_url')('pyramid_formalchemy:static/admin.css')
        if (_tmp1 is _default):
            _tmp1 = None
        if ((_tmp1 is not None) and (_tmp1 is not False)):
            if (_tmp1.__class__ not in (str, unicode, int, float, )):
                _tmp1 = unicode(_translate(_tmp1, domain=_domain, mapping=None, target_language=target_language, default=None))
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if ('&' in _tmp1):
                if (';' in _tmp1):
                    _tmp1 = _re_amp.sub('&amp;', _tmp1)
                else:
                    _tmp1 = _tmp1.replace('&', '&amp;')
            if ('<' in _tmp1):
                _tmp1 = _tmp1.replace('<', '&lt;')
            if ('>' in _tmp1):
                _tmp1 = _tmp1.replace('>', '&gt;')
            if ('"' in _tmp1):
                _tmp1 = _tmp1.replace('"', '&quot;')
            _write(((' href="' + _tmp1) + '"'))
        _write(u'></link>\n      ')
        attrs = _attrs_4353372432
        _write(u'<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>\n    </head>\n    ')
        attrs = _attrs_4353376208
        _write(u'<body>\n      ')
        attrs = _attrs_4353372560
        _write(u'<div id="content" class="ui-admin ui-widget">\n        ')
        attrs = _attrs_4345507344
        _write(u'<h1 id="header" class="ui-widget-header ui-corner-all">\n          ')
        attrs = _attrs_4353343184
        u'breadcrumb'
        _write(u'<div class="breadcrumb">\n            ')
        _tmp1 = econtext['breadcrumb']
        item = None
        (_tmp1, _tmp2, ) = repeat.insert('item', _tmp1)
        for item in _tmp1:
            _tmp2 = (_tmp2 - 1)
            u"''"
            _write(u'')
            _default.value = default = ''
            u'item[1]'
            _content = item[1]
            attrs = _attrs_4353342480
            u'item[0]'
            _write(u'<a')
            _tmp3 = item[0]
            if (_tmp3 is _default):
                _tmp3 = None
            if ((_tmp3 is not None) and (_tmp3 is not False)):
                if (_tmp3.__class__ not in (str, unicode, int, float, )):
                    _tmp3 = unicode(_translate(_tmp3, domain=_domain, mapping=None, target_language=target_language, default=None))
                else:
                    if not isinstance(_tmp3, unicode):
                        _tmp3 = str(_tmp3)
                if ('&' in _tmp3):
                    if (';' in _tmp3):
                        _tmp3 = _re_amp.sub('&amp;', _tmp3)
                    else:
                        _tmp3 = _tmp3.replace('&', '&amp;')
                if ('<' in _tmp3):
                    _tmp3 = _tmp3.replace('<', '&lt;')
                if ('>' in _tmp3):
                    _tmp3 = _tmp3.replace('>', '&gt;')
                if ('"' in _tmp3):
                    _tmp3 = _tmp3.replace('"', '&quot;')
                _write(((' href="' + _tmp3) + '"'))
            u'_content'
            _write('>')
            _tmp3 = _content
            _tmp = _tmp3
            if (_tmp.__class__ not in (str, unicode, int, float, )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                if ('&' in _tmp):
                    if (';' in _tmp):
                        _tmp = _re_amp.sub('&amp;', _tmp)
                    else:
                        _tmp = _tmp.replace('&', '&amp;')
                if ('<' in _tmp):
                    _tmp = _tmp.replace('<', '&lt;')
                if ('>' in _tmp):
                    _tmp = _tmp.replace('>', '&gt;')
                _write(_tmp)
            u'not repeat.item.end'
            _write(u'</a>\n                ')
            _tmp3 = not _lookup_attr(repeat.item, 'end')
            if _tmp3:
                pass
                attrs = _attrs_4353342544
                _write(u'<span>/</span>')
            _write(u'\n            ')
            if (_tmp2 == 0):
                break
            _write(' ')
        u"''"
        _write(u'\n          </div>\n          ')
        _default.value = default = ''
        u"request.model_name or 'root'"
        _content = (_lookup_attr(econtext['request'], 'model_name') or 'root')
        attrs = _attrs_4353342352
        u'_content'
        _write(u'<div>')
        _tmp1 = _content
        _tmp = _tmp1
        if (_tmp.__class__ not in (str, unicode, int, float, )):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if (_tmp is not None):
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            if ('&' in _tmp):
                if (';' in _tmp):
                    _tmp = _re_amp.sub('&amp;', _tmp)
                else:
                    _tmp = _tmp.replace('&', '&amp;')
            if ('<' in _tmp):
                _tmp = _tmp.replace('<', '&lt;')
            if ('>' in _tmp):
                _tmp = _tmp.replace('>', '&gt;')
            _write(_tmp)
        u"%(slots)s.get(u'main')"
        _write(u'</div>\n        </h1>\n        ')
        _tmp = _slots.get(u'main')
        u'%(tmp)s is not None'
        _tmp1 = (_tmp is not None)
        if _tmp1:
            pass
            u'isinstance(%(tmp)s, basestring)'
            _tmp2 = isinstance(_tmp, basestring)
            if not _tmp2:
                pass
                econtext.update(dict(rcontext=rcontext, _domain=_domain))
                _tmp(econtext, repeat)
            else:
                pass
                u'%(tmp)s'
                _tmp2 = _tmp
                _tmp = _tmp2
                if (_tmp.__class__ not in (str, unicode, int, float, )):
                    try:
                        _tmp = _tmp.__html__
                    except:
                        _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                    else:
                        _tmp = _tmp()
                        _write(_tmp)
                        _tmp = None
                if (_tmp is not None):
                    if not isinstance(_tmp, unicode):
                        _tmp = str(_tmp)
                    _write(_tmp)
        else:
            pass
            attrs = _attrs_4345507600
            _write(u'<div>\n        </div>')
        _write(u'\n      </div>\n    </body>\n</html>')
        return
    return render
コード例 #30
0
def bind():
    from cPickle import loads as _loads
    _lookup_attr = _loads('cchameleon.core.codegen\nlookup_attr\np1\n.')
    _init_scope = _loads('cchameleon.core.utils\necontext\np1\n.')
    _re_amp = _loads("cre\n_compile\np1\n(S'&(?!([A-Za-z]+|#[0-9]+);)'\np2\nI0\ntRp3\n.")
    _attrs_4359083472 = _loads('(dp1\nVclass\np2\nVui-widget-header ui-widget-link ui-corner-all\np3\ns.')
    _attrs_4359083344 = _loads('(dp1\n.')
    _attrs_4359083216 = _loads('(dp1\nVclass\np2\nVui-pager\np3\ns.')
    _init_stream = _loads('cchameleon.core.generation\ninitialize_stream\np1\n.')
    _attrs_4359083600 = _loads('(dp1\nVclass\np2\nVui-icon ui-icon-circle-plus\np3\ns.')
    _attrs_4359083088 = _loads('(dp1\n.')
    _init_default = _loads('cchameleon.core.generation\ninitialize_default\np1\n.')
    _init_tal = _loads('cchameleon.core.generation\ninitialize_tal\np1\n.')
    _attrs_4359083280 = _loads('(dp1\nVclass\np2\nVlayout-grid\np3\ns.')
    def render(econtext, rcontext=None):
        macros = econtext.get('macros')
        _translate = econtext.get('_translate')
        _slots = econtext.get('_slots')
        target_language = econtext.get('target_language')
        u'_init_stream()'
        (_out, _write, ) = _init_stream()
        u'_init_tal()'
        (_attributes, repeat, ) = _init_tal()
        u'_init_default()'
        _default = _init_default()
        u'None'
        default = None
        u'None'
        _domain = None
        u"main.macros['master']"
        _metal = _lookup_attr(econtext['main'], 'macros')['master']
        def _callback_main(econtext, _repeat, _out=_out, _write=_write, _domain=_domain, **_ignored):
            if _repeat:
                repeat.update(_repeat)
            attrs = _attrs_4359083088
            u"''"
            _write(u'<div>\n      ')
            _default.value = default = ''
            u'pager'
            _content = econtext['pager']
            attrs = _attrs_4359083216
            u'_content'
            _write(u'<div class="ui-pager">')
            _tmp1 = _content
            _tmp = _tmp1
            if (_tmp.__class__ not in (str, unicode, int, float, )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                _write(_tmp)
            u"''"
            _write(u'</div>\n      ')
            _default.value = default = ''
            u'fs.render()'
            _content = _lookup_attr(econtext['fs'], 'render')()
            attrs = _attrs_4359083280
            u'_content'
            _write(u'<table class="layout-grid">')
            _tmp1 = _content
            _tmp = _tmp1
            if (_tmp.__class__ not in (str, unicode, int, float, )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                _write(_tmp)
            _write(u'</table>\n      ')
            attrs = _attrs_4359083344
            _write(u'<p>\n        ')
            attrs = _attrs_4359083472
            u"request.fa_url(request.model_name, 'new')"
            _write(u'<a class="ui-widget-header ui-widget-link ui-corner-all"')
            _tmp1 = _lookup_attr(econtext['request'], 'fa_url')(_lookup_attr(econtext['request'], 'model_name'), 'new')
            if (_tmp1 is _default):
                _tmp1 = None
            if ((_tmp1 is not None) and (_tmp1 is not False)):
                if (_tmp1.__class__ not in (str, unicode, int, float, )):
                    _tmp1 = unicode(_translate(_tmp1, domain=_domain, mapping=None, target_language=target_language, default=None))
                else:
                    if not isinstance(_tmp1, unicode):
                        _tmp1 = str(_tmp1)
                if ('&' in _tmp1):
                    if (';' in _tmp1):
                        _tmp1 = _re_amp.sub('&amp;', _tmp1)
                    else:
                        _tmp1 = _tmp1.replace('&', '&amp;')
                if ('<' in _tmp1):
                    _tmp1 = _tmp1.replace('<', '&lt;')
                if ('>' in _tmp1):
                    _tmp1 = _tmp1.replace('>', '&gt;')
                if ('"' in _tmp1):
                    _tmp1 = _tmp1.replace('"', '&quot;')
                _write(((' href="' + _tmp1) + '"'))
            _write(u'>\n            ')
            attrs = _attrs_4359083600
            u"F_('New')"
            _write(u'<span class="ui-icon ui-icon-circle-plus"></span>\n            ')
            _tmp1 = econtext['F_']('New')
            _tmp = _tmp1
            if (_tmp.__class__ not in (str, unicode, int, float, )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                if ('&' in _tmp):
                    if (';' in _tmp):
                        _tmp = _re_amp.sub('&amp;', _tmp)
                    else:
                        _tmp = _tmp.replace('&', '&amp;')
                if ('<' in _tmp):
                    _tmp = _tmp.replace('<', '&lt;')
                if ('>' in _tmp):
                    _tmp = _tmp.replace('>', '&gt;')
                _write(_tmp)
            u'model_name'
            _write(u' ')
            _tmp1 = econtext['model_name']
            _tmp = _tmp1
            if (_tmp.__class__ not in (str, unicode, int, float, )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                if ('&' in _tmp):
                    if (';' in _tmp):
                        _tmp = _re_amp.sub('&amp;', _tmp)
                    else:
                        _tmp = _tmp.replace('&', '&amp;')
                if ('<' in _tmp):
                    _tmp = _tmp.replace('<', '&lt;')
                if ('>' in _tmp):
                    _tmp = _tmp.replace('>', '&gt;')
                _write(_tmp)
            _write(u'\n        </a>\n      </p>\n    </div>\n')
        u"{'main': _callback_main}"
        _tmp = {'main': _callback_main, }
        u"main.macros['master']"
        _metal.render(_tmp, _out=_out, _write=_write, _domain=_domain, econtext=econtext)
        return _out.getvalue()
    return render
コード例 #31
0
ファイル: test.pt.py プロジェクト: ellimistd/pyquiz
def bind():
    from cPickle import loads as _loads
    _lookup_attr = _loads('cchameleon.core.codegen\nlookup_attr\np1\n.')
    _attrs_71962704 = _loads('(dp1\n.')
    _re_amp = _loads("cre\n_compile\np1\n(S'&(?!([A-Za-z]+|#[0-9]+);)'\np2\nI0\ntRp3\n.")
    _attrs_71964432 = _loads('(dp1\n.')
    _attrs_71963280 = _loads('(dp1\n.')
    _attrs_71963728 = _loads('(dp1\nVcontent\np2\nVtext/html;charset=UTF-8\np3\nsVhttp-equiv\np4\nVContent-Type\np5\ns.')
    _init_stream = _loads('cchameleon.core.generation\ninitialize_stream\np1\n.')
    _attrs_71851856 = _loads('(dp1\nVhref\np2\nV${question[1]}\np3\ns.')
    _attrs_71964816 = _loads('(dp1\nVid\np2\nVwrap\np3\ns.')
    _attrs_71850832 = _loads('(dp1\n.')
    _attrs_71963600 = _loads('(dp1\nVxml:lang\np2\nVen\np3\nsVxmlns\np4\nVhttp://www.w3.org/1999/xhtml\np5\ns.')
    _attrs_71876880 = _loads('(dp1\n.')
    _init_tal = _loads('cchameleon.core.generation\ninitialize_tal\np1\n.')
    _attrs_71964240 = _loads("(dp1\nVhref\np2\nV${request.static_url('pyquiz:static/favicon.ico')}\np3\nsVrel\np4\nVshortcut icon\np5\ns.")
    _attrs_71963664 = _loads('(dp1\nVid\np2\nVmiddle\np3\ns.')
    _init_default = _loads('cchameleon.core.generation\ninitialize_default\np1\n.')
    _attrs_71963856 = _loads('(dp1\nVcontent\np2\nVpython web application\np3\nsVname\np4\nVkeywords\np5\ns.')
    _attrs_71270672 = _loads('(dp1\nVhref\np2\nV${link}\np3\ns.')
    _init_scope = _loads('cchameleon.core.utils\necontext\np1\n.')
    _attrs_71876752 = _loads('(dp1\nVclass\np2\nVmiddle align-center\np3\ns.')
    _attrs_71963024 = _loads('(dp1\n.')
    _attrs_71964048 = _loads('(dp1\nVcontent\np2\nVpyramid web application\np3\nsVname\np4\nVdescription\np5\ns.')
    _attrs_71962768 = _loads('(dp1\n.')
    def render(econtext, rcontext=None):
        macros = econtext.get('macros')
        _translate = econtext.get('_translate')
        _slots = econtext.get('_slots')
        target_language = econtext.get('target_language')
        u'_init_stream()'
        (_out, _write, ) = _init_stream()
        u'_init_tal()'
        (_attributes, repeat, ) = _init_tal()
        u'_init_default()'
        _default = _init_default()
        u'None'
        default = None
        u'None'
        _domain = None
        _write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n')
        attrs = _attrs_71963600
        _write(u'<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">\n')
        attrs = _attrs_71962768
        _write(u'<head>\n  ')
        attrs = _attrs_71963280
        _write(u'<title>Pyquiz</title>\n  ')
        attrs = _attrs_71963728
        _write(u'<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />\n  ')
        attrs = _attrs_71963856
        _write(u'<meta name="keywords" content="python web application" />\n  ')
        attrs = _attrs_71964048
        _write(u'<meta name="description" content="pyramid web application" />\n  ')
        attrs = _attrs_71964240
        'join(value("request.static_url(\'pyquiz:static/favicon.ico\')"),)'
        _write(u'<link rel="shortcut icon"')
        _tmp1 = _lookup_attr(econtext['request'], 'static_url')('pyquiz:static/favicon.ico')
        if (_tmp1 is _default):
            _tmp1 = u"${request.static_url('pyquiz:static/favicon.ico')}"
        if ((_tmp1 is not None) and (_tmp1 is not False)):
            if (_tmp1.__class__ not in (str, unicode, int, float, )):
                _tmp1 = unicode(_translate(_tmp1, domain=_domain, mapping=None, target_language=target_language, default=None))
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if ('&' in _tmp1):
                if (';' in _tmp1):
                    _tmp1 = _re_amp.sub('&amp;', _tmp1)
                else:
                    _tmp1 = _tmp1.replace('&', '&amp;')
            if ('<' in _tmp1):
                _tmp1 = _tmp1.replace('<', '&lt;')
            if ('>' in _tmp1):
                _tmp1 = _tmp1.replace('>', '&gt;')
            if ('"' in _tmp1):
                _tmp1 = _tmp1.replace('"', '&quot;')
            _write(((' href="' + _tmp1) + '"'))
        _write(u' />\n  ')
        attrs = _attrs_71964432
        u'test.name'
        _write(u'<h1>')
        _tmp1 = _lookup_attr(econtext['test'], 'name')
        _tmp = _tmp1
        if (_tmp.__class__ not in (str, unicode, int, float, )):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if (_tmp is not None):
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            if ('&' in _tmp):
                if (';' in _tmp):
                    _tmp = _re_amp.sub('&amp;', _tmp)
                else:
                    _tmp = _tmp.replace('&', '&amp;')
            if ('<' in _tmp):
                _tmp = _tmp.replace('<', '&lt;')
            if ('>' in _tmp):
                _tmp = _tmp.replace('>', '&gt;')
            _write(_tmp)
        _write(u'</h1>\n</head>\n')
        attrs = _attrs_71963024
        _write(u'<body>\n  ')
        attrs = _attrs_71964816
        _write(u'<div id="wrap">\n\n    ')
        attrs = _attrs_71963664
        _write(u'<div id="middle">\n      ')
        attrs = _attrs_71876752
        _write(u'<div class="middle align-center">\n\n        ')
        attrs = _attrs_71876880
        u'questions'
        _write(u'<h3>Problems</h3>\n        ')
        _tmp1 = econtext['questions']
        question = None
        (_tmp1, _tmp2, ) = repeat.insert('question', _tmp1)
        for question in _tmp1:
            _tmp2 = (_tmp2 - 1)
            attrs = _attrs_71962704
            _write(u'<ul>\n            ')
            attrs = _attrs_71850832
            _write(u'<li>')
            attrs = _attrs_71851856
            "join(value('question[1]'),)"
            _write(u'<a')
            _tmp3 = question[1]
            if (_tmp3 is _default):
                _tmp3 = u'${question[1]}'
            if ((_tmp3 is not None) and (_tmp3 is not False)):
                if (_tmp3.__class__ not in (str, unicode, int, float, )):
                    _tmp3 = unicode(_translate(_tmp3, domain=_domain, mapping=None, target_language=target_language, default=None))
                else:
                    if not isinstance(_tmp3, unicode):
                        _tmp3 = str(_tmp3)
                if ('&' in _tmp3):
                    if (';' in _tmp3):
                        _tmp3 = _re_amp.sub('&amp;', _tmp3)
                    else:
                        _tmp3 = _tmp3.replace('&', '&amp;')
                if ('<' in _tmp3):
                    _tmp3 = _tmp3.replace('<', '&lt;')
                if ('>' in _tmp3):
                    _tmp3 = _tmp3.replace('>', '&gt;')
                if ('"' in _tmp3):
                    _tmp3 = _tmp3.replace('"', '&quot;')
                _write(((' href="' + _tmp3) + '"'))
            u'question[0]'
            _write('>')
            _tmp3 = question[0]
            _tmp = _tmp3
            if (_tmp.__class__ not in (str, unicode, int, float, )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                if ('&' in _tmp):
                    if (';' in _tmp):
                        _tmp = _re_amp.sub('&amp;', _tmp)
                    else:
                        _tmp = _tmp.replace('&', '&amp;')
                if ('<' in _tmp):
                    _tmp = _tmp.replace('<', '&lt;')
                if ('>' in _tmp):
                    _tmp = _tmp.replace('>', '&gt;')
                _write(_tmp)
            _write(u'</a></li>\n        </ul>')
            if (_tmp2 == 0):
                break
            _write(' ')
        _write(u'\n        ')
        attrs = _attrs_71270672
        "join(value('link'),)"
        _write(u'<a')
        _tmp1 = econtext['link']
        if (_tmp1 is _default):
            _tmp1 = u'${link}'
        if ((_tmp1 is not None) and (_tmp1 is not False)):
            if (_tmp1.__class__ not in (str, unicode, int, float, )):
                _tmp1 = unicode(_translate(_tmp1, domain=_domain, mapping=None, target_language=target_language, default=None))
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if ('&' in _tmp1):
                if (';' in _tmp1):
                    _tmp1 = _re_amp.sub('&amp;', _tmp1)
                else:
                    _tmp1 = _tmp1.replace('&', '&amp;')
            if ('<' in _tmp1):
                _tmp1 = _tmp1.replace('<', '&lt;')
            if ('>' in _tmp1):
                _tmp1 = _tmp1.replace('>', '&gt;')
            if ('"' in _tmp1):
                _tmp1 = _tmp1.replace('"', '&quot;')
            _write(((' href="' + _tmp1) + '"'))
        _write(u'>submit my test</a>\n      </div>\n    </div>\n  </div>\n</body>\n</html>')
        return _out.getvalue()
    return render
コード例 #32
0
def bind():
    from cPickle import loads as _loads
    _lookup_attr = _loads('cchameleon.core.codegen\nlookup_attr\np1\n.')
    _attrs_4362880848 = _loads('(dp1\nVlanguage\np2\nVjavascript\np3\ns.')
    _init_scope = _loads('cchameleon.core.utils\necontext\np1\n.')
    _re_amp = _loads(
        "cre\n_compile\np1\n(S'&(?!([A-Za-z]+|#[0-9]+);)'\np2\nI0\ntRp3\n.")
    _attrs_4362881360 = _loads(
        '(dp1\nVclass\np2\nVui-icon ui-icon-circle-plus\np3\ns.')
    _attrs_4362880976 = _loads('(dp1\n.')
    _attrs_4362880592 = _loads('(dp1\nVtype\np2\nVtext/javascript\np3\ns.')
    _attrs_4362880016 = _loads('(dp1\n.')
    _attrs_4362881168 = _loads(
        '(dp1\nVclass\np2\nVui-widget-header ui-widget-link ui-corner-all\np3\ns.'
    )
    _init_stream = _loads(
        'cchameleon.core.generation\ninitialize_stream\np1\n.')
    _attrs_4362880912 = _loads('(dp1\n.')
    _attrs_4362880208 = _loads('(dp1\n.')
    _attrs_4362880528 = _loads('(dp1\nVrel\np2\nVstylesheet\np3\ns.')
    _init_default = _loads(
        'cchameleon.core.generation\ninitialize_default\np1\n.')
    _attrs_4362880720 = _loads('(dp1\n.')
    _attrs_4362880464 = _loads('(dp1\nVrel\np2\nVstylesheet\np3\ns.')
    _attrs_4362880400 = _loads('(dp1\n.')
    _init_tal = _loads('cchameleon.core.generation\ninitialize_tal\np1\n.')

    def render(econtext, rcontext=None):
        macros = econtext.get('macros')
        _translate = econtext.get('_translate')
        _slots = econtext.get('_slots')
        target_language = econtext.get('target_language')
        u'_init_stream()'
        (
            _out,
            _write,
        ) = _init_stream()
        u'_init_tal()'
        (
            _attributes,
            repeat,
        ) = _init_tal()
        u'_init_default()'
        _default = _init_default()
        u'None'
        default = None
        u'None'
        _domain = None
        attrs = _attrs_4362880208
        _write(u'<html>\n  ')
        attrs = _attrs_4362880016
        _write(u'<head>\n      ')
        attrs = _attrs_4362880464
        u"request.static_url('fa.jquery:jquery-ui/css/smoothness/jquery-ui-1.8.8.custom.css')"
        _write(u'<link rel="stylesheet"')
        _tmp1 = _lookup_attr(econtext['request'], 'static_url')(
            'fa.jquery:jquery-ui/css/smoothness/jquery-ui-1.8.8.custom.css')
        if (_tmp1 is _default):
            _tmp1 = None
        if ((_tmp1 is not None) and (_tmp1 is not False)):
            if (_tmp1.__class__ not in (
                    str,
                    unicode,
                    int,
                    float,
            )):
                _tmp1 = unicode(
                    _translate(_tmp1,
                               domain=_domain,
                               mapping=None,
                               target_language=target_language,
                               default=None))
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if ('&' in _tmp1):
                if (';' in _tmp1):
                    _tmp1 = _re_amp.sub('&amp;', _tmp1)
                else:
                    _tmp1 = _tmp1.replace('&', '&amp;')
            if ('<' in _tmp1):
                _tmp1 = _tmp1.replace('<', '&lt;')
            if ('>' in _tmp1):
                _tmp1 = _tmp1.replace('>', '&gt;')
            if ('"' in _tmp1):
                _tmp1 = _tmp1.replace('"', '&quot;')
            _write(((' href="' + _tmp1) + '"'))
        _write(u' />\n      ')
        attrs = _attrs_4362880528
        u"request.static_url('fa.jquery:jquery-ui/fa.jquery.min.css')"
        _write(u'<link rel="stylesheet"')
        _tmp1 = _lookup_attr(
            econtext['request'],
            'static_url')('fa.jquery:jquery-ui/fa.jquery.min.css')
        if (_tmp1 is _default):
            _tmp1 = None
        if ((_tmp1 is not None) and (_tmp1 is not False)):
            if (_tmp1.__class__ not in (
                    str,
                    unicode,
                    int,
                    float,
            )):
                _tmp1 = unicode(
                    _translate(_tmp1,
                               domain=_domain,
                               mapping=None,
                               target_language=target_language,
                               default=None))
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if ('&' in _tmp1):
                if (';' in _tmp1):
                    _tmp1 = _re_amp.sub('&amp;', _tmp1)
                else:
                    _tmp1 = _tmp1.replace('&', '&amp;')
            if ('<' in _tmp1):
                _tmp1 = _tmp1.replace('<', '&lt;')
            if ('>' in _tmp1):
                _tmp1 = _tmp1.replace('>', '&gt;')
            if ('"' in _tmp1):
                _tmp1 = _tmp1.replace('"', '&quot;')
            _write(((' href="' + _tmp1) + '"'))
        _write(u' />\n      ')
        attrs = _attrs_4362880592
        u"request.static_url('fa.jquery:jquery-ui/fa.jquery.min.js')"
        _write(u'<script type="text/javascript"')
        _tmp1 = _lookup_attr(
            econtext['request'],
            'static_url')('fa.jquery:jquery-ui/fa.jquery.min.js')
        if (_tmp1 is _default):
            _tmp1 = None
        if ((_tmp1 is not None) and (_tmp1 is not False)):
            if (_tmp1.__class__ not in (
                    str,
                    unicode,
                    int,
                    float,
            )):
                _tmp1 = unicode(
                    _translate(_tmp1,
                               domain=_domain,
                               mapping=None,
                               target_language=target_language,
                               default=None))
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if ('&' in _tmp1):
                if (';' in _tmp1):
                    _tmp1 = _re_amp.sub('&amp;', _tmp1)
                else:
                    _tmp1 = _tmp1.replace('&', '&amp;')
            if ('<' in _tmp1):
                _tmp1 = _tmp1.replace('<', '&lt;')
            if ('>' in _tmp1):
                _tmp1 = _tmp1.replace('>', '&gt;')
            if ('"' in _tmp1):
                _tmp1 = _tmp1.replace('"', '&quot;')
            _write(((' src="' + _tmp1) + '"'))
        _write(u'></script>\n  </head>\n  ')
        attrs = _attrs_4362880400
        _write(u'<body>\n    ')
        attrs = _attrs_4362880720
        _write(u'<div>\n      ')
        attrs = _attrs_4362880848
        u"''"
        _write(
            u'<script language="javascript">\n        var USE_POPUP = false;\n      </script>\n      '
        )
        _default.value = default = ''
        u"fs.render(renderer='fa.jquery:templates/forms/jqgrid.pt', request=request)"
        _content = _lookup_attr(econtext['fs'], 'render')(
            renderer='fa.jquery:templates/forms/jqgrid.pt',
            request=econtext['request'])
        attrs = _attrs_4362880912
        u'_content'
        _write(u'<div>')
        _tmp1 = _content
        _tmp = _tmp1
        if (_tmp.__class__ not in (
                str,
                unicode,
                int,
                float,
        )):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp,
                                  domain=_domain,
                                  mapping=None,
                                  target_language=target_language,
                                  default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if (_tmp is not None):
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            _write(_tmp)
        _write(u'</div>\n      ')
        attrs = _attrs_4362880976
        _write(u'<p>\n        ')
        attrs = _attrs_4362881168
        u"request.route_url(request.route_name, traverse='%s/new' % request.model_name)"
        _write(u'<a class="ui-widget-header ui-widget-link ui-corner-all"')
        _tmp1 = _lookup_attr(econtext['request'], 'route_url')(
            _lookup_attr(econtext['request'], 'route_name'),
            traverse=('%s/new' %
                      _lookup_attr(econtext['request'], 'model_name')))
        if (_tmp1 is _default):
            _tmp1 = None
        if ((_tmp1 is not None) and (_tmp1 is not False)):
            if (_tmp1.__class__ not in (
                    str,
                    unicode,
                    int,
                    float,
            )):
                _tmp1 = unicode(
                    _translate(_tmp1,
                               domain=_domain,
                               mapping=None,
                               target_language=target_language,
                               default=None))
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if ('&' in _tmp1):
                if (';' in _tmp1):
                    _tmp1 = _re_amp.sub('&amp;', _tmp1)
                else:
                    _tmp1 = _tmp1.replace('&', '&amp;')
            if ('<' in _tmp1):
                _tmp1 = _tmp1.replace('<', '&lt;')
            if ('>' in _tmp1):
                _tmp1 = _tmp1.replace('>', '&gt;')
            if ('"' in _tmp1):
                _tmp1 = _tmp1.replace('"', '&quot;')
            _write(((' href="' + _tmp1) + '"'))
        _write(u'>\n            ')
        attrs = _attrs_4362881360
        u"F_('New')"
        _write(
            u'<span class="ui-icon ui-icon-circle-plus"></span>\n            ')
        _tmp1 = econtext['F_']('New')
        _tmp = _tmp1
        if (_tmp.__class__ not in (
                str,
                unicode,
                int,
                float,
        )):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp,
                                  domain=_domain,
                                  mapping=None,
                                  target_language=target_language,
                                  default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if (_tmp is not None):
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            if ('&' in _tmp):
                if (';' in _tmp):
                    _tmp = _re_amp.sub('&amp;', _tmp)
                else:
                    _tmp = _tmp.replace('&', '&amp;')
            if ('<' in _tmp):
                _tmp = _tmp.replace('<', '&lt;')
            if ('>' in _tmp):
                _tmp = _tmp.replace('>', '&gt;')
            _write(_tmp)
        u'model_name'
        _write(u' ')
        _tmp1 = econtext['model_name']
        _tmp = _tmp1
        if (_tmp.__class__ not in (
                str,
                unicode,
                int,
                float,
        )):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp,
                                  domain=_domain,
                                  mapping=None,
                                  target_language=target_language,
                                  default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if (_tmp is not None):
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            if ('&' in _tmp):
                if (';' in _tmp):
                    _tmp = _re_amp.sub('&amp;', _tmp)
                else:
                    _tmp = _tmp.replace('&', '&amp;')
            if ('<' in _tmp):
                _tmp = _tmp.replace('<', '&lt;')
            if ('>' in _tmp):
                _tmp = _tmp.replace('>', '&gt;')
            _write(_tmp)
        _write(u'\n        </a>\n      </p>\n    </div>\n  </body>\n</html>')
        return _out.getvalue()

    return render
コード例 #33
0
def bind():
    from cPickle import loads as _loads
    _lookup_attr = _loads('cchameleon.core.codegen\nlookup_attr\np1\n.')
    _init_scope = _loads('cchameleon.core.utils\necontext\np1\n.')
    _re_amp = _loads("cre\n_compile\np1\n(S'&(?!([A-Za-z]+|#[0-9]+);)'\np2\nI0\ntRp3\n.")
    _attrs_4355399760 = _loads('(dp1\n.')
    _attrs_4355400208 = _loads('(dp1\nVclass\np2\nVfa_instructions ui-corner-all\np3\ns.')
    _attrs_4355399888 = _loads('(dp1\n.')
    _attrs_4355400144 = _loads('(dp1\nVclass\np2\nVlabel\np3\ns.')
    _init_stream = _loads('cchameleon.core.generation\ninitialize_stream\np1\n.')
    _init_default = _loads('cchameleon.core.generation\ninitialize_default\np1\n.')
    _attrs_4355400400 = _loads('(dp1\nVclass\np2\nVui-state-error ui-corner-all\np3\ns.')
    _attrs_4355400080 = _loads('(dp1\n.')
    _attrs_4355400464 = _loads('(dp1\nVclass\np2\nVfield_input\np3\ns.')
    _attrs_4355400528 = _loads('(dp1\n.')
    _attrs_4355400016 = _loads('(dp1\nVclass\np2\nVfa_field ui-widget\np3\ns.')
    _init_tal = _loads('cchameleon.core.generation\ninitialize_tal\np1\n.')
    _attrs_4355400272 = _loads('(dp1\n.')
    def render(econtext, rcontext=None):
        macros = econtext.get('macros')
        _translate = econtext.get('_translate')
        _slots = econtext.get('_slots')
        target_language = econtext.get('target_language')
        u'_init_stream()'
        (_out, _write, ) = _init_stream()
        u'_init_tal()'
        (_attributes, repeat, ) = _init_tal()
        u'_init_default()'
        _default = _init_default()
        u'None'
        default = None
        u'None'
        _domain = None
        u'False'
        focus_rendered = False
        u'fieldset.errors.get(None, False)'
        _write(u'\n')
        _tmp1 = _lookup_attr(_lookup_attr(econtext['fieldset'], 'errors'), 'get')(None, False)
        if _tmp1:
            pass
            attrs = _attrs_4355399760
            u"''"
            _write(u'<div>\n  ')
            _default.value = default = ''
            u'fieldset.error.get(None)'
            _tmp1 = _lookup_attr(_lookup_attr(econtext['fieldset'], 'error'), 'get')(None)
            error = None
            (_tmp1, _tmp2, ) = repeat.insert('error', _tmp1)
            for error in _tmp1:
                _tmp2 = (_tmp2 - 1)
                u'error'
                _content = error
                attrs = _attrs_4355399888
                u'_content'
                _write(u'<div>')
                _tmp3 = _content
                _tmp = _tmp3
                if (_tmp.__class__ not in (str, unicode, int, float, )):
                    try:
                        _tmp = _tmp.__html__
                    except:
                        _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                    else:
                        _tmp = _tmp()
                        _write(_tmp)
                        _tmp = None
                if (_tmp is not None):
                    if not isinstance(_tmp, unicode):
                        _tmp = str(_tmp)
                    if ('&' in _tmp):
                        if (';' in _tmp):
                            _tmp = _re_amp.sub('&amp;', _tmp)
                        else:
                            _tmp = _tmp.replace('&', '&amp;')
                    if ('<' in _tmp):
                        _tmp = _tmp.replace('<', '&lt;')
                    if ('>' in _tmp):
                        _tmp = _tmp.replace('>', '&gt;')
                    _write(_tmp)
                _write(u'</div>')
                if (_tmp2 == 0):
                    break
                _write(' ')
            _write(u'\n</div>')
        u'fieldset.render_fields.itervalues()'
        _write(u'\n\n')
        _tmp1 = _lookup_attr(_lookup_attr(econtext['fieldset'], 'render_fields'), 'itervalues')()
        field = None
        (_tmp1, _tmp2, ) = repeat.insert('field', _tmp1)
        for field in _tmp1:
            _tmp2 = (_tmp2 - 1)
            _write(u'\n  ')
            attrs = _attrs_4355400016
            u'field.requires_label'
            _write(u'<div class="fa_field ui-widget">\n    ')
            _tmp3 = _lookup_attr(field, 'requires_label')
            if _tmp3:
                pass
                attrs = _attrs_4355400144
                u"''"
                _write(u'<div class="label">\n      ')
                _default.value = default = ''
                u'isinstance(field.type, fatypes.Boolean)'
                _tmp3 = isinstance(_lookup_attr(field, 'type'), _lookup_attr(econtext['fatypes'], 'Boolean'))
                if _tmp3:
                    pass
                    u'field.render()'
                    _content = _lookup_attr(field, 'render')()
                    attrs = _attrs_4355400272
                    u'_content'
                    _write(u'<div>')
                    _tmp3 = _content
                    _tmp = _tmp3
                    if (_tmp.__class__ not in (str, unicode, int, float, )):
                        try:
                            _tmp = _tmp.__html__
                        except:
                            _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                        else:
                            _tmp = _tmp()
                            _write(_tmp)
                            _tmp = None
                    if (_tmp is not None):
                        if not isinstance(_tmp, unicode):
                            _tmp = str(_tmp)
                        _write(_tmp)
                    _write(u'</div>')
                u"''"
                _write(u'\n      ')
                _default.value = default = ''
                u'field.label_tag()'
                _content = _lookup_attr(field, 'label_tag')()
                u'_content'
                _tmp3 = _content
                _tmp = _tmp3
                if (_tmp.__class__ not in (str, unicode, int, float, )):
                    try:
                        _tmp = _tmp.__html__
                    except:
                        _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                    else:
                        _tmp = _tmp()
                        _write(_tmp)
                        _tmp = None
                if (_tmp is not None):
                    if not isinstance(_tmp, unicode):
                        _tmp = str(_tmp)
                    _write(_tmp)
                _write(u'\n    </div>')
            u"u'\\n    '"
            _write(u'\n    ')
            _default.value = default = u'\n    '
            u"'instructions' in field.metadata"
            _tmp3 = ('instructions' in _lookup_attr(field, 'metadata'))
            if _tmp3:
                pass
                u"field.metadata['instructions']"
                _content = _lookup_attr(field, 'metadata')['instructions']
                attrs = _attrs_4355400208
                u'_content'
                _write(u'<div class="fa_instructions ui-corner-all">')
                _tmp3 = _content
                _tmp = _tmp3
                if (_tmp.__class__ not in (str, unicode, int, float, )):
                    try:
                        _tmp = _tmp.__html__
                    except:
                        _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                    else:
                        _tmp = _tmp()
                        _write(_tmp)
                        _tmp = None
                if (_tmp is not None):
                    if not isinstance(_tmp, unicode):
                        _tmp = str(_tmp)
                    if ('&' in _tmp):
                        if (';' in _tmp):
                            _tmp = _re_amp.sub('&amp;', _tmp)
                        else:
                            _tmp = _tmp.replace('&', '&amp;')
                    if ('<' in _tmp):
                        _tmp = _tmp.replace('<', '&lt;')
                    if ('>' in _tmp):
                        _tmp = _tmp.replace('>', '&gt;')
                    _write(_tmp)
                _write(u'</div>')
            u'field.errors'
            _write(u'\n    ')
            _tmp3 = _lookup_attr(field, 'errors')
            if _tmp3:
                pass
                attrs = _attrs_4355400400
                u"''"
                _write(u'<div class="ui-state-error ui-corner-all">\n      ')
                _default.value = default = ''
                u'field.errors'
                _tmp3 = _lookup_attr(field, 'errors')
                error = None
                (_tmp3, _tmp4, ) = repeat.insert('error', _tmp3)
                for error in _tmp3:
                    _tmp4 = (_tmp4 - 1)
                    u'error'
                    _content = error
                    attrs = _attrs_4355400528
                    u'_content'
                    _write(u'<div>')
                    _tmp5 = _content
                    _tmp = _tmp5
                    if (_tmp.__class__ not in (str, unicode, int, float, )):
                        try:
                            _tmp = _tmp.__html__
                        except:
                            _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                        else:
                            _tmp = _tmp()
                            _write(_tmp)
                            _tmp = None
                    if (_tmp is not None):
                        if not isinstance(_tmp, unicode):
                            _tmp = str(_tmp)
                        if ('&' in _tmp):
                            if (';' in _tmp):
                                _tmp = _re_amp.sub('&amp;', _tmp)
                            else:
                                _tmp = _tmp.replace('&', '&amp;')
                        if ('<' in _tmp):
                            _tmp = _tmp.replace('<', '&lt;')
                        if ('>' in _tmp):
                            _tmp = _tmp.replace('>', '&gt;')
                        _write(_tmp)
                    _write(u'</div>')
                    if (_tmp4 == 0):
                        break
                    _write(' ')
                _write(u'\n    </div>')
            u"''"
            _write(u'\n    ')
            _default.value = default = ''
            u'not isinstance(field.type, fatypes.Boolean)'
            _tmp3 = not isinstance(_lookup_attr(field, 'type'), _lookup_attr(econtext['fatypes'], 'Boolean'))
            if _tmp3:
                pass
                u'field.render()'
                _content = _lookup_attr(field, 'render')()
                attrs = _attrs_4355400464
                u'_content'
                _write(u'<div class="field_input">')
                _tmp3 = _content
                _tmp = _tmp3
                if (_tmp.__class__ not in (str, unicode, int, float, )):
                    try:
                        _tmp = _tmp.__html__
                    except:
                        _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                    else:
                        _tmp = _tmp()
                        _write(_tmp)
                        _tmp = None
                if (_tmp is not None):
                    if not isinstance(_tmp, unicode):
                        _tmp = str(_tmp)
                    _write(_tmp)
                _write(u'</div>')
            u'not field.is_readonly() and (fieldset.focus == field or fieldset.focus is True) and not focus_rendered'
            _write(u'\n  </div>\n  ')
            _tmp3 = (not _lookup_attr(field, 'is_readonly')() and ((_lookup_attr(econtext['fieldset'], 'focus') == field) or (_lookup_attr(econtext['fieldset'], 'focus') is True)) and not focus_rendered)
            if _tmp3:
                pass
                attrs = _attrs_4355400080
                u'True'
                _write(u'<script>\n    ')
                focus_rendered = True
                u'field.renderer.name'
                _write(u'\n    jQuery(document).ready(function(){jQuery("[name=\'')
                _tmp3 = _lookup_attr(_lookup_attr(field, 'renderer'), 'name')
                _tmp = _tmp3
                if (_tmp.__class__ not in (str, unicode, int, float, )):
                    try:
                        _tmp = _tmp.__html__
                    except:
                        _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                    else:
                        _tmp = _tmp()
                        _write(_tmp)
                        _tmp = None
                if (_tmp is not None):
                    if not isinstance(_tmp, unicode):
                        _tmp = str(_tmp)
                    if ('&' in _tmp):
                        if (';' in _tmp):
                            _tmp = _re_amp.sub('&amp;', _tmp)
                        else:
                            _tmp = _tmp.replace('&', '&amp;')
                    if ('<' in _tmp):
                        _tmp = _tmp.replace('<', '&lt;')
                    if ('>' in _tmp):
                        _tmp = _tmp.replace('>', '&gt;')
                    _write(_tmp)
                _write(u'\']").focus();});\n  </script>')
            _write(u'\n')
            if (_tmp2 == 0):
                break
            _write(' ')
        _write(u'')
        return _out.getvalue()
    return render
コード例 #34
0
def bind():
    from cPickle import loads as _loads
    _lookup_attr = _loads('cchameleon.core.codegen\nlookup_attr\np1\n.')
    _init_scope = _loads('cchameleon.core.utils\necontext\np1\n.')
    _re_amp = _loads(
        "cre\n_compile\np1\n(S'&(?!([A-Za-z]+|#[0-9]+);)'\np2\nI0\ntRp3\n.")
    _init_stream = _loads(
        'cchameleon.core.generation\ninitialize_stream\np1\n.')
    _attrs_4367930128 = _loads('(dp1\n.')
    _init_default = _loads(
        'cchameleon.core.generation\ninitialize_default\np1\n.')
    _attrs_4367954576 = _loads('(dp1\nVclass\np2\nVfa_controls\np3\ns.')
    _attrs_4367955536 = _loads('(dp1\n.')
    _attrs_4327384016 = _loads('(dp1\n.')
    _init_tal = _loads('cchameleon.core.generation\ninitialize_tal\np1\n.')

    def render(econtext, rcontext=None):
        macros = econtext.get('macros')
        _translate = econtext.get('_translate')
        _slots = econtext.get('_slots')
        target_language = econtext.get('target_language')
        u'_init_stream()'
        (
            _out,
            _write,
        ) = _init_stream()
        u'_init_tal()'
        (
            _attributes,
            repeat,
        ) = _init_tal()
        u'_init_default()'
        _default = _init_default()
        u'None'
        default = None
        u'None'
        _domain = None
        u"main.macros['master']"
        _metal = _lookup_attr(econtext['main'], 'macros')['master']

        def _callback_javascript(econtext,
                                 _repeat,
                                 _out=_out,
                                 _write=_write,
                                 _domain=_domain,
                                 **_ignored):
            if _repeat:
                repeat.update(_repeat)
            attrs = _attrs_4367930128
            u"request.registry.settings.get('fa.use_popup') and 'true' or 'false'"
            _write(u'<script>\n      var USE_POPUP = ')
            _tmp1 = ((_lookup_attr(
                _lookup_attr(_lookup_attr(econtext['request'], 'registry'),
                             'settings'), 'get')('fa.use_popup') and 'true')
                     or 'false')
            _tmp = _tmp1
            if (_tmp.__class__ not in (
                    str,
                    unicode,
                    int,
                    float,
            )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp,
                                      domain=_domain,
                                      mapping=None,
                                      target_language=target_language,
                                      default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                if ('&' in _tmp):
                    if (';' in _tmp):
                        _tmp = _re_amp.sub('&amp;', _tmp)
                    else:
                        _tmp = _tmp.replace('&', '&amp;')
                if ('<' in _tmp):
                    _tmp = _tmp.replace('<', '&lt;')
                if ('>' in _tmp):
                    _tmp = _tmp.replace('>', '&gt;')
                _write(_tmp)
            _write(u';\n    </script>\n')

        def _callback_main(econtext,
                           _repeat,
                           _out=_out,
                           _write=_write,
                           _domain=_domain,
                           **_ignored):
            if _repeat:
                repeat.update(_repeat)
            attrs = _attrs_4327384016
            u"''"
            _write(u'<div>\n      ')
            _default.value = default = ''
            u"fs.render(renderer='fa.jquery:templates/forms/jqgrid.pt', request=request)"
            _content = _lookup_attr(econtext['fs'], 'render')(
                renderer='fa.jquery:templates/forms/jqgrid.pt',
                request=econtext['request'])
            attrs = _attrs_4367955536
            u'_content'
            _write(u'<div>')
            _tmp1 = _content
            _tmp = _tmp1
            if (_tmp.__class__ not in (
                    str,
                    unicode,
                    int,
                    float,
            )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp,
                                      domain=_domain,
                                      mapping=None,
                                      target_language=target_language,
                                      default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                _write(_tmp)
            u"u'\\n      '"
            _write(u'</div>\n      ')
            _default.value = default = u'\n      '
            u'actions.buttons(request)'
            _content = _lookup_attr(econtext['actions'],
                                    'buttons')(econtext['request'])
            attrs = _attrs_4367954576
            u'_content'
            _write(u'<div class="fa_controls">')
            _tmp1 = _content
            _tmp = _tmp1
            if (_tmp.__class__ not in (
                    str,
                    unicode,
                    int,
                    float,
            )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp,
                                      domain=_domain,
                                      mapping=None,
                                      target_language=target_language,
                                      default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                _write(_tmp)
            _write(u'</div>\n    </div>\n')

        u"{'main': _callback_main, 'javascript': _callback_javascript}"
        _tmp = {
            'main': _callback_main,
            'javascript': _callback_javascript,
        }
        u"main.macros['master']"
        _metal.render(_tmp,
                      _out=_out,
                      _write=_write,
                      _domain=_domain,
                      econtext=econtext)
        return _out.getvalue()

    return render
コード例 #35
0
def bind():
    from cPickle import loads as _loads
    _lookup_attr = _loads('cchameleon.core.codegen\nlookup_attr\np1\n.')
    _attrs_4365540624 = _loads('(dp1\nVtype\np2\nVtext/javascript\np3\ns.')
    _re_amp = _loads(
        "cre\n_compile\np1\n(S'&(?!([A-Za-z]+|#[0-9]+);)'\np2\nI0\ntRp3\n.")
    _attrs_4365540432 = _loads('(dp1\nVrel\np2\nVstylesheet\np3\ns.')
    _attrs_4365540048 = _loads('(dp1\n.')
    _init_stream = _loads(
        'cchameleon.core.generation\ninitialize_stream\np1\n.')
    _attrs_4365540496 = _loads('(dp1\nVtype\np2\nVtext/javascript\np3\ns.')
    _attrs_4365539984 = _loads('(dp1\n.')
    _attrs_4365540304 = _loads('(dp1\n.')
    _attrs_4365541136 = _loads('(dp1\n.')
    _init_default = _loads(
        'cchameleon.core.generation\ninitialize_default\np1\n.')
    _attrs_4365553744 = _loads('(dp1\n.')
    _attrs_4365540368 = _loads('(dp1\nVrel\np2\nVstylesheet\np3\ns.')
    _attrs_4365540688 = _loads('(dp1\nVtype\np2\nVtext/css\np3\ns.')
    _init_tal = _loads('cchameleon.core.generation\ninitialize_tal\np1\n.')
    _attrs_4365541072 = _loads('(dp1\nVclass\np2\nVbreadcrumb\np3\ns.')
    _attrs_4365540816 = _loads(
        '(dp1\nVid\np2\nVcontent\np3\nsVclass\np4\nVui-admin ui-widget\np5\ns.'
    )
    _attrs_4365540944 = _loads(
        '(dp1\nVid\np2\nVheader\np3\nsVclass\np4\nVui-widget-header ui-corner-all\np5\ns.'
    )
    _attrs_4365554000 = _loads(
        '(dp1\nVstyle\np2\nVdisplay:none\np3\nsVclass\np4\nVroot_url\np5\ns.')
    _init_scope = _loads('cchameleon.core.utils\necontext\np1\n.')
    _attrs_4365541264 = _loads('(dp1\n.')
    _attrs_4365541008 = _loads('(dp1\n.')
    _attrs_4365541200 = _loads(
        '(dp1\nVstyle\np2\nVdisplay:none;\np3\nsVid\np4\nVmodels\np5\ns.')
    _attrs_4365540112 = _loads('(dp1\n.')
    _attrs_4365540560 = _loads('(dp1\nVtype\np2\nVtext/javascript\np3\ns.')
    _attrs_4365553808 = _loads('(dp1\n.')

    def render(econtext, rcontext=None):
        macros = econtext.get('macros')
        _translate = econtext.get('_translate')
        _slots = econtext.get('_slots')
        target_language = econtext.get('target_language')
        u"%(scope)s['%(out)s'], %(scope)s['%(write)s']"
        (
            _out,
            _write,
        ) = (
            econtext['_out'],
            econtext['_write'],
        )
        u'_init_tal()'
        (
            _attributes,
            repeat,
        ) = _init_tal()
        u'_init_default()'
        _default = _init_default()
        u'None'
        default = None
        u'None'
        _domain = None
        attrs = _attrs_4365540048
        _write(u'<html>\n    ')
        attrs = _attrs_4365539984
        u"''"
        _write(u'<head>\n      ')
        _default.value = default = ''
        u"request.model_name or 'Models index'"
        _content = (_lookup_attr(econtext['request'], 'model_name')
                    or 'Models index')
        attrs = _attrs_4365540304
        u'_content'
        _write(u'<title>')
        _tmp1 = _content
        _tmp = _tmp1
        if (_tmp.__class__ not in (
                str,
                unicode,
                int,
                float,
        )):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp,
                                  domain=_domain,
                                  mapping=None,
                                  target_language=target_language,
                                  default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if (_tmp is not None):
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            if ('&' in _tmp):
                if (';' in _tmp):
                    _tmp = _re_amp.sub('&amp;', _tmp)
                else:
                    _tmp = _tmp.replace('&', '&amp;')
            if ('<' in _tmp):
                _tmp = _tmp.replace('<', '&lt;')
            if ('>' in _tmp):
                _tmp = _tmp.replace('>', '&gt;')
            _write(_tmp)
        _write(u'</title>\n      ')
        attrs = _attrs_4365540368
        u"request.static_url('fa.jquery:jquery-ui/css/smoothness/jquery-ui-1.8.8.custom.css')"
        _write(u'<link rel="stylesheet"')
        _tmp1 = _lookup_attr(econtext['request'], 'static_url')(
            'fa.jquery:jquery-ui/css/smoothness/jquery-ui-1.8.8.custom.css')
        if (_tmp1 is _default):
            _tmp1 = None
        if ((_tmp1 is not None) and (_tmp1 is not False)):
            if (_tmp1.__class__ not in (
                    str,
                    unicode,
                    int,
                    float,
            )):
                _tmp1 = unicode(
                    _translate(_tmp1,
                               domain=_domain,
                               mapping=None,
                               target_language=target_language,
                               default=None))
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if ('&' in _tmp1):
                if (';' in _tmp1):
                    _tmp1 = _re_amp.sub('&amp;', _tmp1)
                else:
                    _tmp1 = _tmp1.replace('&', '&amp;')
            if ('<' in _tmp1):
                _tmp1 = _tmp1.replace('<', '&lt;')
            if ('>' in _tmp1):
                _tmp1 = _tmp1.replace('>', '&gt;')
            if ('"' in _tmp1):
                _tmp1 = _tmp1.replace('"', '&quot;')
            _write(((' href="' + _tmp1) + '"'))
        _write(u' />\n      ')
        attrs = _attrs_4365540432
        u"request.static_url('fa.jquery:jquery-ui/fa.jquery.min.css')"
        _write(u'<link rel="stylesheet"')
        _tmp1 = _lookup_attr(
            econtext['request'],
            'static_url')('fa.jquery:jquery-ui/fa.jquery.min.css')
        if (_tmp1 is _default):
            _tmp1 = None
        if ((_tmp1 is not None) and (_tmp1 is not False)):
            if (_tmp1.__class__ not in (
                    str,
                    unicode,
                    int,
                    float,
            )):
                _tmp1 = unicode(
                    _translate(_tmp1,
                               domain=_domain,
                               mapping=None,
                               target_language=target_language,
                               default=None))
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if ('&' in _tmp1):
                if (';' in _tmp1):
                    _tmp1 = _re_amp.sub('&amp;', _tmp1)
                else:
                    _tmp1 = _tmp1.replace('&', '&amp;')
            if ('<' in _tmp1):
                _tmp1 = _tmp1.replace('<', '&lt;')
            if ('>' in _tmp1):
                _tmp1 = _tmp1.replace('>', '&gt;')
            if ('"' in _tmp1):
                _tmp1 = _tmp1.replace('"', '&quot;')
            _write(((' href="' + _tmp1) + '"'))
        _write(u' />\n      ')
        attrs = _attrs_4365540496
        u"request.static_url('fa.jquery:jquery-ui/fa.jquery.min.js')"
        _write(u'<script type="text/javascript"')
        _tmp1 = _lookup_attr(
            econtext['request'],
            'static_url')('fa.jquery:jquery-ui/fa.jquery.min.js')
        if (_tmp1 is _default):
            _tmp1 = None
        if ((_tmp1 is not None) and (_tmp1 is not False)):
            if (_tmp1.__class__ not in (
                    str,
                    unicode,
                    int,
                    float,
            )):
                _tmp1 = unicode(
                    _translate(_tmp1,
                               domain=_domain,
                               mapping=None,
                               target_language=target_language,
                               default=None))
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if ('&' in _tmp1):
                if (';' in _tmp1):
                    _tmp1 = _re_amp.sub('&amp;', _tmp1)
                else:
                    _tmp1 = _tmp1.replace('&', '&amp;')
            if ('<' in _tmp1):
                _tmp1 = _tmp1.replace('<', '&lt;')
            if ('>' in _tmp1):
                _tmp1 = _tmp1.replace('>', '&gt;')
            if ('"' in _tmp1):
                _tmp1 = _tmp1.replace('"', '&quot;')
            _write(((' src="' + _tmp1) + '"'))
        _write(u'></script>\n      ')
        attrs = _attrs_4365540560
        u"%(slots)s.get(u'javascript')"
        _write(
            u'<script type="text/javascript">\n        jQuery(document).ready(function() {\n          $(\'select#models\')\n            .change(function() { window.location.href = $(this).val(); })\n            .selectmenu({\'style\':\'dropdown\', \'menuWidth\':\'20%\', \'width\':\'100%\'});\n        });\n      </script>\n      '
        )
        _tmp = _slots.get(u'javascript')
        u'%(tmp)s is not None'
        _tmp1 = (_tmp is not None)
        if _tmp1:
            pass
            u'isinstance(%(tmp)s, basestring)'
            _tmp2 = isinstance(_tmp, basestring)
            if not _tmp2:
                pass
                econtext.update(dict(rcontext=rcontext, _domain=_domain))
                _tmp(econtext, repeat)
            else:
                pass
                u'%(tmp)s'
                _tmp2 = _tmp
                _tmp = _tmp2
                if (_tmp.__class__ not in (
                        str,
                        unicode,
                        int,
                        float,
                )):
                    try:
                        _tmp = _tmp.__html__
                    except:
                        _tmp = _translate(_tmp,
                                          domain=_domain,
                                          mapping=None,
                                          target_language=target_language,
                                          default=None)
                    else:
                        _tmp = _tmp()
                        _write(_tmp)
                        _tmp = None
                if (_tmp is not None):
                    if not isinstance(_tmp, unicode):
                        _tmp = str(_tmp)
                    _write(_tmp)
        else:
            pass
            attrs = _attrs_4365540624
            _write(u'<script type="text/javascript"></script>')
        _write(u'\n      ')
        attrs = _attrs_4365540688
        _write(
            u'<style type="text/css">\n        label {font-weight:bold;}\n        h1, h3 {padding:0.1 0.3em;}\n        h1 a, h3 a {text-decoration:none;}\n        #header { height: 2em; font-size:1.5em; }\n        #header div { font-size:1.5em; }\n        #header a { font-size:1em; }\n        div.breadcrumb {float:right;width:20%;margin-right:20px;}\n        div.breadcrumb a {text-decoration:none;}\n        h1 a.ui-selectmenu {height:1em;}\n        a.ui-state-default {padding:0.1em 0.3em;}\n        a.fm-button {padding:0.4em 0.5em;}\n        a.fm-button-icon-left {padding-left:1.9em;}\n      </style>\n    </head>\n    '
        )
        attrs = _attrs_4365540112
        _write(u'<body>\n      ')
        attrs = _attrs_4365540816
        _write(u'<div id="content" class="ui-admin ui-widget">\n        ')
        attrs = _attrs_4365540944
        u'request.model_name and breadcrumb'
        _write(
            u'<h1 id="header" class="ui-widget-header ui-corner-all">\n          '
        )
        _tmp1 = (_lookup_attr(econtext['request'], 'model_name')
                 and econtext['breadcrumb'])
        if _tmp1:
            pass
            attrs = _attrs_4365541072
            _write(u'<div class="breadcrumb">\n            ')
            attrs = _attrs_4365541200
            u'breadcrumb'
            _write(u'<select id="models" style="display:none;">\n            ')
            _tmp1 = econtext['breadcrumb']
            item = None
            (
                _tmp1,
                _tmp2,
            ) = repeat.insert('item', _tmp1)
            for item in _tmp1:
                _tmp2 = (_tmp2 - 1)
                u"''"
                _write(u'')
                _default.value = default = ''
                u'item[1]'
                _content = item[1]
                attrs = _attrs_4365553808
                u'item[0]'
                _write(u'<option')
                _tmp3 = item[0]
                if (_tmp3 is _default):
                    _tmp3 = None
                if ((_tmp3 is not None) and (_tmp3 is not False)):
                    if (_tmp3.__class__ not in (
                            str,
                            unicode,
                            int,
                            float,
                    )):
                        _tmp3 = unicode(
                            _translate(_tmp3,
                                       domain=_domain,
                                       mapping=None,
                                       target_language=target_language,
                                       default=None))
                    else:
                        if not isinstance(_tmp3, unicode):
                            _tmp3 = str(_tmp3)
                    if ('&' in _tmp3):
                        if (';' in _tmp3):
                            _tmp3 = _re_amp.sub('&amp;', _tmp3)
                        else:
                            _tmp3 = _tmp3.replace('&', '&amp;')
                    if ('<' in _tmp3):
                        _tmp3 = _tmp3.replace('<', '&lt;')
                    if ('>' in _tmp3):
                        _tmp3 = _tmp3.replace('>', '&gt;')
                    if ('"' in _tmp3):
                        _tmp3 = _tmp3.replace('"', '&quot;')
                    _write(((' value="' + _tmp3) + '"'))
                u' item[2]'
                _tmp3 = item[2]
                if (_tmp3 is _default):
                    _tmp3 = None
                if ((_tmp3 is not None) and (_tmp3 is not False)):
                    if (_tmp3.__class__ not in (
                            str,
                            unicode,
                            int,
                            float,
                    )):
                        _tmp3 = unicode(
                            _translate(_tmp3,
                                       domain=_domain,
                                       mapping=None,
                                       target_language=target_language,
                                       default=None))
                    else:
                        if not isinstance(_tmp3, unicode):
                            _tmp3 = str(_tmp3)
                    if ('&' in _tmp3):
                        if (';' in _tmp3):
                            _tmp3 = _re_amp.sub('&amp;', _tmp3)
                        else:
                            _tmp3 = _tmp3.replace('&', '&amp;')
                    if ('<' in _tmp3):
                        _tmp3 = _tmp3.replace('<', '&lt;')
                    if ('>' in _tmp3):
                        _tmp3 = _tmp3.replace('>', '&gt;')
                    if ('"' in _tmp3):
                        _tmp3 = _tmp3.replace('"', '&quot;')
                    _write(((' class="' + _tmp3) + '"'))
                u'_content'
                _write('>')
                _tmp3 = _content
                _tmp = _tmp3
                if (_tmp.__class__ not in (
                        str,
                        unicode,
                        int,
                        float,
                )):
                    try:
                        _tmp = _tmp.__html__
                    except:
                        _tmp = _translate(_tmp,
                                          domain=_domain,
                                          mapping=None,
                                          target_language=target_language,
                                          default=None)
                    else:
                        _tmp = _tmp()
                        _write(_tmp)
                        _tmp = None
                if (_tmp is not None):
                    if not isinstance(_tmp, unicode):
                        _tmp = str(_tmp)
                    if ('&' in _tmp):
                        if (';' in _tmp):
                            _tmp = _re_amp.sub('&amp;', _tmp)
                        else:
                            _tmp = _tmp.replace('&', '&amp;')
                    if ('<' in _tmp):
                        _tmp = _tmp.replace('<', '&lt;')
                    if ('>' in _tmp):
                        _tmp = _tmp.replace('>', '&gt;')
                    _write(_tmp)
                _write(u'</option>\n            ')
                if (_tmp2 == 0):
                    break
                _write(' ')
            _write(u'\n            </select>\n          </div>')
        u'request.model_name'
        _write(u'\n          ')
        _tmp1 = _lookup_attr(econtext['request'], 'model_name')
        if _tmp1:
            pass
            attrs = _attrs_4365541136
            u"''"
            _write(u'<div>\n            ')
            _default.value = default = ''
            u'request.model_name'
            _content = _lookup_attr(econtext['request'], 'model_name')
            attrs = _attrs_4365553744
            u'request.fa_url(request.model_name)'
            _write(u'<a')
            _tmp1 = _lookup_attr(econtext['request'], 'fa_url')(_lookup_attr(
                econtext['request'], 'model_name'))
            if (_tmp1 is _default):
                _tmp1 = None
            if ((_tmp1 is not None) and (_tmp1 is not False)):
                if (_tmp1.__class__ not in (
                        str,
                        unicode,
                        int,
                        float,
                )):
                    _tmp1 = unicode(
                        _translate(_tmp1,
                                   domain=_domain,
                                   mapping=None,
                                   target_language=target_language,
                                   default=None))
                else:
                    if not isinstance(_tmp1, unicode):
                        _tmp1 = str(_tmp1)
                if ('&' in _tmp1):
                    if (';' in _tmp1):
                        _tmp1 = _re_amp.sub('&amp;', _tmp1)
                    else:
                        _tmp1 = _tmp1.replace('&', '&amp;')
                if ('<' in _tmp1):
                    _tmp1 = _tmp1.replace('<', '&lt;')
                if ('>' in _tmp1):
                    _tmp1 = _tmp1.replace('>', '&gt;')
                if ('"' in _tmp1):
                    _tmp1 = _tmp1.replace('"', '&quot;')
                _write(((' href="' + _tmp1) + '"'))
            u'_content'
            _write('>')
            _tmp1 = _content
            _tmp = _tmp1
            if (_tmp.__class__ not in (
                    str,
                    unicode,
                    int,
                    float,
            )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp,
                                      domain=_domain,
                                      mapping=None,
                                      target_language=target_language,
                                      default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                if ('&' in _tmp):
                    if (';' in _tmp):
                        _tmp = _re_amp.sub('&amp;', _tmp)
                    else:
                        _tmp = _tmp.replace('&', '&amp;')
                if ('<' in _tmp):
                    _tmp = _tmp.replace('<', '&lt;')
                if ('>' in _tmp):
                    _tmp = _tmp.replace('>', '&gt;')
                _write(_tmp)
            u"''"
            _write(u'</a>\n            ')
            _default.value = default = ''
            u"request.model_id and hasattr(request.model_class, '__unicode__')"
            _tmp1 = (_lookup_attr(econtext['request'], 'model_id') and hasattr(
                _lookup_attr(econtext['request'], 'model_class'),
                '__unicode__'))
            if _tmp1:
                pass
                u'request.model_instance'
                _content = _lookup_attr(econtext['request'], 'model_instance')
                u'_content'
                _tmp1 = _content
                _tmp = _tmp1
                if (_tmp.__class__ not in (
                        str,
                        unicode,
                        int,
                        float,
                )):
                    try:
                        _tmp = _tmp.__html__
                    except:
                        _tmp = _translate(_tmp,
                                          domain=_domain,
                                          mapping=None,
                                          target_language=target_language,
                                          default=None)
                    else:
                        _tmp = _tmp()
                        _write(_tmp)
                        _tmp = None
                if (_tmp is not None):
                    if not isinstance(_tmp, unicode):
                        _tmp = str(_tmp)
                    if ('&' in _tmp):
                        if (';' in _tmp):
                            _tmp = _re_amp.sub('&amp;', _tmp)
                        else:
                            _tmp = _tmp.replace('&', '&amp;')
                    if ('<' in _tmp):
                        _tmp = _tmp.replace('<', '&lt;')
                    if ('>' in _tmp):
                        _tmp = _tmp.replace('>', '&gt;')
                    _write(_tmp)
            u"''"
            _write(u'\n            ')
            _default.value = default = ''
            u"request.model_id and not hasattr(request.model_class, '__unicode__')"
            _tmp1 = (_lookup_attr(econtext['request'], 'model_id')
                     and not hasattr(
                         _lookup_attr(econtext['request'], 'model_class'),
                         '__unicode__'))
            if _tmp1:
                pass
                u'request.model_id'
                _content = _lookup_attr(econtext['request'], 'model_id')
                u'_content'
                _tmp1 = _content
                _tmp = _tmp1
                if (_tmp.__class__ not in (
                        str,
                        unicode,
                        int,
                        float,
                )):
                    try:
                        _tmp = _tmp.__html__
                    except:
                        _tmp = _translate(_tmp,
                                          domain=_domain,
                                          mapping=None,
                                          target_language=target_language,
                                          default=None)
                    else:
                        _tmp = _tmp()
                        _write(_tmp)
                        _tmp = None
                if (_tmp is not None):
                    if not isinstance(_tmp, unicode):
                        _tmp = str(_tmp)
                    if ('&' in _tmp):
                        if (';' in _tmp):
                            _tmp = _re_amp.sub('&amp;', _tmp)
                        else:
                            _tmp = _tmp.replace('&', '&amp;')
                    if ('<' in _tmp):
                        _tmp = _tmp.replace('<', '&lt;')
                    if ('>' in _tmp):
                        _tmp = _tmp.replace('>', '&gt;')
                    _write(_tmp)
            _write(u'\n          </div>')
        u'not request.model_name'
        _write(u'\n          ')
        _tmp1 = not _lookup_attr(econtext['request'], 'model_name')
        if _tmp1:
            pass
            attrs = _attrs_4365541264
            _write(u'<div>Models index</div>')
        u"%(slots)s.get(u'main')"
        _write(u'\n        </h1>\n        ')
        _tmp = _slots.get(u'main')
        u'%(tmp)s is not None'
        _tmp1 = (_tmp is not None)
        if _tmp1:
            pass
            u'isinstance(%(tmp)s, basestring)'
            _tmp2 = isinstance(_tmp, basestring)
            if not _tmp2:
                pass
                econtext.update(dict(rcontext=rcontext, _domain=_domain))
                _tmp(econtext, repeat)
            else:
                pass
                u'%(tmp)s'
                _tmp2 = _tmp
                _tmp = _tmp2
                if (_tmp.__class__ not in (
                        str,
                        unicode,
                        int,
                        float,
                )):
                    try:
                        _tmp = _tmp.__html__
                    except:
                        _tmp = _translate(_tmp,
                                          domain=_domain,
                                          mapping=None,
                                          target_language=target_language,
                                          default=None)
                    else:
                        _tmp = _tmp()
                        _write(_tmp)
                        _tmp = None
                if (_tmp is not None):
                    if not isinstance(_tmp, unicode):
                        _tmp = str(_tmp)
                    _write(_tmp)
        else:
            pass
            attrs = _attrs_4365541008
            _write(u'<div>\n        </div>')
        _write(u'\n        ')
        attrs = _attrs_4365554000
        u'request.fa_url()'
        _write(u'<a style="display:none" class="root_url"')
        _tmp1 = _lookup_attr(econtext['request'], 'fa_url')()
        if (_tmp1 is _default):
            _tmp1 = None
        if ((_tmp1 is not None) and (_tmp1 is not False)):
            if (_tmp1.__class__ not in (
                    str,
                    unicode,
                    int,
                    float,
            )):
                _tmp1 = unicode(
                    _translate(_tmp1,
                               domain=_domain,
                               mapping=None,
                               target_language=target_language,
                               default=None))
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if ('&' in _tmp1):
                if (';' in _tmp1):
                    _tmp1 = _re_amp.sub('&amp;', _tmp1)
                else:
                    _tmp1 = _tmp1.replace('&', '&amp;')
            if ('<' in _tmp1):
                _tmp1 = _tmp1.replace('<', '&lt;')
            if ('>' in _tmp1):
                _tmp1 = _tmp1.replace('>', '&gt;')
            if ('"' in _tmp1):
                _tmp1 = _tmp1.replace('"', '&quot;')
            _write(((' href="' + _tmp1) + '"'))
        _write(u'></a>\n      </div>\n    </body>\n</html>')
        return

    return render
コード例 #36
0
ファイル: jqgrid.pt.py プロジェクト: abourget/fa.jquery
def bind():
    from cPickle import loads as _loads

    _lookup_attr = _loads("cchameleon.core.codegen\nlookup_attr\np1\n.")
    _init_scope = _loads("cchameleon.core.utils\necontext\np1\n.")
    _re_amp = _loads("cre\n_compile\np1\n(S'&(?!([A-Za-z]+|#[0-9]+);)'\np2\nI0\ntRp3\n.")
    _attrs_4364428624 = _loads("(dp1\n.")
    _attrs_4364428496 = _loads("(dp1\n.")
    _init_stream = _loads("cchameleon.core.generation\ninitialize_stream\np1\n.")
    _attrs_4364428560 = _loads("(dp1\n.")
    _init_default = _loads("cchameleon.core.generation\ninitialize_default\np1\n.")
    _attrs_4364428432 = _loads("(dp1\n.")
    _init_tal = _loads("cchameleon.core.generation\ninitialize_tal\np1\n.")

    def render(econtext, rcontext=None):
        macros = econtext.get("macros")
        _translate = econtext.get("_translate")
        _slots = econtext.get("_slots")
        target_language = econtext.get("target_language")
        u"_init_stream()"
        (_out, _write) = _init_stream()
        u"_init_tal()"
        (_attributes, repeat) = _init_tal()
        u"_init_default()"
        _default = _init_default()
        u"None"
        default = None
        u"None"
        _domain = None
        u"grid_1"
        dom_id = u"grid_1"
        u"','.join([f.metadata.get('label') for f in collection.render_fields.values()])"
        colnames = _lookup_attr(",", "join")(
            [
                _lookup_attr(_lookup_attr(f, "metadata"), "get")("label")
                for f in _lookup_attr(_lookup_attr(econtext["collection"], "render_fields"), "values")()
            ]
        )
        u"','.join([f.metadata.get('json') for f in collection.render_fields.values()])"
        colmodels = _lookup_attr(",", "join")(
            [
                _lookup_attr(_lookup_attr(f, "metadata"), "get")("json")
                for f in _lookup_attr(_lookup_attr(econtext["collection"], "render_fields"), "values")()
            ]
        )
        _write(u"\n")
        attrs = _attrs_4364428432
        u"dom_id"
        _write(u"<table")
        _tmp1 = dom_id
        if _tmp1 is _default:
            _tmp1 = None
        if (_tmp1 is not None) and (_tmp1 is not False):
            if _tmp1.__class__ not in (str, unicode, int, float):
                _tmp1 = unicode(
                    _translate(_tmp1, domain=_domain, mapping=None, target_language=target_language, default=None)
                )
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if "&" in _tmp1:
                if ";" in _tmp1:
                    _tmp1 = _re_amp.sub("&amp;", _tmp1)
                else:
                    _tmp1 = _tmp1.replace("&", "&amp;")
            if "<" in _tmp1:
                _tmp1 = _tmp1.replace("<", "&lt;")
            if ">" in _tmp1:
                _tmp1 = _tmp1.replace(">", "&gt;")
            if '"' in _tmp1:
                _tmp1 = _tmp1.replace('"', "&quot;")
            _write(((' id="' + _tmp1) + '"'))
        _write(u"></table> ")
        attrs = _attrs_4364428496
        u"${dom_id}_jqgrid"
        _write(u"<div")
        _tmp1 = "%s%s" % (dom_id, u"_jqgrid")
        if _tmp1 is _default:
            _tmp1 = None
        if (_tmp1 is not None) and (_tmp1 is not False):
            if _tmp1.__class__ not in (str, unicode, int, float):
                _tmp1 = unicode(
                    _translate(_tmp1, domain=_domain, mapping=None, target_language=target_language, default=None)
                )
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if "&" in _tmp1:
                if ";" in _tmp1:
                    _tmp1 = _re_amp.sub("&amp;", _tmp1)
                else:
                    _tmp1 = _tmp1.replace("&", "&amp;")
            if "<" in _tmp1:
                _tmp1 = _tmp1.replace("<", "&lt;")
            if ">" in _tmp1:
                _tmp1 = _tmp1.replace(">", "&gt;")
            if '"' in _tmp1:
                _tmp1 = _tmp1.replace('"', "&quot;")
            _write(((' id="' + _tmp1) + '"'))
        _write(u"></div> \n")
        attrs = _attrs_4364428560
        u"request.static_url('fa.jquery:jquery-ui/jqgrid/js/i18n/grid.locale-en.js')"
        _write(u'<script>\njQuery.fa.add_resource("')
        _tmp1 = _lookup_attr(econtext["request"], "static_url")("fa.jquery:jquery-ui/jqgrid/js/i18n/grid.locale-en.js")
        _tmp = _tmp1
        if _tmp.__class__ not in (str, unicode, int, float):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if _tmp is not None:
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            if "&" in _tmp:
                if ";" in _tmp:
                    _tmp = _re_amp.sub("&amp;", _tmp)
                else:
                    _tmp = _tmp.replace("&", "&amp;")
            if "<" in _tmp:
                _tmp = _tmp.replace("<", "&lt;")
            if ">" in _tmp:
                _tmp = _tmp.replace(">", "&gt;")
            _write(_tmp)
        u"request.static_url('fa.jquery:jquery-ui/jqgrid/js/jquery.jqGrid.min.js')"
        _write(u'");\njQuery.fa.add_resource("')
        _tmp1 = _lookup_attr(econtext["request"], "static_url")("fa.jquery:jquery-ui/jqgrid/js/jquery.jqGrid.min.js")
        _tmp = _tmp1
        if _tmp.__class__ not in (str, unicode, int, float):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if _tmp is not None:
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            if "&" in _tmp:
                if ";" in _tmp:
                    _tmp = _re_amp.sub("&amp;", _tmp)
                else:
                    _tmp = _tmp.replace("&", "&amp;")
            if "<" in _tmp:
                _tmp = _tmp.replace("<", "&lt;")
            if ">" in _tmp:
                _tmp = _tmp.replace(">", "&gt;")
            _write(_tmp)
        u"request.static_url('fa.jquery:jquery-ui/jqgrid/js/fa.jqgrid.js')"
        _write(u'");\njQuery.fa.add_resource("')
        _tmp1 = _lookup_attr(econtext["request"], "static_url")("fa.jquery:jquery-ui/jqgrid/js/fa.jqgrid.js")
        _tmp = _tmp1
        if _tmp.__class__ not in (str, unicode, int, float):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if _tmp is not None:
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            if "&" in _tmp:
                if ";" in _tmp:
                    _tmp = _re_amp.sub("&amp;", _tmp)
                else:
                    _tmp = _tmp.replace("&", "&amp;")
            if "<" in _tmp:
                _tmp = _tmp.replace("<", "&lt;")
            if ">" in _tmp:
                _tmp = _tmp.replace(">", "&gt;")
            _write(_tmp)
        u"request.static_url('fa.jquery:jquery-ui/jqgrid/css/ui.jqgrid.css')"
        _write(u'");\njQuery.fa.add_resource("')
        _tmp1 = _lookup_attr(econtext["request"], "static_url")("fa.jquery:jquery-ui/jqgrid/css/ui.jqgrid.css")
        _tmp = _tmp1
        if _tmp.__class__ not in (str, unicode, int, float):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if _tmp is not None:
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            if "&" in _tmp:
                if ";" in _tmp:
                    _tmp = _re_amp.sub("&amp;", _tmp)
                else:
                    _tmp = _tmp.replace("&", "&amp;")
            if "<" in _tmp:
                _tmp = _tmp.replace("<", "&lt;")
            if ">" in _tmp:
                _tmp = _tmp.replace(">", "&gt;")
            _write(_tmp)
        _write(u'");\n</script>\n')
        attrs = _attrs_4364428624
        u"dom_id"
        _write(
            u"<script>\nvar init_grid = function() {\nif (!jQuery.fa.jqgrid) {\n  setTimeout(init_grid, 100);\n  return;\n}\nvar url = window.location.href.split('?')[0].split('/');\nvar model = url.pop();\nurl.push('json');\nurl.push(model);\nurl = url.join('/');\njQuery.fa.jqgrid(\""
        )
        _tmp1 = dom_id
        _tmp = _tmp1
        if _tmp.__class__ not in (str, unicode, int, float):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if _tmp is not None:
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            if "&" in _tmp:
                if ";" in _tmp:
                    _tmp = _re_amp.sub("&amp;", _tmp)
                else:
                    _tmp = _tmp.replace("&", "&amp;")
            if "<" in _tmp:
                _tmp = _tmp.replace("<", "&lt;")
            if ">" in _tmp:
                _tmp = _tmp.replace(">", "&gt;")
            _write(_tmp)
        u"colnames and ', %s' % colnames or u''"
        _write(u"\", {\n    url: url+'?jqgrid=true',\n    colNames:['id' ")
        _tmp1 = (colnames and (", %s" % colnames)) or u""
        _tmp = _tmp1
        if _tmp.__class__ not in (str, unicode, int, float):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if _tmp is not None:
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            if "&" in _tmp:
                if ";" in _tmp:
                    _tmp = _re_amp.sub("&amp;", _tmp)
                else:
                    _tmp = _tmp.replace("&", "&amp;")
            if "<" in _tmp:
                _tmp = _tmp.replace("<", "&lt;")
            if ">" in _tmp:
                _tmp = _tmp.replace(">", "&gt;")
            _write(_tmp)
        u"colmodels and ', %s' % colmodels or ''"
        _write(
            u'],\n    colModel:[\n      {name:"id",index:"id", width:30, align:"center", searchoptions:{sopt:["eq"]}}\n      '
        )
        _tmp1 = (colmodels and (", %s" % colmodels)) or ""
        _tmp = _tmp1
        if _tmp.__class__ not in (str, unicode, int, float):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if _tmp is not None:
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            if "&" in _tmp:
                if ";" in _tmp:
                    _tmp = _re_amp.sub("&amp;", _tmp)
                else:
                    _tmp = _tmp.replace("&", "&amp;")
            if "<" in _tmp:
                _tmp = _tmp.replace("<", "&lt;")
            if ">" in _tmp:
                _tmp = _tmp.replace(">", "&gt;")
            _write(_tmp)
        _write(
            u"\n    ],\n    callback: function(table, pager, options) {\n    }\n  });\n}\nsetTimeout(init_grid, 200);\n</script>\n"
        )
        return _out.getvalue()

    return render
コード例 #37
0
ファイル: master.pt.py プロジェクト: pgiraud/fa.jquery
def bind():
    from cPickle import loads as _loads
    _lookup_attr = _loads('cchameleon.core.codegen\nlookup_attr\np1\n.')
    _attrs_4365540624 = _loads('(dp1\nVtype\np2\nVtext/javascript\np3\ns.')
    _re_amp = _loads("cre\n_compile\np1\n(S'&(?!([A-Za-z]+|#[0-9]+);)'\np2\nI0\ntRp3\n.")
    _attrs_4365540432 = _loads('(dp1\nVrel\np2\nVstylesheet\np3\ns.')
    _attrs_4365540048 = _loads('(dp1\n.')
    _init_stream = _loads('cchameleon.core.generation\ninitialize_stream\np1\n.')
    _attrs_4365540496 = _loads('(dp1\nVtype\np2\nVtext/javascript\np3\ns.')
    _attrs_4365539984 = _loads('(dp1\n.')
    _attrs_4365540304 = _loads('(dp1\n.')
    _attrs_4365541136 = _loads('(dp1\n.')
    _init_default = _loads('cchameleon.core.generation\ninitialize_default\np1\n.')
    _attrs_4365553744 = _loads('(dp1\n.')
    _attrs_4365540368 = _loads('(dp1\nVrel\np2\nVstylesheet\np3\ns.')
    _attrs_4365540688 = _loads('(dp1\nVtype\np2\nVtext/css\np3\ns.')
    _init_tal = _loads('cchameleon.core.generation\ninitialize_tal\np1\n.')
    _attrs_4365541072 = _loads('(dp1\nVclass\np2\nVbreadcrumb\np3\ns.')
    _attrs_4365540816 = _loads('(dp1\nVid\np2\nVcontent\np3\nsVclass\np4\nVui-admin ui-widget\np5\ns.')
    _attrs_4365540944 = _loads('(dp1\nVid\np2\nVheader\np3\nsVclass\np4\nVui-widget-header ui-corner-all\np5\ns.')
    _attrs_4365554000 = _loads('(dp1\nVstyle\np2\nVdisplay:none\np3\nsVclass\np4\nVroot_url\np5\ns.')
    _init_scope = _loads('cchameleon.core.utils\necontext\np1\n.')
    _attrs_4365541264 = _loads('(dp1\n.')
    _attrs_4365541008 = _loads('(dp1\n.')
    _attrs_4365541200 = _loads('(dp1\nVstyle\np2\nVdisplay:none;\np3\nsVid\np4\nVmodels\np5\ns.')
    _attrs_4365540112 = _loads('(dp1\n.')
    _attrs_4365540560 = _loads('(dp1\nVtype\np2\nVtext/javascript\np3\ns.')
    _attrs_4365553808 = _loads('(dp1\n.')
    def render(econtext, rcontext=None):
        macros = econtext.get('macros')
        _translate = econtext.get('_translate')
        _slots = econtext.get('_slots')
        target_language = econtext.get('target_language')
        u"%(scope)s['%(out)s'], %(scope)s['%(write)s']"
        (_out, _write, ) = (econtext['_out'], econtext['_write'], )
        u'_init_tal()'
        (_attributes, repeat, ) = _init_tal()
        u'_init_default()'
        _default = _init_default()
        u'None'
        default = None
        u'None'
        _domain = None
        attrs = _attrs_4365540048
        _write(u'<html>\n    ')
        attrs = _attrs_4365539984
        u"''"
        _write(u'<head>\n      ')
        _default.value = default = ''
        u"request.model_name or 'Models index'"
        _content = (_lookup_attr(econtext['request'], 'model_name') or 'Models index')
        attrs = _attrs_4365540304
        u'_content'
        _write(u'<title>')
        _tmp1 = _content
        _tmp = _tmp1
        if (_tmp.__class__ not in (str, unicode, int, float, )):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if (_tmp is not None):
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            if ('&' in _tmp):
                if (';' in _tmp):
                    _tmp = _re_amp.sub('&amp;', _tmp)
                else:
                    _tmp = _tmp.replace('&', '&amp;')
            if ('<' in _tmp):
                _tmp = _tmp.replace('<', '&lt;')
            if ('>' in _tmp):
                _tmp = _tmp.replace('>', '&gt;')
            _write(_tmp)
        _write(u'</title>\n      ')
        attrs = _attrs_4365540368
        u"request.static_url('fa.jquery:jquery-ui/css/smoothness/jquery-ui-1.8.8.custom.css')"
        _write(u'<link rel="stylesheet"')
        _tmp1 = _lookup_attr(econtext['request'], 'static_url')('fa.jquery:jquery-ui/css/smoothness/jquery-ui-1.8.8.custom.css')
        if (_tmp1 is _default):
            _tmp1 = None
        if ((_tmp1 is not None) and (_tmp1 is not False)):
            if (_tmp1.__class__ not in (str, unicode, int, float, )):
                _tmp1 = unicode(_translate(_tmp1, domain=_domain, mapping=None, target_language=target_language, default=None))
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if ('&' in _tmp1):
                if (';' in _tmp1):
                    _tmp1 = _re_amp.sub('&amp;', _tmp1)
                else:
                    _tmp1 = _tmp1.replace('&', '&amp;')
            if ('<' in _tmp1):
                _tmp1 = _tmp1.replace('<', '&lt;')
            if ('>' in _tmp1):
                _tmp1 = _tmp1.replace('>', '&gt;')
            if ('"' in _tmp1):
                _tmp1 = _tmp1.replace('"', '&quot;')
            _write(((' href="' + _tmp1) + '"'))
        _write(u' />\n      ')
        attrs = _attrs_4365540432
        u"request.static_url('fa.jquery:jquery-ui/fa.jquery.min.css')"
        _write(u'<link rel="stylesheet"')
        _tmp1 = _lookup_attr(econtext['request'], 'static_url')('fa.jquery:jquery-ui/fa.jquery.min.css')
        if (_tmp1 is _default):
            _tmp1 = None
        if ((_tmp1 is not None) and (_tmp1 is not False)):
            if (_tmp1.__class__ not in (str, unicode, int, float, )):
                _tmp1 = unicode(_translate(_tmp1, domain=_domain, mapping=None, target_language=target_language, default=None))
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if ('&' in _tmp1):
                if (';' in _tmp1):
                    _tmp1 = _re_amp.sub('&amp;', _tmp1)
                else:
                    _tmp1 = _tmp1.replace('&', '&amp;')
            if ('<' in _tmp1):
                _tmp1 = _tmp1.replace('<', '&lt;')
            if ('>' in _tmp1):
                _tmp1 = _tmp1.replace('>', '&gt;')
            if ('"' in _tmp1):
                _tmp1 = _tmp1.replace('"', '&quot;')
            _write(((' href="' + _tmp1) + '"'))
        _write(u' />\n      ')
        attrs = _attrs_4365540496
        u"request.static_url('fa.jquery:jquery-ui/fa.jquery.min.js')"
        _write(u'<script type="text/javascript"')
        _tmp1 = _lookup_attr(econtext['request'], 'static_url')('fa.jquery:jquery-ui/fa.jquery.min.js')
        if (_tmp1 is _default):
            _tmp1 = None
        if ((_tmp1 is not None) and (_tmp1 is not False)):
            if (_tmp1.__class__ not in (str, unicode, int, float, )):
                _tmp1 = unicode(_translate(_tmp1, domain=_domain, mapping=None, target_language=target_language, default=None))
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if ('&' in _tmp1):
                if (';' in _tmp1):
                    _tmp1 = _re_amp.sub('&amp;', _tmp1)
                else:
                    _tmp1 = _tmp1.replace('&', '&amp;')
            if ('<' in _tmp1):
                _tmp1 = _tmp1.replace('<', '&lt;')
            if ('>' in _tmp1):
                _tmp1 = _tmp1.replace('>', '&gt;')
            if ('"' in _tmp1):
                _tmp1 = _tmp1.replace('"', '&quot;')
            _write(((' src="' + _tmp1) + '"'))
        _write(u'></script>\n      ')
        attrs = _attrs_4365540560
        u"%(slots)s.get(u'javascript')"
        _write(u'<script type="text/javascript">\n        jQuery(document).ready(function() {\n          $(\'select#models\')\n            .change(function() { window.location.href = $(this).val(); })\n            .selectmenu({\'style\':\'dropdown\', \'menuWidth\':\'20%\', \'width\':\'100%\'});\n        });\n      </script>\n      ')
        _tmp = _slots.get(u'javascript')
        u'%(tmp)s is not None'
        _tmp1 = (_tmp is not None)
        if _tmp1:
            pass
            u'isinstance(%(tmp)s, basestring)'
            _tmp2 = isinstance(_tmp, basestring)
            if not _tmp2:
                pass
                econtext.update(dict(rcontext=rcontext, _domain=_domain))
                _tmp(econtext, repeat)
            else:
                pass
                u'%(tmp)s'
                _tmp2 = _tmp
                _tmp = _tmp2
                if (_tmp.__class__ not in (str, unicode, int, float, )):
                    try:
                        _tmp = _tmp.__html__
                    except:
                        _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                    else:
                        _tmp = _tmp()
                        _write(_tmp)
                        _tmp = None
                if (_tmp is not None):
                    if not isinstance(_tmp, unicode):
                        _tmp = str(_tmp)
                    _write(_tmp)
        else:
            pass
            attrs = _attrs_4365540624
            _write(u'<script type="text/javascript"></script>')
        _write(u'\n      ')
        attrs = _attrs_4365540688
        _write(u'<style type="text/css">\n        label {font-weight:bold;}\n        h1, h3 {padding:0.1 0.3em;}\n        h1 a, h3 a {text-decoration:none;}\n        #header { height: 2em; font-size:1.5em; }\n        #header div { font-size:1.5em; }\n        #header a { font-size:1em; }\n        div.breadcrumb {float:right;width:20%;margin-right:20px;}\n        div.breadcrumb a {text-decoration:none;}\n        h1 a.ui-selectmenu {height:1em;}\n        a.ui-state-default {padding:0.1em 0.3em;}\n        a.fm-button {padding:0.4em 0.5em;}\n        a.fm-button-icon-left {padding-left:1.9em;}\n      </style>\n    </head>\n    ')
        attrs = _attrs_4365540112
        _write(u'<body>\n      ')
        attrs = _attrs_4365540816
        _write(u'<div id="content" class="ui-admin ui-widget">\n        ')
        attrs = _attrs_4365540944
        u'request.model_name and breadcrumb'
        _write(u'<h1 id="header" class="ui-widget-header ui-corner-all">\n          ')
        _tmp1 = (_lookup_attr(econtext['request'], 'model_name') and econtext['breadcrumb'])
        if _tmp1:
            pass
            attrs = _attrs_4365541072
            _write(u'<div class="breadcrumb">\n            ')
            attrs = _attrs_4365541200
            u'breadcrumb'
            _write(u'<select id="models" style="display:none;">\n            ')
            _tmp1 = econtext['breadcrumb']
            item = None
            (_tmp1, _tmp2, ) = repeat.insert('item', _tmp1)
            for item in _tmp1:
                _tmp2 = (_tmp2 - 1)
                u"''"
                _write(u'')
                _default.value = default = ''
                u'item[1]'
                _content = item[1]
                attrs = _attrs_4365553808
                u'item[0]'
                _write(u'<option')
                _tmp3 = item[0]
                if (_tmp3 is _default):
                    _tmp3 = None
                if ((_tmp3 is not None) and (_tmp3 is not False)):
                    if (_tmp3.__class__ not in (str, unicode, int, float, )):
                        _tmp3 = unicode(_translate(_tmp3, domain=_domain, mapping=None, target_language=target_language, default=None))
                    else:
                        if not isinstance(_tmp3, unicode):
                            _tmp3 = str(_tmp3)
                    if ('&' in _tmp3):
                        if (';' in _tmp3):
                            _tmp3 = _re_amp.sub('&amp;', _tmp3)
                        else:
                            _tmp3 = _tmp3.replace('&', '&amp;')
                    if ('<' in _tmp3):
                        _tmp3 = _tmp3.replace('<', '&lt;')
                    if ('>' in _tmp3):
                        _tmp3 = _tmp3.replace('>', '&gt;')
                    if ('"' in _tmp3):
                        _tmp3 = _tmp3.replace('"', '&quot;')
                    _write(((' value="' + _tmp3) + '"'))
                u' item[2]'
                _tmp3 = item[2]
                if (_tmp3 is _default):
                    _tmp3 = None
                if ((_tmp3 is not None) and (_tmp3 is not False)):
                    if (_tmp3.__class__ not in (str, unicode, int, float, )):
                        _tmp3 = unicode(_translate(_tmp3, domain=_domain, mapping=None, target_language=target_language, default=None))
                    else:
                        if not isinstance(_tmp3, unicode):
                            _tmp3 = str(_tmp3)
                    if ('&' in _tmp3):
                        if (';' in _tmp3):
                            _tmp3 = _re_amp.sub('&amp;', _tmp3)
                        else:
                            _tmp3 = _tmp3.replace('&', '&amp;')
                    if ('<' in _tmp3):
                        _tmp3 = _tmp3.replace('<', '&lt;')
                    if ('>' in _tmp3):
                        _tmp3 = _tmp3.replace('>', '&gt;')
                    if ('"' in _tmp3):
                        _tmp3 = _tmp3.replace('"', '&quot;')
                    _write(((' class="' + _tmp3) + '"'))
                u'_content'
                _write('>')
                _tmp3 = _content
                _tmp = _tmp3
                if (_tmp.__class__ not in (str, unicode, int, float, )):
                    try:
                        _tmp = _tmp.__html__
                    except:
                        _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                    else:
                        _tmp = _tmp()
                        _write(_tmp)
                        _tmp = None
                if (_tmp is not None):
                    if not isinstance(_tmp, unicode):
                        _tmp = str(_tmp)
                    if ('&' in _tmp):
                        if (';' in _tmp):
                            _tmp = _re_amp.sub('&amp;', _tmp)
                        else:
                            _tmp = _tmp.replace('&', '&amp;')
                    if ('<' in _tmp):
                        _tmp = _tmp.replace('<', '&lt;')
                    if ('>' in _tmp):
                        _tmp = _tmp.replace('>', '&gt;')
                    _write(_tmp)
                _write(u'</option>\n            ')
                if (_tmp2 == 0):
                    break
                _write(' ')
            _write(u'\n            </select>\n          </div>')
        u'request.model_name'
        _write(u'\n          ')
        _tmp1 = _lookup_attr(econtext['request'], 'model_name')
        if _tmp1:
            pass
            attrs = _attrs_4365541136
            u"''"
            _write(u'<div>\n            ')
            _default.value = default = ''
            u'request.model_name'
            _content = _lookup_attr(econtext['request'], 'model_name')
            attrs = _attrs_4365553744
            u'request.fa_url(request.model_name)'
            _write(u'<a')
            _tmp1 = _lookup_attr(econtext['request'], 'fa_url')(_lookup_attr(econtext['request'], 'model_name'))
            if (_tmp1 is _default):
                _tmp1 = None
            if ((_tmp1 is not None) and (_tmp1 is not False)):
                if (_tmp1.__class__ not in (str, unicode, int, float, )):
                    _tmp1 = unicode(_translate(_tmp1, domain=_domain, mapping=None, target_language=target_language, default=None))
                else:
                    if not isinstance(_tmp1, unicode):
                        _tmp1 = str(_tmp1)
                if ('&' in _tmp1):
                    if (';' in _tmp1):
                        _tmp1 = _re_amp.sub('&amp;', _tmp1)
                    else:
                        _tmp1 = _tmp1.replace('&', '&amp;')
                if ('<' in _tmp1):
                    _tmp1 = _tmp1.replace('<', '&lt;')
                if ('>' in _tmp1):
                    _tmp1 = _tmp1.replace('>', '&gt;')
                if ('"' in _tmp1):
                    _tmp1 = _tmp1.replace('"', '&quot;')
                _write(((' href="' + _tmp1) + '"'))
            u'_content'
            _write('>')
            _tmp1 = _content
            _tmp = _tmp1
            if (_tmp.__class__ not in (str, unicode, int, float, )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                if ('&' in _tmp):
                    if (';' in _tmp):
                        _tmp = _re_amp.sub('&amp;', _tmp)
                    else:
                        _tmp = _tmp.replace('&', '&amp;')
                if ('<' in _tmp):
                    _tmp = _tmp.replace('<', '&lt;')
                if ('>' in _tmp):
                    _tmp = _tmp.replace('>', '&gt;')
                _write(_tmp)
            u"''"
            _write(u'</a>\n            ')
            _default.value = default = ''
            u"request.model_id and hasattr(request.model_class, '__unicode__')"
            _tmp1 = (_lookup_attr(econtext['request'], 'model_id') and hasattr(_lookup_attr(econtext['request'], 'model_class'), '__unicode__'))
            if _tmp1:
                pass
                u'request.model_instance'
                _content = _lookup_attr(econtext['request'], 'model_instance')
                u'_content'
                _tmp1 = _content
                _tmp = _tmp1
                if (_tmp.__class__ not in (str, unicode, int, float, )):
                    try:
                        _tmp = _tmp.__html__
                    except:
                        _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                    else:
                        _tmp = _tmp()
                        _write(_tmp)
                        _tmp = None
                if (_tmp is not None):
                    if not isinstance(_tmp, unicode):
                        _tmp = str(_tmp)
                    if ('&' in _tmp):
                        if (';' in _tmp):
                            _tmp = _re_amp.sub('&amp;', _tmp)
                        else:
                            _tmp = _tmp.replace('&', '&amp;')
                    if ('<' in _tmp):
                        _tmp = _tmp.replace('<', '&lt;')
                    if ('>' in _tmp):
                        _tmp = _tmp.replace('>', '&gt;')
                    _write(_tmp)
            u"''"
            _write(u'\n            ')
            _default.value = default = ''
            u"request.model_id and not hasattr(request.model_class, '__unicode__')"
            _tmp1 = (_lookup_attr(econtext['request'], 'model_id') and not hasattr(_lookup_attr(econtext['request'], 'model_class'), '__unicode__'))
            if _tmp1:
                pass
                u'request.model_id'
                _content = _lookup_attr(econtext['request'], 'model_id')
                u'_content'
                _tmp1 = _content
                _tmp = _tmp1
                if (_tmp.__class__ not in (str, unicode, int, float, )):
                    try:
                        _tmp = _tmp.__html__
                    except:
                        _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                    else:
                        _tmp = _tmp()
                        _write(_tmp)
                        _tmp = None
                if (_tmp is not None):
                    if not isinstance(_tmp, unicode):
                        _tmp = str(_tmp)
                    if ('&' in _tmp):
                        if (';' in _tmp):
                            _tmp = _re_amp.sub('&amp;', _tmp)
                        else:
                            _tmp = _tmp.replace('&', '&amp;')
                    if ('<' in _tmp):
                        _tmp = _tmp.replace('<', '&lt;')
                    if ('>' in _tmp):
                        _tmp = _tmp.replace('>', '&gt;')
                    _write(_tmp)
            _write(u'\n          </div>')
        u'not request.model_name'
        _write(u'\n          ')
        _tmp1 = not _lookup_attr(econtext['request'], 'model_name')
        if _tmp1:
            pass
            attrs = _attrs_4365541264
            _write(u'<div>Models index</div>')
        u"%(slots)s.get(u'main')"
        _write(u'\n        </h1>\n        ')
        _tmp = _slots.get(u'main')
        u'%(tmp)s is not None'
        _tmp1 = (_tmp is not None)
        if _tmp1:
            pass
            u'isinstance(%(tmp)s, basestring)'
            _tmp2 = isinstance(_tmp, basestring)
            if not _tmp2:
                pass
                econtext.update(dict(rcontext=rcontext, _domain=_domain))
                _tmp(econtext, repeat)
            else:
                pass
                u'%(tmp)s'
                _tmp2 = _tmp
                _tmp = _tmp2
                if (_tmp.__class__ not in (str, unicode, int, float, )):
                    try:
                        _tmp = _tmp.__html__
                    except:
                        _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                    else:
                        _tmp = _tmp()
                        _write(_tmp)
                        _tmp = None
                if (_tmp is not None):
                    if not isinstance(_tmp, unicode):
                        _tmp = str(_tmp)
                    _write(_tmp)
        else:
            pass
            attrs = _attrs_4365541008
            _write(u'<div>\n        </div>')
        _write(u'\n        ')
        attrs = _attrs_4365554000
        u'request.fa_url()'
        _write(u'<a style="display:none" class="root_url"')
        _tmp1 = _lookup_attr(econtext['request'], 'fa_url')()
        if (_tmp1 is _default):
            _tmp1 = None
        if ((_tmp1 is not None) and (_tmp1 is not False)):
            if (_tmp1.__class__ not in (str, unicode, int, float, )):
                _tmp1 = unicode(_translate(_tmp1, domain=_domain, mapping=None, target_language=target_language, default=None))
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if ('&' in _tmp1):
                if (';' in _tmp1):
                    _tmp1 = _re_amp.sub('&amp;', _tmp1)
                else:
                    _tmp1 = _tmp1.replace('&', '&amp;')
            if ('<' in _tmp1):
                _tmp1 = _tmp1.replace('<', '&lt;')
            if ('>' in _tmp1):
                _tmp1 = _tmp1.replace('>', '&gt;')
            if ('"' in _tmp1):
                _tmp1 = _tmp1.replace('"', '&quot;')
            _write(((' href="' + _tmp1) + '"'))
        _write(u'></a>\n      </div>\n    </body>\n</html>')
        return
    return render
コード例 #38
0
def loads(s, **kwargs):
    return _loads(s)
コード例 #39
0
ファイル: tank.pt.py プロジェクト: cswank/brewserver
def bind():
    from cPickle import loads as _loads

    _lookup_attr = _loads("cchameleon.core.codegen\nlookup_attr\np1\n.")
    _attrs_4367500176 = _loads("(dp1\n.")
    _attrs_4367502672 = _loads("(dp1\nVclass\np2\nVbutton\np3\ns.")
    _re_amp = _loads("cre\n_compile\np1\n(S'&(?!([A-Za-z]+|#[0-9]+);)'\np2\nI0\ntRp3\n.")
    _attrs_4367481104 = _loads(
        "(dp1\nVhref\np2\nV${request.application_url}/static/css/custom-theme/jquery-ui.css\np3\nsVrel\np4\nVstylesheet\np5\nsVtype\np6\nVtext/css\np7\ns."
    )
    _attrs_4367499920 = _loads("(dp1\nVid\np2\nVthermometer-text\np3\nsVclass\np4\nVtext-value\np5\ns.")
    _attrs_4367481360 = _loads(
        "(dp1\nVsrc\np2\nV${request.application_url}/static/js/calibration.js\np3\nsVtype\np4\nVtext/javascript\np5\ns."
    )
    _attrs_4367500432 = _loads("(dp1\nVid\np2\nVthermometer-target\np3\ns.")
    _attrs_4367499600 = _loads("(dp1\n.")
    _attrs_4367502224 = _loads("(dp1\n.")
    _attrs_4367499536 = _loads("(dp1\nVclass\np2\nVanalog-history\np3\nsVid\np4\nVvolume-table\np5\ns.")
    _init_stream = _loads("cchameleon.core.generation\ninitialize_stream\np1\n.")
    _attrs_4367482128 = _loads("(dp1\nVid\np2\nVanalog-div\np3\ns.")
    _attrs_4367501840 = _loads(
        "(dp1\nVtype\np2\nVcheckbox\np3\nsVid\np4\nVcooler-button\np5\nsVclass\np6\nVinput-device\np7\ns."
    )
    _attrs_4367481040 = _loads(
        "(dp1\nVhref\np2\nV${request.application_url}/static/css/default.css\np3\nsVrel\np4\nVstylesheet\np5\nsVtype\np6\nVtext/css\np7\ns."
    )
    _attrs_4367516752 = _loads("(dp1\nVid\np2\nVdialog-confirm\np3\nsVtitle\np4\nVDelete data point?\np5\ns.")
    _attrs_4367482576 = _loads("(dp1\nVid\np2\nVtemperature-div\np3\nsVclass\np4\nVdevice\np5\ns.")
    _attrs_4367482000 = _loads("(dp1\n.")
    _attrs_4367480720 = _loads("(dp1\n.")
    _attrs_4367481616 = _loads("(dp1\nVid\np2\nVheader\np3\ns.")
    _attrs_4367480848 = _loads("(dp1\n.")
    _attrs_4367499344 = _loads("(dp1\n.")
    _attrs_4367482192 = _loads("(dp1\n.")
    _attrs_4367517136 = _loads(
        "(dp1\nVstyle\np2\nVfloat:left; margin:0 7px 20px 0;\np3\nsVclass\np4\nVui-icon ui-icon-alert\np5\ns."
    )
    _attrs_4367481168 = _loads(
        "(dp1\nVsrc\np2\nV${request.application_url}/static/js/jquery-1.4.2.min.js\np3\nsVtype\np4\nVtext/javascript\np5\ns."
    )
    _attrs_4367501072 = _loads("(dp1\n.")
    _attrs_4367501328 = _loads("(dp1\nVfor\np2\nVburner-button\np3\ns.")
    _attrs_4367482256 = _loads("(dp1\n.")
    _attrs_4367481744 = _loads("(dp1\nVid\np2\nVlineage\np3\ns.")
    _attrs_4367481488 = _loads("(dp1\nVtype\np2\nVtext/javascript\np3\ns.")
    _attrs_4367516048 = _loads("(dp1\n.")
    _attrs_4367500304 = _loads(
        "(dp1\nVid\np2\nVthermometer-target-text\np3\nsVclass\np4\nVtext-value input-device\np5\ns."
    )
    _attrs_4367482384 = _loads("(dp1\nVfor\np2\nVmode-button\np3\ns.")
    _attrs_4367516560 = _loads("(dp1\nVid\np2\nVcurrent-value\np3\ns.")
    _attrs_4367515792 = _loads("(dp1\nVstyle\np2\nVwidth:600px;height:300px;\np3\nsVid\np4\nVcalibration-table\np5\ns.")
    _attrs_4367482704 = _loads("(dp1\nVhref\np2\nV#\nsVdevice\np3\nVvolume\np4\nsVid\np5\nVcalibrate-volume\np6\ns.")
    _attrs_4367500944 = _loads("(dp1\n.")
    _attrs_4367499472 = _loads("(dp1\nVid\np2\nVvolume-target\np3\ns.")
    _attrs_4367481680 = _loads("(dp1\nVid\np2\nVside-bar\np3\ns.")
    _attrs_4367481808 = _loads("(dp1\nVid\np2\nVmain-content\np3\ns.")
    _attrs_4367482832 = _loads("(dp1\nVid\np2\nVvolume\np3\ns.")
    _attrs_4367482640 = _loads("(dp1\n.")
    _attrs_4367516688 = _loads("(dp1\nVid\np2\nVclick-data\np3\ns.")
    _init_tal = _loads("cchameleon.core.generation\ninitialize_tal\np1\n.")
    _attrs_4367480976 = _loads(
        "(dp1\nVhref\np2\nV${request.application_url}/static/css/ui-lightness/jquery-ui-1.8.6.custom.css\np3\nsVrel\np4\nVstylesheet\np5\nsVtype\np6\nVtext/css\np7\ns."
    )
    _attrs_4367499408 = _loads("(dp1\nVid\np2\nVvolume-target-text\np3\nsVclass\np4\nVtext-value input-device\np5\ns.")
    _attrs_4367500560 = _loads("(dp1\nVclass\np2\nVanalog-history\np3\nsVid\np4\nVtemperature-table\np5\ns.")
    _init_default = _loads("cchameleon.core.generation\ninitialize_default\np1\n.")
    _attrs_4367481296 = _loads(
        "(dp1\nVsrc\np2\nV${request.application_url}/static/js/tank.js\np3\nsVtype\np4\nVtext/javascript\np5\ns."
    )
    _attrs_4367502864 = _loads("(dp1\n.")
    _attrs_4367503120 = _loads(
        "(dp1\nVtype\np2\nVcheckbox\np3\nsVid\np4\nVfill-valve-button\np5\nsVclass\np6\nVinput-device\np7\ns."
    )
    _attrs_4367500048 = _loads("(dp1\nVid\np2\nVthermometer\np3\ns.")
    _attrs_4367499664 = _loads("(dp1\n.")
    _attrs_4367502480 = _loads(
        "(dp1\nVtype\np2\nVcheckbox\np3\nsVid\np4\nVstirrer-button\np5\nsVclass\np6\nVinput-device\np7\ns."
    )
    _attrs_4367480912 = _loads("(dp1\n.")
    _attrs_4367501712 = _loads("(dp1\n.")
    _attrs_4367482768 = _loads("(dp1\nVid\np2\nVvolume-text\np3\nsVclass\np4\nVtext-value\np5\ns.")
    _attrs_4367516944 = _loads("(dp1\n.")
    _attrs_4367502352 = _loads("(dp1\n.")
    _attrs_4367502992 = _loads("(dp1\n.")
    _attrs_4367500752 = _loads("(dp1\nVclass\np2\nVbutton\np3\ns.")
    _attrs_4367482320 = _loads("(dp1\nVtype\np2\nVcheckbox\np3\nsVid\np4\nVmode-button\np5\ns.")
    _attrs_4367516304 = _loads("(dp1\n.")
    _attrs_4367499792 = _loads(
        "(dp1\nVhref\np2\nV#\nsVdevice\np3\nVtemperature\np4\nsVid\np5\nVcalibrate-temperature\np6\ns."
    )
    _attrs_4367502608 = _loads("(dp1\nVfor\np2\nVstirrer-button\np3\ns.")
    _attrs_4367481232 = _loads(
        "(dp1\nVsrc\np2\nV${request.application_url}/static/js/jquery-ui-1.8.6.custom.min.js\np3\nsVtype\np4\nVtext/javascript\np5\ns."
    )
    _attrs_4367501584 = _loads("(dp1\n.")
    _attrs_4367482512 = _loads("(dp1\nVid\np2\nVvolume-div\np3\nsVclass\np4\nVdevice\np5\ns.")
    _attrs_4367481424 = _loads(
        "(dp1\nVsrc\np2\nV${request.application_url}/static/js/flot/jquery.flot.js\np3\nsVlanguage\np4\nVjavascript\np5\nsVtype\np6\nVtext/javascript\np7\ns."
    )
    _init_scope = _loads("cchameleon.core.utils\necontext\np1\n.")
    _attrs_4367501200 = _loads(
        "(dp1\nVtype\np2\nVcheckbox\np3\nsVid\np4\nVburner-button\np5\nsVclass\np6\nVinput-device\np7\ns."
    )
    _attrs_4367516176 = _loads("(dp1\nVhref\np2\nV#\nsVid\np3\nVset-calibration-point\np4\ns.")
    _attrs_4367516432 = _loads("(dp1\n.")
    _attrs_4367515920 = _loads("(dp1\nVtype\np2\nVtext\np3\nsVid\np4\nVcalibration-point\np5\ns.")
    _attrs_4367502736 = _loads("(dp1\nVstyle\np2\nVwidth:600px;height:300px;\np3\nsVid\np4\nVcalibration\np5\ns.")
    _attrs_4367482064 = _loads("(dp1\nVclass\np2\nVdevice\np3\ns.")
    _attrs_4367501968 = _loads("(dp1\nVfor\np2\nVcooler-button\np3\ns.")
    _attrs_4367503248 = _loads("(dp1\nVfor\np2\nVfill-valve-button\np3\ns.")
    _attrs_4367501392 = _loads("(dp1\nVclass\np2\nVbutton\np3\ns.")
    _attrs_4367502032 = _loads("(dp1\nVclass\np2\nVbutton\np3\ns.")

    def render(econtext, rcontext=None):
        macros = econtext.get("macros")
        _translate = econtext.get("_translate")
        _slots = econtext.get("_slots")
        target_language = econtext.get("target_language")
        u"_init_stream()"
        (_out, _write) = _init_stream()
        u"_init_tal()"
        (_attributes, repeat) = _init_tal()
        u"_init_default()"
        _default = _init_default()
        u"None"
        default = None
        u"None"
        _domain = None
        attrs = _attrs_4367480720
        _write(u"<html>\n  ")
        attrs = _attrs_4367480848
        _write(u"<head>\n    ")
        attrs = _attrs_4367480976
        "join(value('request.application_url'), u'/static/css/ui-lightness/jquery-ui-1.8.6.custom.css')"
        _write(u"<link")
        _tmp1 = "%s%s" % (
            _lookup_attr(econtext["request"], "application_url"),
            u"/static/css/ui-lightness/jquery-ui-1.8.6.custom.css",
        )
        if _tmp1 is _default:
            _tmp1 = u"${request.application_url}/static/css/ui-lightness/jquery-ui-1.8.6.custom.css"
        if (_tmp1 is not None) and (_tmp1 is not False):
            if _tmp1.__class__ not in (str, unicode, int, float):
                _tmp1 = unicode(
                    _translate(_tmp1, domain=_domain, mapping=None, target_language=target_language, default=None)
                )
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if "&" in _tmp1:
                if ";" in _tmp1:
                    _tmp1 = _re_amp.sub("&amp;", _tmp1)
                else:
                    _tmp1 = _tmp1.replace("&", "&amp;")
            if "<" in _tmp1:
                _tmp1 = _tmp1.replace("<", "&lt;")
            if ">" in _tmp1:
                _tmp1 = _tmp1.replace(">", "&gt;")
            if '"' in _tmp1:
                _tmp1 = _tmp1.replace('"', "&quot;")
            _write(((' href="' + _tmp1) + '"'))
        _write(u' rel="stylesheet" type="text/css" />\n    ')
        attrs = _attrs_4367481040
        _write(u"<link")
        default = u"${request.application_url}/static/css/default.css"
        "join(value('request.application_url'), u'/static/css/default.css')"
        _tmp1 = "%s%s" % (_lookup_attr(econtext["request"], "application_url"), u"/static/css/default.css")
        default = None
        if _tmp1 is _default:
            _tmp1 = u"${request.application_url}/static/css/default.css"
        if (_tmp1 is not None) and (_tmp1 is not False):
            if _tmp1.__class__ not in (str, unicode, int, float):
                _tmp1 = unicode(
                    _translate(_tmp1, domain=_domain, mapping=None, target_language=target_language, default=None)
                )
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if "&" in _tmp1:
                if ";" in _tmp1:
                    _tmp1 = _re_amp.sub("&amp;", _tmp1)
                else:
                    _tmp1 = _tmp1.replace("&", "&amp;")
            if "<" in _tmp1:
                _tmp1 = _tmp1.replace("<", "&lt;")
            if ">" in _tmp1:
                _tmp1 = _tmp1.replace(">", "&gt;")
            if '"' in _tmp1:
                _tmp1 = _tmp1.replace('"', "&quot;")
            _write(((' href="' + _tmp1) + '"'))
        _write(u' rel="stylesheet" type="text/css" />\n    ')
        attrs = _attrs_4367481104
        "join(value('request.application_url'), u'/static/css/custom-theme/jquery-ui.css')"
        _write(u"<link")
        _tmp1 = "%s%s" % (
            _lookup_attr(econtext["request"], "application_url"),
            u"/static/css/custom-theme/jquery-ui.css",
        )
        if _tmp1 is _default:
            _tmp1 = u"${request.application_url}/static/css/custom-theme/jquery-ui.css"
        if (_tmp1 is not None) and (_tmp1 is not False):
            if _tmp1.__class__ not in (str, unicode, int, float):
                _tmp1 = unicode(
                    _translate(_tmp1, domain=_domain, mapping=None, target_language=target_language, default=None)
                )
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if "&" in _tmp1:
                if ";" in _tmp1:
                    _tmp1 = _re_amp.sub("&amp;", _tmp1)
                else:
                    _tmp1 = _tmp1.replace("&", "&amp;")
            if "<" in _tmp1:
                _tmp1 = _tmp1.replace("<", "&lt;")
            if ">" in _tmp1:
                _tmp1 = _tmp1.replace(">", "&gt;")
            if '"' in _tmp1:
                _tmp1 = _tmp1.replace('"', "&quot;")
            _write(((' href="' + _tmp1) + '"'))
        _write(u' rel="stylesheet" type="text/css" />\n    ')
        attrs = _attrs_4367481168
        "join(value('request.application_url'), u'/static/js/jquery-1.4.2.min.js')"
        _write(u'<script type="text/javascript"')
        _tmp1 = "%s%s" % (_lookup_attr(econtext["request"], "application_url"), u"/static/js/jquery-1.4.2.min.js")
        if _tmp1 is _default:
            _tmp1 = u"${request.application_url}/static/js/jquery-1.4.2.min.js"
        if (_tmp1 is not None) and (_tmp1 is not False):
            if _tmp1.__class__ not in (str, unicode, int, float):
                _tmp1 = unicode(
                    _translate(_tmp1, domain=_domain, mapping=None, target_language=target_language, default=None)
                )
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if "&" in _tmp1:
                if ";" in _tmp1:
                    _tmp1 = _re_amp.sub("&amp;", _tmp1)
                else:
                    _tmp1 = _tmp1.replace("&", "&amp;")
            if "<" in _tmp1:
                _tmp1 = _tmp1.replace("<", "&lt;")
            if ">" in _tmp1:
                _tmp1 = _tmp1.replace(">", "&gt;")
            if '"' in _tmp1:
                _tmp1 = _tmp1.replace('"', "&quot;")
            _write(((' src="' + _tmp1) + '"'))
        _write(u"></script>\n    ")
        attrs = _attrs_4367481232
        "join(value('request.application_url'), u'/static/js/jquery-ui-1.8.6.custom.min.js')"
        _write(u'<script type="text/javascript"')
        _tmp1 = "%s%s" % (
            _lookup_attr(econtext["request"], "application_url"),
            u"/static/js/jquery-ui-1.8.6.custom.min.js",
        )
        if _tmp1 is _default:
            _tmp1 = u"${request.application_url}/static/js/jquery-ui-1.8.6.custom.min.js"
        if (_tmp1 is not None) and (_tmp1 is not False):
            if _tmp1.__class__ not in (str, unicode, int, float):
                _tmp1 = unicode(
                    _translate(_tmp1, domain=_domain, mapping=None, target_language=target_language, default=None)
                )
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if "&" in _tmp1:
                if ";" in _tmp1:
                    _tmp1 = _re_amp.sub("&amp;", _tmp1)
                else:
                    _tmp1 = _tmp1.replace("&", "&amp;")
            if "<" in _tmp1:
                _tmp1 = _tmp1.replace("<", "&lt;")
            if ">" in _tmp1:
                _tmp1 = _tmp1.replace(">", "&gt;")
            if '"' in _tmp1:
                _tmp1 = _tmp1.replace('"', "&quot;")
            _write(((' src="' + _tmp1) + '"'))
        _write(u"></script>\n    ")
        attrs = _attrs_4367481296
        "join(value('request.application_url'), u'/static/js/tank.js')"
        _write(u'<script type="text/javascript"')
        _tmp1 = "%s%s" % (_lookup_attr(econtext["request"], "application_url"), u"/static/js/tank.js")
        if _tmp1 is _default:
            _tmp1 = u"${request.application_url}/static/js/tank.js"
        if (_tmp1 is not None) and (_tmp1 is not False):
            if _tmp1.__class__ not in (str, unicode, int, float):
                _tmp1 = unicode(
                    _translate(_tmp1, domain=_domain, mapping=None, target_language=target_language, default=None)
                )
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if "&" in _tmp1:
                if ";" in _tmp1:
                    _tmp1 = _re_amp.sub("&amp;", _tmp1)
                else:
                    _tmp1 = _tmp1.replace("&", "&amp;")
            if "<" in _tmp1:
                _tmp1 = _tmp1.replace("<", "&lt;")
            if ">" in _tmp1:
                _tmp1 = _tmp1.replace(">", "&gt;")
            if '"' in _tmp1:
                _tmp1 = _tmp1.replace('"', "&quot;")
            _write(((' src="' + _tmp1) + '"'))
        _write(u"></script>\n    ")
        attrs = _attrs_4367481360
        "join(value('request.application_url'), u'/static/js/calibration.js')"
        _write(u'<script type="text/javascript"')
        _tmp1 = "%s%s" % (_lookup_attr(econtext["request"], "application_url"), u"/static/js/calibration.js")
        if _tmp1 is _default:
            _tmp1 = u"${request.application_url}/static/js/calibration.js"
        if (_tmp1 is not None) and (_tmp1 is not False):
            if _tmp1.__class__ not in (str, unicode, int, float):
                _tmp1 = unicode(
                    _translate(_tmp1, domain=_domain, mapping=None, target_language=target_language, default=None)
                )
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if "&" in _tmp1:
                if ";" in _tmp1:
                    _tmp1 = _re_amp.sub("&amp;", _tmp1)
                else:
                    _tmp1 = _tmp1.replace("&", "&amp;")
            if "<" in _tmp1:
                _tmp1 = _tmp1.replace("<", "&lt;")
            if ">" in _tmp1:
                _tmp1 = _tmp1.replace(">", "&gt;")
            if '"' in _tmp1:
                _tmp1 = _tmp1.replace('"', "&quot;")
            _write(((' src="' + _tmp1) + '"'))
        _write(u"></script>\n    ")
        attrs = _attrs_4367481424
        "join(value('request.application_url'), u'/static/js/flot/jquery.flot.js')"
        _write(u'<script language="javascript" type="text/javascript"')
        _tmp1 = "%s%s" % (_lookup_attr(econtext["request"], "application_url"), u"/static/js/flot/jquery.flot.js")
        if _tmp1 is _default:
            _tmp1 = u"${request.application_url}/static/js/flot/jquery.flot.js"
        if (_tmp1 is not None) and (_tmp1 is not False):
            if _tmp1.__class__ not in (str, unicode, int, float):
                _tmp1 = unicode(
                    _translate(_tmp1, domain=_domain, mapping=None, target_language=target_language, default=None)
                )
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if "&" in _tmp1:
                if ";" in _tmp1:
                    _tmp1 = _re_amp.sub("&amp;", _tmp1)
                else:
                    _tmp1 = _tmp1.replace("&", "&amp;")
            if "<" in _tmp1:
                _tmp1 = _tmp1.replace("<", "&lt;")
            if ">" in _tmp1:
                _tmp1 = _tmp1.replace(">", "&gt;")
            if '"' in _tmp1:
                _tmp1 = _tmp1.replace('"', "&quot;")
            _write(((' src="' + _tmp1) + '"'))
        _write(u"></script>\n    ")
        attrs = _attrs_4367481488
        u"state_url"
        _write(u'<script type="text/javascript">\n      var stateUrl = "')
        _tmp1 = econtext["state_url"]
        _tmp = _tmp1
        if _tmp.__class__ not in (str, unicode, int, float):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if _tmp is not None:
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            if "&" in _tmp:
                if ";" in _tmp:
                    _tmp = _re_amp.sub("&amp;", _tmp)
                else:
                    _tmp = _tmp.replace("&", "&amp;")
            if "<" in _tmp:
                _tmp = _tmp.replace("<", "&lt;")
            if ">" in _tmp:
                _tmp = _tmp.replace(">", "&gt;")
            _write(_tmp)
        u"history_url"
        _write(u'";\n      var historyUrl = "')
        _tmp1 = econtext["history_url"]
        _tmp = _tmp1
        if _tmp.__class__ not in (str, unicode, int, float):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if _tmp is not None:
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            if "&" in _tmp:
                if ";" in _tmp:
                    _tmp = _re_amp.sub("&amp;", _tmp)
                else:
                    _tmp = _tmp.replace("&", "&amp;")
            if "<" in _tmp:
                _tmp = _tmp.replace("<", "&lt;")
            if ">" in _tmp:
                _tmp = _tmp.replace(">", "&gt;")
            _write(_tmp)
        u"name"
        _write(u'";\n      var name = "')
        _tmp1 = econtext["name"]
        _tmp = _tmp1
        if _tmp.__class__ not in (str, unicode, int, float):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if _tmp is not None:
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            if "&" in _tmp:
                if ";" in _tmp:
                    _tmp = _re_amp.sub("&amp;", _tmp)
                else:
                    _tmp = _tmp.replace("&", "&amp;")
            if "<" in _tmp:
                _tmp = _tmp.replace("<", "&lt;")
            if ">" in _tmp:
                _tmp = _tmp.replace(">", "&gt;")
            _write(_tmp)
        u"send_command_url"
        _write(u'";\n      var sendCommandUrl = "')
        _tmp1 = econtext["send_command_url"]
        _tmp = _tmp1
        if _tmp.__class__ not in (str, unicode, int, float):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if _tmp is not None:
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            if "&" in _tmp:
                if ";" in _tmp:
                    _tmp = _re_amp.sub("&amp;", _tmp)
                else:
                    _tmp = _tmp.replace("&", "&amp;")
            if "<" in _tmp:
                _tmp = _tmp.replace("<", "&lt;")
            if ">" in _tmp:
                _tmp = _tmp.replace(">", "&gt;")
            _write(_tmp)
        u"calibration_curve_url"
        _write(u'";\n      var calibrationCurveUrl = "')
        _tmp1 = econtext["calibration_curve_url"]
        _tmp = _tmp1
        if _tmp.__class__ not in (str, unicode, int, float):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if _tmp is not None:
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            if "&" in _tmp:
                if ";" in _tmp:
                    _tmp = _re_amp.sub("&amp;", _tmp)
                else:
                    _tmp = _tmp.replace("&", "&amp;")
            if "<" in _tmp:
                _tmp = _tmp.replace("<", "&lt;")
            if ">" in _tmp:
                _tmp = _tmp.replace(">", "&gt;")
            _write(_tmp)
        u"delete_point_url"
        _write(u'";\n      var deletePointUrl = "')
        _tmp1 = econtext["delete_point_url"]
        _tmp = _tmp1
        if _tmp.__class__ not in (str, unicode, int, float):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if _tmp is not None:
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            if "&" in _tmp:
                if ";" in _tmp:
                    _tmp = _re_amp.sub("&amp;", _tmp)
                else:
                    _tmp = _tmp.replace("&", "&amp;")
            if "<" in _tmp:
                _tmp = _tmp.replace("<", "&lt;")
            if ">" in _tmp:
                _tmp = _tmp.replace(">", "&gt;")
            _write(_tmp)
        u"save_point_url"
        _write(u'";\n      var savePointUrl = "')
        _tmp1 = econtext["save_point_url"]
        _tmp = _tmp1
        if _tmp.__class__ not in (str, unicode, int, float):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if _tmp is not None:
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            if "&" in _tmp:
                if ";" in _tmp:
                    _tmp = _re_amp.sub("&amp;", _tmp)
                else:
                    _tmp = _tmp.replace("&", "&amp;")
            if "<" in _tmp:
                _tmp = _tmp.replace("<", "&lt;")
            if ">" in _tmp:
                _tmp = _tmp.replace(">", "&gt;")
            _write(_tmp)
        _write(u'";\n    </script>\n  </head>\n  ')
        attrs = _attrs_4367480912
        _write(u"<body>\n    ")
        attrs = _attrs_4367481616
        _write(u'<div id="header">\n      ')
        attrs = _attrs_4367481744
        u"''"
        _write(u'<div id="lineage">')
        _default.value = default = ""
        u"lineage"
        _content = econtext["lineage"]
        u"_content"
        _tmp1 = _content
        _tmp = _tmp1
        if _tmp.__class__ not in (str, unicode, int, float):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if _tmp is not None:
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            _write(_tmp)
        _write(u"</div>\n    </div>\n    ")
        attrs = _attrs_4367481680
        _write(u'<div id="side-bar">\n    </div>\n    ')
        attrs = _attrs_4367481808
        _write(u'<div id="main-content">\n      ')
        attrs = _attrs_4367482000
        u"name"
        _write(u"<h1>")
        _tmp1 = econtext["name"]
        _tmp = _tmp1
        if _tmp.__class__ not in (str, unicode, int, float):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if _tmp is not None:
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            if "&" in _tmp:
                if ";" in _tmp:
                    _tmp = _re_amp.sub("&amp;", _tmp)
                else:
                    _tmp = _tmp.replace("&", "&amp;")
            if "<" in _tmp:
                _tmp = _tmp.replace("<", "&lt;")
            if ">" in _tmp:
                _tmp = _tmp.replace(">", "&gt;")
            _write(_tmp)
        _write(u"</h1>\n      ")
        attrs = _attrs_4367482064
        _write(u'<div class="device">\n        ')
        attrs = _attrs_4367482192
        _write(u"<a>Mode</a>")
        attrs = _attrs_4367482256
        _write(u"<br />\n        ")
        attrs = _attrs_4367482320
        _write(u'<input type="checkbox" id="mode-button" />')
        attrs = _attrs_4367482384
        _write(u'<label for="mode-button">Receive</label>\n      </div>\n      ')
        attrs = _attrs_4367482128
        u" 'volume' in devices"
        _write(u'<div id="analog-div">\n        ')
        _tmp1 = "volume" in econtext["devices"]
        if _tmp1:
            pass
            attrs = _attrs_4367482512
            _write(u'<div id="volume-div" class="device">\n          ')
            attrs = _attrs_4367482640
            _write(u"<a>Volume</a>")
            attrs = _attrs_4367482704
            _write(u'<a href="#" id="calibrate-volume" device="volume"> calibrate</a>')
            attrs = _attrs_4367482768
            _write(u'<a id="volume-text" class="text-value">0</a>\n          ')
            attrs = _attrs_4367482832
            _write(u'<div id="volume"></div>\n          ')
            attrs = _attrs_4367499344
            _write(u"<a>Set Point</a>")
            attrs = _attrs_4367499408
            _write(u'<a id="volume-target-text" class="text-value input-device">0</a>\n          ')
            attrs = _attrs_4367499472
            _write(u'<div id="volume-target"></div>\n          ')
            attrs = _attrs_4367499536
            _write(u'<div class="analog-history" id="volume-table">\n          </div>\n        </div>')
        u" 'temperature' in devices"
        _write(u"\n        ")
        _tmp1 = "temperature" in econtext["devices"]
        if _tmp1:
            pass
            attrs = _attrs_4367482576
            _write(u'<div id="temperature-div" class="device">\n          ')
            attrs = _attrs_4367499664
            _write(u"<a>Temperature</a>")
            attrs = _attrs_4367499792
            _write(u'<a href="#" id="calibrate-temperature" device="temperature"> calibrate</a>')
            attrs = _attrs_4367499920
            _write(u'<a id="thermometer-text" class="text-value">0</a>\n          ')
            attrs = _attrs_4367500048
            _write(u'<div id="thermometer"></div>\n          ')
            attrs = _attrs_4367500176
            _write(u"<a>Set Point</a>")
            attrs = _attrs_4367500304
            _write(u'<a id="thermometer-target-text" class="text-value input-device">0</a>\n          ')
            attrs = _attrs_4367500432
            _write(u'<div id="thermometer-target"></div>\n          ')
            attrs = _attrs_4367500560
            _write(u'<div class="analog-history" id="temperature-table">\n          </div>\n        </div>')
        _write(u"\n      </div>\n      ")
        attrs = _attrs_4367499600
        u" 'burner' in devices"
        _write(u"<div>\n        ")
        _tmp1 = "burner" in econtext["devices"]
        if _tmp1:
            pass
            attrs = _attrs_4367500752
            _write(u'<span class="button">\n          ')
            attrs = _attrs_4367500944
            _write(u"<a>Burner</a>")
            attrs = _attrs_4367501072
            _write(u"<br />\n          ")
            attrs = _attrs_4367501200
            _write(u'<input type="checkbox" id="burner-button" class="input-device" />')
            attrs = _attrs_4367501328
            _write(u'<label for="burner-button">Off</label>\n        </span>')
        u" 'cooler' in devices"
        _write(u"\n        ")
        _tmp1 = "cooler" in econtext["devices"]
        if _tmp1:
            pass
            attrs = _attrs_4367501392
            _write(u'<span class="button">\n          ')
            attrs = _attrs_4367501584
            _write(u"<a>Cooler</a>")
            attrs = _attrs_4367501712
            _write(u"<br />\n          ")
            attrs = _attrs_4367501840
            _write(u'<input type="checkbox" id="cooler-button" class="input-device" />')
            attrs = _attrs_4367501968
            _write(u'<label for="cooler-button">Off</label>\n        </span>')
        u" 'stirrer' in devices"
        _write(u"\n        ")
        _tmp1 = "stirrer" in econtext["devices"]
        if _tmp1:
            pass
            attrs = _attrs_4367502032
            _write(u'<span class="button">\n          ')
            attrs = _attrs_4367502224
            _write(u"<a>Stirrer</a>")
            attrs = _attrs_4367502352
            _write(u"<br />\n          ")
            attrs = _attrs_4367502480
            _write(u'<input type="checkbox" id="stirrer-button" class="input-device" />')
            attrs = _attrs_4367502608
            _write(u'<label for="stirrer-button">Off</label>\n        </span>')
        u" 'fill_valve' in devices"
        _write(u"\n        ")
        _tmp1 = "fill_valve" in econtext["devices"]
        if _tmp1:
            pass
            attrs = _attrs_4367502672
            _write(u'<span class="button">\n          ')
            attrs = _attrs_4367502864
            _write(u"<a>Fill Valve</a>")
            attrs = _attrs_4367502992
            _write(u"<br />\n          ")
            attrs = _attrs_4367503120
            _write(u'<input type="checkbox" id="fill-valve-button" class="input-device" />')
            attrs = _attrs_4367503248
            _write(u'<label for="fill-valve-button">Off</label>\n        </span>')
        _write(u"\n      </div>\n      ")
        attrs = _attrs_4367502736
        _write(u'<div id="calibration" style="width:600px;height:300px;">\n        ')
        attrs = _attrs_4367515792
        _write(u'<div id="calibration-table" style="width:600px;height:300px;">\n        </div>\n        ')
        attrs = _attrs_4367515920
        _write(u'<input type="text" id="calibration-point" />')
        attrs = _attrs_4367516048
        _write(u"<br />\n          ")
        attrs = _attrs_4367516176
        _write(u'<a id="set-calibration-point" href="#">set calibration point</a>')
        attrs = _attrs_4367516304
        _write(u"<br />\n          ")
        attrs = _attrs_4367516432
        _write(u"<a>Current Value: </a>")
        attrs = _attrs_4367516560
        _write(u'<a id="current-value">0</a>\n          ')
        attrs = _attrs_4367516688
        _write(u'<a id="click-data"></a>\n      </div>\n      ')
        attrs = _attrs_4367516752
        _write(u'<div id="dialog-confirm" title="Delete data point?">\n\t')
        attrs = _attrs_4367516944
        _write(u"<p>")
        attrs = _attrs_4367517136
        _write(
            u'<span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>Are you sure you want to delete?</p>\n      </div>\n    </div><!--main content-->\n  </body>\n</html>'
        )
        return _out.getvalue()

    return render
コード例 #40
0
ファイル: edit.pt.py プロジェクト: bkocherov/fa.jquery
def bind():
    from cPickle import loads as _loads
    _attrs_4354311312 = _loads('(dp1\n.')
    _lookup_attr = _loads('cchameleon.core.codegen\nlookup_attr\np1\n.')
    _init_scope = _loads('cchameleon.core.utils\necontext\np1\n.')
    _re_amp = _loads("cre\n_compile\np1\n(S'&(?!([A-Za-z]+|#[0-9]+);)'\np2\nI0\ntRp3\n.")
    _attrs_4354359952 = _loads('(dp1\nVclass\np2\nVfa_controls\np3\ns.')
    _attrs_4354361552 = _loads('(dp1\nVclass\np2\nVfa_controls ui-widget-header ui-widget-link ui-corner-all\np3\ns.')
    _attrs_4354361616 = _loads('(dp1\n.')
    _attrs_4354359824 = _loads("(dp1\nVhref\np2\nV#\nsVonclick\np3\nVjQuery(this).parents('form').submit();\np4\nsVclass\np5\nVui-widget-header ui-widget-link ui-widget-button ui-corner-all\np6\ns.")
    _attrs_4354362000 = _loads('(dp1\nVclass\np2\nVui-icon ui-icon-check\np3\ns.')
    _attrs_4354360528 = _loads('(dp1\nVtype\np2\nVsubmit\np3\ns.')
    _init_stream = _loads('cchameleon.core.generation\ninitialize_stream\np1\n.')
    _attrs_4354360080 = _loads('(dp1\nVclass\np2\nVui-icon ui-icon-circle-arrow-w\np3\ns.')
    _init_default = _loads('cchameleon.core.generation\ninitialize_default\np1\n.')
    _attrs_4354360848 = _loads('(dp1\nVname\np2\nV_method\np3\nsVtype\np4\nVhidden\np5\nsVvalue\np6\nVPUT\np7\ns.')
    _init_tal = _loads('cchameleon.core.generation\ninitialize_tal\np1\n.')
    _attrs_4354360144 = _loads('(dp1\nVaction\np2\nV\nsVmethod\np3\nVPOST\np4\nsVenctype\np5\nVmultipart/form-data\np6\ns.')
    def render(econtext, rcontext=None):
        macros = econtext.get('macros')
        _translate = econtext.get('_translate')
        _slots = econtext.get('_slots')
        target_language = econtext.get('target_language')
        u'_init_stream()'
        (_out, _write, ) = _init_stream()
        u'_init_tal()'
        (_attributes, repeat, ) = _init_tal()
        u'_init_default()'
        _default = _init_default()
        u'None'
        default = None
        u'None'
        _domain = None
        u"main.macros['master']"
        _metal = _lookup_attr(econtext['main'], 'macros')['master']
        def _callback_main(econtext, _repeat, _out=_out, _write=_write, _domain=_domain, **_ignored):
            if _repeat:
                repeat.update(_repeat)
            attrs = _attrs_4354311312
            _write(u'<div>\n      ')
            attrs = _attrs_4354360144
            u"''"
            _write(u'<form action="" method="POST" enctype="multipart/form-data">\n        ')
            _default.value = default = ''
            u'fs.render()'
            _content = _lookup_attr(econtext['fs'], 'render')()
            attrs = _attrs_4354361616
            u'_content'
            _write(u'<div>')
            _tmp1 = _content
            _tmp = _tmp1
            if (_tmp.__class__ not in (str, unicode, int, float, )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                _write(_tmp)
            _write(u'</div>\n        ')
            attrs = _attrs_4354360848
            _write(u'<input type="hidden" name="_method" value="PUT" />\n        ')
            attrs = _attrs_4354359952
            _write(u'<div class="fa_controls">\n          ')
            attrs = _attrs_4354359824
            _write(u'<a class="ui-widget-header ui-widget-link ui-widget-button ui-corner-all" href="#" onclick="jQuery(this).parents(\'form\').submit();">\n            ')
            attrs = _attrs_4354362000
            u"''"
            _write(u'<span class="ui-icon ui-icon-check"></span>\n            ')
            _default.value = default = ''
            u'Save'
            _content = u'Save'
            u'_content'
            _tmp1 = _content
            _tmp = _tmp1
            if (_tmp.__class__ not in (str, unicode, int, float, )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                if ('&' in _tmp):
                    if (';' in _tmp):
                        _tmp = _re_amp.sub('&amp;', _tmp)
                    else:
                        _tmp = _tmp.replace('&', '&amp;')
                if ('<' in _tmp):
                    _tmp = _tmp.replace('<', '&lt;')
                if ('>' in _tmp):
                    _tmp = _tmp.replace('>', '&gt;')
                _write(_tmp)
            _write(u'\n            ')
            attrs = _attrs_4354360528
            _write(u'<input type="submit" />\n          </a>\n          ')
            attrs = _attrs_4354361552
            u'request.fa_url(request.model_name)'
            _write(u'<a class="fa_controls ui-widget-header ui-widget-link ui-corner-all"')
            _tmp1 = _lookup_attr(econtext['request'], 'fa_url')(_lookup_attr(econtext['request'], 'model_name'))
            if (_tmp1 is _default):
                _tmp1 = None
            if ((_tmp1 is not None) and (_tmp1 is not False)):
                if (_tmp1.__class__ not in (str, unicode, int, float, )):
                    _tmp1 = unicode(_translate(_tmp1, domain=_domain, mapping=None, target_language=target_language, default=None))
                else:
                    if not isinstance(_tmp1, unicode):
                        _tmp1 = str(_tmp1)
                if ('&' in _tmp1):
                    if (';' in _tmp1):
                        _tmp1 = _re_amp.sub('&amp;', _tmp1)
                    else:
                        _tmp1 = _tmp1.replace('&', '&amp;')
                if ('<' in _tmp1):
                    _tmp1 = _tmp1.replace('<', '&lt;')
                if ('>' in _tmp1):
                    _tmp1 = _tmp1.replace('>', '&gt;')
                if ('"' in _tmp1):
                    _tmp1 = _tmp1.replace('"', '&quot;')
                _write(((' href="' + _tmp1) + '"'))
            _write(u'>\n            ')
            attrs = _attrs_4354360080
            u"''"
            _write(u'<span class="ui-icon ui-icon-circle-arrow-w"></span>\n            ')
            _default.value = default = ''
            u'Cancel'
            _content = u'Cancel'
            u'_content'
            _tmp1 = _content
            _tmp = _tmp1
            if (_tmp.__class__ not in (str, unicode, int, float, )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                if ('&' in _tmp):
                    if (';' in _tmp):
                        _tmp = _re_amp.sub('&amp;', _tmp)
                    else:
                        _tmp = _tmp.replace('&', '&amp;')
                if ('<' in _tmp):
                    _tmp = _tmp.replace('<', '&lt;')
                if ('>' in _tmp):
                    _tmp = _tmp.replace('>', '&gt;')
                _write(_tmp)
            _write(u'\n          </a>\n        </div>\n      </form>\n    </div>\n')
        u"{'main': _callback_main}"
        _tmp = {'main': _callback_main, }
        u"main.macros['master']"
        _metal.render(_tmp, _out=_out, _write=_write, _domain=_domain, econtext=econtext)
        return _out.getvalue()
    return render
コード例 #41
0
def bind():
    from cPickle import loads as _loads
    _lookup_attr = _loads('cchameleon.core.codegen\nlookup_attr\np1\n.')
    _init_scope = _loads('cchameleon.core.utils\necontext\np1\n.')
    _re_amp = _loads(
        "cre\n_compile\np1\n(S'&(?!([A-Za-z]+|#[0-9]+);)'\np2\nI0\ntRp3\n.")
    _attrs_4356515344 = _loads('(dp1\n.')
    _attrs_4356515728 = _loads(
        '(dp1\nVclass\np2\nVui-widget-header ui-widget-link ui-corner-all\np3\ns.'
    )
    _attrs_4356515408 = _loads('(dp1\n.')
    _init_stream = _loads(
        'cchameleon.core.generation\ninitialize_stream\np1\n.')
    _attrs_4356515920 = _loads(
        '(dp1\nVclass\np2\nVui-icon ui-icon-circle-arrow-w\np3\ns.')
    _attrs_4356515664 = _loads(
        '(dp1\nVhref\np2\nV#\nsVclass\np3\nVui-widget-header ui-widget-link ui-widget-button ui-corner-all\np4\ns.'
    )
    _attrs_4356515216 = _loads('(dp1\n.')
    _init_default = _loads(
        'cchameleon.core.generation\ninitialize_default\np1\n.')
    _attrs_4356515536 = _loads('(dp1\nVclass\np2\nVfa_field\np3\ns.')
    _attrs_4356515792 = _loads(
        "(dp1\nVtype\np2\nVsubmit\np3\nsVvalue\np4\nV${F_('Edit')}\np5\ns.")
    _init_tal = _loads('cchameleon.core.generation\ninitialize_tal\np1\n.')

    def render(econtext, rcontext=None):
        macros = econtext.get('macros')
        _translate = econtext.get('_translate')
        _slots = econtext.get('_slots')
        target_language = econtext.get('target_language')
        u'_init_stream()'
        (
            _out,
            _write,
        ) = _init_stream()
        u'_init_tal()'
        (
            _attributes,
            repeat,
        ) = _init_tal()
        u'_init_default()'
        _default = _init_default()
        u'None'
        default = None
        u'None'
        _domain = None
        u"main.macros['master']"
        _metal = _lookup_attr(econtext['main'], 'macros')['master']

        def _callback_main(econtext,
                           _repeat,
                           _out=_out,
                           _write=_write,
                           _domain=_domain,
                           **_ignored):
            if _repeat:
                repeat.update(_repeat)
            attrs = _attrs_4356515216
            u"''"
            _write(u'<div>\n      Custom Foo view\n      ')
            _default.value = default = ''
            u'fs.render()'
            _content = _lookup_attr(econtext['fs'], 'render')()
            attrs = _attrs_4356515344
            u'_content'
            _write(u'<div>')
            _tmp1 = _content
            _tmp = _tmp1
            if (_tmp.__class__ not in (
                    str,
                    unicode,
                    int,
                    float,
            )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp,
                                      domain=_domain,
                                      mapping=None,
                                      target_language=target_language,
                                      default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                _write(_tmp)
            _write(u'</div>\n      ')
            attrs = _attrs_4356515408
            _write(u'<div>\n        ')
            attrs = _attrs_4356515536
            _write(u'<p class="fa_field">\n          ')
            attrs = _attrs_4356515664
            u"request.fa_url(request.model_name, request.model_id, 'edit')"
            _write(
                u'<a class="ui-widget-header ui-widget-link ui-widget-button ui-corner-all"'
            )
            _tmp1 = _lookup_attr(econtext['request'], 'fa_url')(
                _lookup_attr(econtext['request'], 'model_name'),
                _lookup_attr(econtext['request'], 'model_id'), 'edit')
            if (_tmp1 is _default):
                _tmp1 = u'#'
            if ((_tmp1 is not None) and (_tmp1 is not False)):
                if (_tmp1.__class__ not in (
                        str,
                        unicode,
                        int,
                        float,
                )):
                    _tmp1 = unicode(
                        _translate(_tmp1,
                                   domain=_domain,
                                   mapping=None,
                                   target_language=target_language,
                                   default=None))
                else:
                    if not isinstance(_tmp1, unicode):
                        _tmp1 = str(_tmp1)
                if ('&' in _tmp1):
                    if (';' in _tmp1):
                        _tmp1 = _re_amp.sub('&amp;', _tmp1)
                    else:
                        _tmp1 = _tmp1.replace('&', '&amp;')
                if ('<' in _tmp1):
                    _tmp1 = _tmp1.replace('<', '&lt;')
                if ('>' in _tmp1):
                    _tmp1 = _tmp1.replace('>', '&gt;')
                if ('"' in _tmp1):
                    _tmp1 = _tmp1.replace('"', '&quot;')
                _write(((' href="' + _tmp1) + '"'))
            _write(u'>\n              ')
            attrs = _attrs_4356515792
            'join(value("F_(\'Edit\')"),)'
            _write(u'<input type="submit"')
            _tmp1 = econtext['F_']('Edit')
            if (_tmp1 is _default):
                _tmp1 = u"${F_('Edit')}"
            if ((_tmp1 is not None) and (_tmp1 is not False)):
                if (_tmp1.__class__ not in (
                        str,
                        unicode,
                        int,
                        float,
                )):
                    _tmp1 = unicode(
                        _translate(_tmp1,
                                   domain=_domain,
                                   mapping=None,
                                   target_language=target_language,
                                   default=None))
                else:
                    if not isinstance(_tmp1, unicode):
                        _tmp1 = str(_tmp1)
                if ('&' in _tmp1):
                    if (';' in _tmp1):
                        _tmp1 = _re_amp.sub('&amp;', _tmp1)
                    else:
                        _tmp1 = _tmp1.replace('&', '&amp;')
                if ('<' in _tmp1):
                    _tmp1 = _tmp1.replace('<', '&lt;')
                if ('>' in _tmp1):
                    _tmp1 = _tmp1.replace('>', '&gt;')
                if ('"' in _tmp1):
                    _tmp1 = _tmp1.replace('"', '&quot;')
                _write(((' value="' + _tmp1) + '"'))
            _write(u' />\n          </a>\n          ')
            attrs = _attrs_4356515728
            u'request.fa_url(request.model_name)'
            _write(u'<a class="ui-widget-header ui-widget-link ui-corner-all"')
            _tmp1 = _lookup_attr(econtext['request'], 'fa_url')(_lookup_attr(
                econtext['request'], 'model_name'))
            if (_tmp1 is _default):
                _tmp1 = None
            if ((_tmp1 is not None) and (_tmp1 is not False)):
                if (_tmp1.__class__ not in (
                        str,
                        unicode,
                        int,
                        float,
                )):
                    _tmp1 = unicode(
                        _translate(_tmp1,
                                   domain=_domain,
                                   mapping=None,
                                   target_language=target_language,
                                   default=None))
                else:
                    if not isinstance(_tmp1, unicode):
                        _tmp1 = str(_tmp1)
                if ('&' in _tmp1):
                    if (';' in _tmp1):
                        _tmp1 = _re_amp.sub('&amp;', _tmp1)
                    else:
                        _tmp1 = _tmp1.replace('&', '&amp;')
                if ('<' in _tmp1):
                    _tmp1 = _tmp1.replace('<', '&lt;')
                if ('>' in _tmp1):
                    _tmp1 = _tmp1.replace('>', '&gt;')
                if ('"' in _tmp1):
                    _tmp1 = _tmp1.replace('"', '&quot;')
                _write(((' href="' + _tmp1) + '"'))
            _write(u'>\n            ')
            attrs = _attrs_4356515920
            u"F_('Back')"
            _write(
                u'<span class="ui-icon ui-icon-circle-arrow-w"></span>\n            '
            )
            _tmp1 = econtext['F_']('Back')
            _tmp = _tmp1
            if (_tmp.__class__ not in (
                    str,
                    unicode,
                    int,
                    float,
            )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp,
                                      domain=_domain,
                                      mapping=None,
                                      target_language=target_language,
                                      default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                if ('&' in _tmp):
                    if (';' in _tmp):
                        _tmp = _re_amp.sub('&amp;', _tmp)
                    else:
                        _tmp = _tmp.replace('&', '&amp;')
                if ('<' in _tmp):
                    _tmp = _tmp.replace('<', '&lt;')
                if ('>' in _tmp):
                    _tmp = _tmp.replace('>', '&gt;')
                _write(_tmp)
            _write(
                u'\n          </a>\n        </p>\n      </div>\n    </div>\n')

        u"{'main': _callback_main}"
        _tmp = {
            'main': _callback_main,
        }
        u"main.macros['master']"
        _metal.render(_tmp,
                      _out=_out,
                      _write=_write,
                      _domain=_domain,
                      econtext=econtext)
        return _out.getvalue()

    return render
コード例 #42
0
def bind():
    from cPickle import loads as _loads
    _lookup_attr = _loads('cchameleon.core.codegen\nlookup_attr\np1\n.')
    _init_scope = _loads('cchameleon.core.utils\necontext\np1\n.')
    _attrs_4362312784 = _loads('(dp1\n.')
    _init_stream = _loads(
        'cchameleon.core.generation\ninitialize_stream\np1\n.')
    _attrs_4362313104 = _loads('(dp1\n.')
    _init_default = _loads(
        'cchameleon.core.generation\ninitialize_default\np1\n.')
    _attrs_4362312976 = _loads('(dp1\n.')
    _init_tal = _loads('cchameleon.core.generation\ninitialize_tal\np1\n.')
    _attrs_4362313296 = _loads('(dp1\nVclass\np2\nVfa_field\np3\ns.')

    def render(econtext, rcontext=None):
        macros = econtext.get('macros')
        _translate = econtext.get('_translate')
        _slots = econtext.get('_slots')
        target_language = econtext.get('target_language')
        u'_init_stream()'
        (
            _out,
            _write,
        ) = _init_stream()
        u'_init_tal()'
        (
            _attributes,
            repeat,
        ) = _init_tal()
        u'_init_default()'
        _default = _init_default()
        u'None'
        default = None
        u'None'
        _domain = None
        u"main.macros['master']"
        _metal = _lookup_attr(econtext['main'], 'macros')['master']

        def _callback_main(econtext,
                           _repeat,
                           _out=_out,
                           _write=_write,
                           _domain=_domain,
                           **_ignored):
            if _repeat:
                repeat.update(_repeat)
            attrs = _attrs_4362312784
            u"''"
            _write(u'<div>\n      ')
            _default.value = default = ''
            u'fs.render()'
            _content = _lookup_attr(econtext['fs'], 'render')()
            attrs = _attrs_4362312976
            u'_content'
            _write(u'<div>')
            _tmp1 = _content
            _tmp = _tmp1
            if (_tmp.__class__ not in (
                    str,
                    unicode,
                    int,
                    float,
            )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp,
                                      domain=_domain,
                                      mapping=None,
                                      target_language=target_language,
                                      default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                _write(_tmp)
            _write(u'</div>\n      ')
            attrs = _attrs_4362313104
            u"u'\\n      '"
            _write(u'<div>\n      ')
            _default.value = default = u'\n      '
            u'actions.buttons(request)'
            _content = _lookup_attr(econtext['actions'],
                                    'buttons')(econtext['request'])
            attrs = _attrs_4362313296
            u'_content'
            _write(u'<p class="fa_field">')
            _tmp1 = _content
            _tmp = _tmp1
            if (_tmp.__class__ not in (
                    str,
                    unicode,
                    int,
                    float,
            )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp,
                                      domain=_domain,
                                      mapping=None,
                                      target_language=target_language,
                                      default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                _write(_tmp)
            _write(u'</p>\n      </div>\n    </div>\n')

        u"{'main': _callback_main}"
        _tmp = {
            'main': _callback_main,
        }
        u"main.macros['master']"
        _metal.render(_tmp,
                      _out=_out,
                      _write=_write,
                      _domain=_domain,
                      econtext=econtext)
        return _out.getvalue()

    return render
コード例 #43
0
ファイル: index.pt.py プロジェクト: FormAlchemy/fa.extjs
def bind():
    from cPickle import loads as _loads
    _lookup_attr = _loads('cchameleon.core.codegen\nlookup_attr\np1\n.')
    _init_scope = _loads('cchameleon.core.utils\necontext\np1\n.')
    _re_amp = _loads("cre\n_compile\np1\n(S'&(?!([A-Za-z]+|#[0-9]+);)'\np2\nI0\ntRp3\n.")
    _attrs_4301940368 = _loads('(dp1\n.')
    _init_stream = _loads('cchameleon.core.generation\ninitialize_stream\np1\n.')
    _attrs_4301940176 = _loads('(dp1\n.')
    _attrs_4301940496 = _loads('(dp1\n.')
    _init_default = _loads('cchameleon.core.generation\ninitialize_default\np1\n.')
    _attrs_4301940816 = _loads('(dp1\nVname\np2\nVroot_url\np3\nsVtype\np4\nVhidden\np5\nsVvalue\np6\nV${request.fa_url()}\np7\ns.')
    _attrs_4301940688 = _loads('(dp1\n.')
    _init_tal = _loads('cchameleon.core.generation\ninitialize_tal\np1\n.')
    def render(econtext, rcontext=None):
        macros = econtext.get('macros')
        _translate = econtext.get('_translate')
        _slots = econtext.get('_slots')
        target_language = econtext.get('target_language')
        u'_init_stream()'
        (_out, _write, ) = _init_stream()
        u'_init_tal()'
        (_attributes, repeat, ) = _init_tal()
        u'_init_default()'
        _default = _init_default()
        u'None'
        default = None
        u'None'
        _domain = None
        attrs = _attrs_4301940176
        _write(u'<html>\n    ')
        attrs = _attrs_4301940368
        _write(u'<head>\n    </head>\n    ')
        attrs = _attrs_4301940496
        _write(u'<body>\n        ')
        attrs = _attrs_4301940688
        _write(u'<div>\n        </div>\n        ')
        attrs = _attrs_4301940816
        "join(value('request.fa_url()'),)"
        _write(u'<input type="hidden" name="root_url"')
        _tmp1 = _lookup_attr(econtext['request'], 'fa_url')()
        if (_tmp1 is _default):
            _tmp1 = u'${request.fa_url()}'
        if ((_tmp1 is not None) and (_tmp1 is not False)):
            if (_tmp1.__class__ not in (str, unicode, int, float, )):
                _tmp1 = unicode(_translate(_tmp1, domain=_domain, mapping=None, target_language=target_language, default=None))
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if ('&' in _tmp1):
                if (';' in _tmp1):
                    _tmp1 = _re_amp.sub('&amp;', _tmp1)
                else:
                    _tmp1 = _tmp1.replace('&', '&amp;')
            if ('<' in _tmp1):
                _tmp1 = _tmp1.replace('<', '&lt;')
            if ('>' in _tmp1):
                _tmp1 = _tmp1.replace('>', '&gt;')
            if ('"' in _tmp1):
                _tmp1 = _tmp1.replace('"', '&quot;')
            _write(((' value="' + _tmp1) + '"'))
        _write(u' />\n    </body>\n</html>')
        return _out.getvalue()
    return render
コード例 #44
0
ファイル: index.pt.py プロジェクト: ellimistd/pyquiz
def bind():
    from cPickle import loads as _loads
    _lookup_attr = _loads('cchameleon.core.codegen\nlookup_attr\np1\n.')
    _re_amp = _loads("cre\n_compile\np1\n(S'&(?!([A-Za-z]+|#[0-9]+);)'\np2\nI0\ntRp3\n.")
    _attrs_71820816 = _loads('(dp1\nVclass\np2\nVapp-welcome\np3\ns.')
    _init_stream = _loads('cchameleon.core.generation\ninitialize_stream\np1\n.')
    _attrs_71819984 = _loads('(dp1\n.')
    _attrs_71819408 = _loads('(dp1\n.')
    _attrs_71820624 = _loads('(dp1\nVclass\np2\nVmiddle align-center\np3\ns.')
    _attrs_71821136 = _loads('(dp1\n.')
    _attrs_71274448 = _loads('(dp1\nVxml:lang\np2\nVen\np3\nsVxmlns\np4\nVhttp://www.w3.org/1999/xhtml\np5\ns.')
    _attrs_71819728 = _loads('(dp1\nVcontent\np2\nVpyramid web application\np3\nsVname\np4\nVdescription\np5\ns.')
    _init_default = _loads('cchameleon.core.generation\ninitialize_default\np1\n.')
    _attrs_71819856 = _loads("(dp1\nVhref\np2\nV${request.static_url('pyquiz:static/favicon.ico')}\np3\nsVrel\np4\nVshortcut icon\np5\ns.")
    _init_tal = _loads('cchameleon.core.generation\ninitialize_tal\np1\n.')
    _attrs_71819600 = _loads('(dp1\nVcontent\np2\nVpython web application\np3\nsVname\np4\nVkeywords\np5\ns.')
    _attrs_71821456 = _loads('(dp1\n.')
    _attrs_71821200 = _loads('(dp1\nVhref\np2\nV/form\np3\ns.')
    _attrs_71821008 = _loads('(dp1\nVclass\np2\nVapp-name\np3\ns.')
    _init_scope = _loads('cchameleon.core.utils\necontext\np1\n.')
    _attrs_71820432 = _loads('(dp1\nVid\np2\nVmiddle\np3\ns.')
    _attrs_71819536 = _loads('(dp1\nVcontent\np2\nVtext/html;charset=UTF-8\np3\nsVhttp-equiv\np4\nVContent-Type\np5\ns.')
    _attrs_71820240 = _loads('(dp1\nVid\np2\nVwrap\np3\ns.')
    _attrs_71821328 = _loads('(dp1\n.')
    _attrs_71821840 = _loads('(dp1\nVhref\np2\nV${test.url}\np3\ns.')
    _attrs_71821648 = _loads('(dp1\n.')
    _attrs_71820048 = _loads('(dp1\n.')
    _attrs_71819472 = _loads('(dp1\n.')
    def render(econtext, rcontext=None):
        macros = econtext.get('macros')
        _translate = econtext.get('_translate')
        _slots = econtext.get('_slots')
        target_language = econtext.get('target_language')
        u'_init_stream()'
        (_out, _write, ) = _init_stream()
        u'_init_tal()'
        (_attributes, repeat, ) = _init_tal()
        u'_init_default()'
        _default = _init_default()
        u'None'
        default = None
        u'None'
        _domain = None
        _write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n')
        attrs = _attrs_71274448
        _write(u'<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">\n')
        attrs = _attrs_71819408
        _write(u'<head>\n  ')
        attrs = _attrs_71819472
        _write(u'<title>Pyquiz</title>\n  ')
        attrs = _attrs_71819536
        _write(u'<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />\n  ')
        attrs = _attrs_71819600
        _write(u'<meta name="keywords" content="python web application" />\n  ')
        attrs = _attrs_71819728
        _write(u'<meta name="description" content="pyramid web application" />\n  ')
        attrs = _attrs_71819856
        'join(value("request.static_url(\'pyquiz:static/favicon.ico\')"),)'
        _write(u'<link rel="shortcut icon"')
        _tmp1 = _lookup_attr(econtext['request'], 'static_url')('pyquiz:static/favicon.ico')
        if (_tmp1 is _default):
            _tmp1 = u"${request.static_url('pyquiz:static/favicon.ico')}"
        if ((_tmp1 is not None) and (_tmp1 is not False)):
            if (_tmp1.__class__ not in (str, unicode, int, float, )):
                _tmp1 = unicode(_translate(_tmp1, domain=_domain, mapping=None, target_language=target_language, default=None))
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if ('&' in _tmp1):
                if (';' in _tmp1):
                    _tmp1 = _re_amp.sub('&amp;', _tmp1)
                else:
                    _tmp1 = _tmp1.replace('&', '&amp;')
            if ('<' in _tmp1):
                _tmp1 = _tmp1.replace('<', '&lt;')
            if ('>' in _tmp1):
                _tmp1 = _tmp1.replace('>', '&gt;')
            if ('"' in _tmp1):
                _tmp1 = _tmp1.replace('"', '&quot;')
            _write(((' href="' + _tmp1) + '"'))
        _write(u' />\n  ')
        attrs = _attrs_71819984
        _write(u'<h1>Pyquiz</h1>\n</head>\n')
        attrs = _attrs_71820048
        _write(u'<body>\n  ')
        attrs = _attrs_71820240
        _write(u'<div id="wrap">\n\n    ')
        attrs = _attrs_71820432
        _write(u'<div id="middle">\n      ')
        attrs = _attrs_71820624
        _write(u'<div class="middle align-center">\n        ')
        attrs = _attrs_71820816
        _write(u'<p class="app-welcome">\n          Welcome to ')
        attrs = _attrs_71821008
        u'project'
        _write(u'<span class="app-name">')
        _tmp1 = econtext['project']
        _tmp = _tmp1
        if (_tmp.__class__ not in (str, unicode, int, float, )):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if (_tmp is not None):
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            if ('&' in _tmp):
                if (';' in _tmp):
                    _tmp = _re_amp.sub('&amp;', _tmp)
                else:
                    _tmp = _tmp.replace('&', '&amp;')
            if ('<' in _tmp):
                _tmp = _tmp.replace('<', '&lt;')
            if ('>' in _tmp):
                _tmp = _tmp.replace('>', '&gt;')
            _write(_tmp)
        _write(u'</span>, an application generated by')
        attrs = _attrs_71821136
        _write(u'<br />\n          the Pyramid web application development framework.\n        </p>\n\n        ')
        attrs = _attrs_71821200
        _write(u'<a href="/form">Create new test</a>\n        ')
        attrs = _attrs_71821328
        u'tests'
        _write(u'<h3>Current Tests</h3>\n        ')
        _tmp1 = econtext['tests']
        test = None
        (_tmp1, _tmp2, ) = repeat.insert('test', _tmp1)
        for test in _tmp1:
            _tmp2 = (_tmp2 - 1)
            attrs = _attrs_71821456
            _write(u'<ul>\n            ')
            attrs = _attrs_71821648
            _write(u'<li>')
            attrs = _attrs_71821840
            "join(value('test.url'),)"
            _write(u'<a')
            _tmp3 = _lookup_attr(test, 'url')
            if (_tmp3 is _default):
                _tmp3 = u'${test.url}'
            if ((_tmp3 is not None) and (_tmp3 is not False)):
                if (_tmp3.__class__ not in (str, unicode, int, float, )):
                    _tmp3 = unicode(_translate(_tmp3, domain=_domain, mapping=None, target_language=target_language, default=None))
                else:
                    if not isinstance(_tmp3, unicode):
                        _tmp3 = str(_tmp3)
                if ('&' in _tmp3):
                    if (';' in _tmp3):
                        _tmp3 = _re_amp.sub('&amp;', _tmp3)
                    else:
                        _tmp3 = _tmp3.replace('&', '&amp;')
                if ('<' in _tmp3):
                    _tmp3 = _tmp3.replace('<', '&lt;')
                if ('>' in _tmp3):
                    _tmp3 = _tmp3.replace('>', '&gt;')
                if ('"' in _tmp3):
                    _tmp3 = _tmp3.replace('"', '&quot;')
                _write(((' href="' + _tmp3) + '"'))
            u'test.name'
            _write('>')
            _tmp3 = _lookup_attr(test, 'name')
            _tmp = _tmp3
            if (_tmp.__class__ not in (str, unicode, int, float, )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                if ('&' in _tmp):
                    if (';' in _tmp):
                        _tmp = _re_amp.sub('&amp;', _tmp)
                    else:
                        _tmp = _tmp.replace('&', '&amp;')
                if ('<' in _tmp):
                    _tmp = _tmp.replace('<', '&lt;')
                if ('>' in _tmp):
                    _tmp = _tmp.replace('>', '&gt;')
                _write(_tmp)
            _write(u'</a></li>\n        </ul>')
            if (_tmp2 == 0):
                break
            _write(' ')
        _write(u'\n      </div>\n    </div>\n  </div>\n</body>\n</html>')
        return _out.getvalue()
    return render
コード例 #45
0
ファイル: listing.pt.py プロジェクト: bkocherov/fa.jquery
def bind():
    from cPickle import loads as _loads
    _lookup_attr = _loads('cchameleon.core.codegen\nlookup_attr\np1\n.')
    _attrs_4354394384 = _loads('(dp1\n.')
    _init_scope = _loads('cchameleon.core.utils\necontext\np1\n.')
    _re_amp = _loads("cre\n_compile\np1\n(S'&(?!([A-Za-z]+|#[0-9]+);)'\np2\nI0\ntRp3\n.")
    _attrs_4354395152 = _loads('(dp1\nVclass\np2\nVui-icon ui-icon-circle-plus\np3\ns.')
    _attrs_4354394192 = _loads('(dp1\n.')
    _attrs_4354393808 = _loads('(dp1\nVlanguage\np2\nVjavascript\np3\ns.')
    _attrs_4354393872 = _loads('(dp1\n.')
    _init_stream = _loads('cchameleon.core.generation\ninitialize_stream\np1\n.')
    _attrs_4354393424 = _loads('(dp1\nVclass\np2\nVui-widget-header ui-widget-link ui-corner-all\np3\ns.')
    _init_default = _loads('cchameleon.core.generation\ninitialize_default\np1\n.')
    _init_tal = _loads('cchameleon.core.generation\ninitialize_tal\np1\n.')
    def render(econtext, rcontext=None):
        macros = econtext.get('macros')
        _translate = econtext.get('_translate')
        _slots = econtext.get('_slots')
        target_language = econtext.get('target_language')
        u'_init_stream()'
        (_out, _write, ) = _init_stream()
        u'_init_tal()'
        (_attributes, repeat, ) = _init_tal()
        u'_init_default()'
        _default = _init_default()
        u'None'
        default = None
        u'None'
        _domain = None
        u"main.macros['master']"
        _metal = _lookup_attr(econtext['main'], 'macros')['master']
        def _callback_main(econtext, _repeat, _out=_out, _write=_write, _domain=_domain, **_ignored):
            if _repeat:
                repeat.update(_repeat)
            attrs = _attrs_4354394192
            _write(u'<div>\n      ')
            attrs = _attrs_4354393808
            u"request.registry.settings.get('fa.use_popup') and 'true' or 'false'"
            _write(u'<script language="javascript">\n        var USE_POPUP = ')
            _tmp1 = ((_lookup_attr(_lookup_attr(_lookup_attr(econtext['request'], 'registry'), 'settings'), 'get')('fa.use_popup') and 'true') or 'false')
            _tmp = _tmp1
            if (_tmp.__class__ not in (str, unicode, int, float, )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                if ('&' in _tmp):
                    if (';' in _tmp):
                        _tmp = _re_amp.sub('&amp;', _tmp)
                    else:
                        _tmp = _tmp.replace('&', '&amp;')
                if ('<' in _tmp):
                    _tmp = _tmp.replace('<', '&lt;')
                if ('>' in _tmp):
                    _tmp = _tmp.replace('>', '&gt;')
                _write(_tmp)
            u"''"
            _write(u';\n      </script>\n      ')
            _default.value = default = ''
            u"fs.render(renderer='fa.jquery:templates/forms/jqgrid.pt', request=request)"
            _content = _lookup_attr(econtext['fs'], 'render')(renderer='fa.jquery:templates/forms/jqgrid.pt', request=econtext['request'])
            attrs = _attrs_4354393872
            u'_content'
            _write(u'<div>')
            _tmp1 = _content
            _tmp = _tmp1
            if (_tmp.__class__ not in (str, unicode, int, float, )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                _write(_tmp)
            _write(u'</div>\n      ')
            attrs = _attrs_4354394384
            _write(u'<p>\n        ')
            attrs = _attrs_4354393424
            u"request.route_url(request.route_name, traverse='%s/new' % request.model_name)"
            _write(u'<a class="ui-widget-header ui-widget-link ui-corner-all"')
            _tmp1 = _lookup_attr(econtext['request'], 'route_url')(_lookup_attr(econtext['request'], 'route_name'), traverse=('%s/new' % _lookup_attr(econtext['request'], 'model_name')))
            if (_tmp1 is _default):
                _tmp1 = None
            if ((_tmp1 is not None) and (_tmp1 is not False)):
                if (_tmp1.__class__ not in (str, unicode, int, float, )):
                    _tmp1 = unicode(_translate(_tmp1, domain=_domain, mapping=None, target_language=target_language, default=None))
                else:
                    if not isinstance(_tmp1, unicode):
                        _tmp1 = str(_tmp1)
                if ('&' in _tmp1):
                    if (';' in _tmp1):
                        _tmp1 = _re_amp.sub('&amp;', _tmp1)
                    else:
                        _tmp1 = _tmp1.replace('&', '&amp;')
                if ('<' in _tmp1):
                    _tmp1 = _tmp1.replace('<', '&lt;')
                if ('>' in _tmp1):
                    _tmp1 = _tmp1.replace('>', '&gt;')
                if ('"' in _tmp1):
                    _tmp1 = _tmp1.replace('"', '&quot;')
                _write(((' href="' + _tmp1) + '"'))
            _write(u'>\n            ')
            attrs = _attrs_4354395152
            u"F_('New')"
            _write(u'<span class="ui-icon ui-icon-circle-plus"></span>\n            ')
            _tmp1 = econtext['F_']('New')
            _tmp = _tmp1
            if (_tmp.__class__ not in (str, unicode, int, float, )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                if ('&' in _tmp):
                    if (';' in _tmp):
                        _tmp = _re_amp.sub('&amp;', _tmp)
                    else:
                        _tmp = _tmp.replace('&', '&amp;')
                if ('<' in _tmp):
                    _tmp = _tmp.replace('<', '&lt;')
                if ('>' in _tmp):
                    _tmp = _tmp.replace('>', '&gt;')
                _write(_tmp)
            u'model_name'
            _write(u' ')
            _tmp1 = econtext['model_name']
            _tmp = _tmp1
            if (_tmp.__class__ not in (str, unicode, int, float, )):
                try:
                    _tmp = _tmp.__html__
                except:
                    _tmp = _translate(_tmp, domain=_domain, mapping=None, target_language=target_language, default=None)
                else:
                    _tmp = _tmp()
                    _write(_tmp)
                    _tmp = None
            if (_tmp is not None):
                if not isinstance(_tmp, unicode):
                    _tmp = str(_tmp)
                if ('&' in _tmp):
                    if (';' in _tmp):
                        _tmp = _re_amp.sub('&amp;', _tmp)
                    else:
                        _tmp = _tmp.replace('&', '&amp;')
                if ('<' in _tmp):
                    _tmp = _tmp.replace('<', '&lt;')
                if ('>' in _tmp):
                    _tmp = _tmp.replace('>', '&gt;')
                _write(_tmp)
            _write(u'\n        </a>\n      </p>\n    </div>\n')
        u"{'main': _callback_main}"
        _tmp = {'main': _callback_main, }
        u"main.macros['master']"
        _metal.render(_tmp, _out=_out, _write=_write, _domain=_domain, econtext=econtext)
        return _out.getvalue()
    return render
コード例 #46
0
def bind():
    from cPickle import loads as _loads
    _lookup_attr = _loads('cchameleon.core.codegen\nlookup_attr\np1\n.')
    _init_scope = _loads('cchameleon.core.utils\necontext\np1\n.')
    _re_amp = _loads(
        "cre\n_compile\np1\n(S'&(?!([A-Za-z]+|#[0-9]+);)'\np2\nI0\ntRp3\n.")
    _attrs_4355399760 = _loads('(dp1\n.')
    _attrs_4355400208 = _loads(
        '(dp1\nVclass\np2\nVfa_instructions ui-corner-all\np3\ns.')
    _attrs_4355399888 = _loads('(dp1\n.')
    _attrs_4355400144 = _loads('(dp1\nVclass\np2\nVlabel\np3\ns.')
    _init_stream = _loads(
        'cchameleon.core.generation\ninitialize_stream\np1\n.')
    _init_default = _loads(
        'cchameleon.core.generation\ninitialize_default\np1\n.')
    _attrs_4355400400 = _loads(
        '(dp1\nVclass\np2\nVui-state-error ui-corner-all\np3\ns.')
    _attrs_4355400080 = _loads('(dp1\n.')
    _attrs_4355400464 = _loads('(dp1\nVclass\np2\nVfield_input\np3\ns.')
    _attrs_4355400528 = _loads('(dp1\n.')
    _attrs_4355400016 = _loads('(dp1\nVclass\np2\nVfa_field ui-widget\np3\ns.')
    _init_tal = _loads('cchameleon.core.generation\ninitialize_tal\np1\n.')
    _attrs_4355400272 = _loads('(dp1\n.')

    def render(econtext, rcontext=None):
        macros = econtext.get('macros')
        _translate = econtext.get('_translate')
        _slots = econtext.get('_slots')
        target_language = econtext.get('target_language')
        u'_init_stream()'
        (
            _out,
            _write,
        ) = _init_stream()
        u'_init_tal()'
        (
            _attributes,
            repeat,
        ) = _init_tal()
        u'_init_default()'
        _default = _init_default()
        u'None'
        default = None
        u'None'
        _domain = None
        u'False'
        focus_rendered = False
        u'fieldset.errors.get(None, False)'
        _write(u'\n')
        _tmp1 = _lookup_attr(_lookup_attr(econtext['fieldset'], 'errors'),
                             'get')(None, False)
        if _tmp1:
            pass
            attrs = _attrs_4355399760
            u"''"
            _write(u'<div>\n  ')
            _default.value = default = ''
            u'fieldset.error.get(None)'
            _tmp1 = _lookup_attr(_lookup_attr(econtext['fieldset'], 'error'),
                                 'get')(None)
            error = None
            (
                _tmp1,
                _tmp2,
            ) = repeat.insert('error', _tmp1)
            for error in _tmp1:
                _tmp2 = (_tmp2 - 1)
                u'error'
                _content = error
                attrs = _attrs_4355399888
                u'_content'
                _write(u'<div>')
                _tmp3 = _content
                _tmp = _tmp3
                if (_tmp.__class__ not in (
                        str,
                        unicode,
                        int,
                        float,
                )):
                    try:
                        _tmp = _tmp.__html__
                    except:
                        _tmp = _translate(_tmp,
                                          domain=_domain,
                                          mapping=None,
                                          target_language=target_language,
                                          default=None)
                    else:
                        _tmp = _tmp()
                        _write(_tmp)
                        _tmp = None
                if (_tmp is not None):
                    if not isinstance(_tmp, unicode):
                        _tmp = str(_tmp)
                    if ('&' in _tmp):
                        if (';' in _tmp):
                            _tmp = _re_amp.sub('&amp;', _tmp)
                        else:
                            _tmp = _tmp.replace('&', '&amp;')
                    if ('<' in _tmp):
                        _tmp = _tmp.replace('<', '&lt;')
                    if ('>' in _tmp):
                        _tmp = _tmp.replace('>', '&gt;')
                    _write(_tmp)
                _write(u'</div>')
                if (_tmp2 == 0):
                    break
                _write(' ')
            _write(u'\n</div>')
        u'fieldset.render_fields.itervalues()'
        _write(u'\n\n')
        _tmp1 = _lookup_attr(
            _lookup_attr(econtext['fieldset'], 'render_fields'),
            'itervalues')()
        field = None
        (
            _tmp1,
            _tmp2,
        ) = repeat.insert('field', _tmp1)
        for field in _tmp1:
            _tmp2 = (_tmp2 - 1)
            _write(u'\n  ')
            attrs = _attrs_4355400016
            u'field.requires_label'
            _write(u'<div class="fa_field ui-widget">\n    ')
            _tmp3 = _lookup_attr(field, 'requires_label')
            if _tmp3:
                pass
                attrs = _attrs_4355400144
                u"''"
                _write(u'<div class="label">\n      ')
                _default.value = default = ''
                u'isinstance(field.type, fatypes.Boolean)'
                _tmp3 = isinstance(
                    _lookup_attr(field, 'type'),
                    _lookup_attr(econtext['fatypes'], 'Boolean'))
                if _tmp3:
                    pass
                    u'field.render()'
                    _content = _lookup_attr(field, 'render')()
                    attrs = _attrs_4355400272
                    u'_content'
                    _write(u'<div>')
                    _tmp3 = _content
                    _tmp = _tmp3
                    if (_tmp.__class__ not in (
                            str,
                            unicode,
                            int,
                            float,
                    )):
                        try:
                            _tmp = _tmp.__html__
                        except:
                            _tmp = _translate(_tmp,
                                              domain=_domain,
                                              mapping=None,
                                              target_language=target_language,
                                              default=None)
                        else:
                            _tmp = _tmp()
                            _write(_tmp)
                            _tmp = None
                    if (_tmp is not None):
                        if not isinstance(_tmp, unicode):
                            _tmp = str(_tmp)
                        _write(_tmp)
                    _write(u'</div>')
                u"''"
                _write(u'\n      ')
                _default.value = default = ''
                u'field.label_tag()'
                _content = _lookup_attr(field, 'label_tag')()
                u'_content'
                _tmp3 = _content
                _tmp = _tmp3
                if (_tmp.__class__ not in (
                        str,
                        unicode,
                        int,
                        float,
                )):
                    try:
                        _tmp = _tmp.__html__
                    except:
                        _tmp = _translate(_tmp,
                                          domain=_domain,
                                          mapping=None,
                                          target_language=target_language,
                                          default=None)
                    else:
                        _tmp = _tmp()
                        _write(_tmp)
                        _tmp = None
                if (_tmp is not None):
                    if not isinstance(_tmp, unicode):
                        _tmp = str(_tmp)
                    _write(_tmp)
                _write(u'\n    </div>')
            u"u'\\n    '"
            _write(u'\n    ')
            _default.value = default = u'\n    '
            u"'instructions' in field.metadata"
            _tmp3 = ('instructions' in _lookup_attr(field, 'metadata'))
            if _tmp3:
                pass
                u"field.metadata['instructions']"
                _content = _lookup_attr(field, 'metadata')['instructions']
                attrs = _attrs_4355400208
                u'_content'
                _write(u'<div class="fa_instructions ui-corner-all">')
                _tmp3 = _content
                _tmp = _tmp3
                if (_tmp.__class__ not in (
                        str,
                        unicode,
                        int,
                        float,
                )):
                    try:
                        _tmp = _tmp.__html__
                    except:
                        _tmp = _translate(_tmp,
                                          domain=_domain,
                                          mapping=None,
                                          target_language=target_language,
                                          default=None)
                    else:
                        _tmp = _tmp()
                        _write(_tmp)
                        _tmp = None
                if (_tmp is not None):
                    if not isinstance(_tmp, unicode):
                        _tmp = str(_tmp)
                    if ('&' in _tmp):
                        if (';' in _tmp):
                            _tmp = _re_amp.sub('&amp;', _tmp)
                        else:
                            _tmp = _tmp.replace('&', '&amp;')
                    if ('<' in _tmp):
                        _tmp = _tmp.replace('<', '&lt;')
                    if ('>' in _tmp):
                        _tmp = _tmp.replace('>', '&gt;')
                    _write(_tmp)
                _write(u'</div>')
            u'field.errors'
            _write(u'\n    ')
            _tmp3 = _lookup_attr(field, 'errors')
            if _tmp3:
                pass
                attrs = _attrs_4355400400
                u"''"
                _write(u'<div class="ui-state-error ui-corner-all">\n      ')
                _default.value = default = ''
                u'field.errors'
                _tmp3 = _lookup_attr(field, 'errors')
                error = None
                (
                    _tmp3,
                    _tmp4,
                ) = repeat.insert('error', _tmp3)
                for error in _tmp3:
                    _tmp4 = (_tmp4 - 1)
                    u'error'
                    _content = error
                    attrs = _attrs_4355400528
                    u'_content'
                    _write(u'<div>')
                    _tmp5 = _content
                    _tmp = _tmp5
                    if (_tmp.__class__ not in (
                            str,
                            unicode,
                            int,
                            float,
                    )):
                        try:
                            _tmp = _tmp.__html__
                        except:
                            _tmp = _translate(_tmp,
                                              domain=_domain,
                                              mapping=None,
                                              target_language=target_language,
                                              default=None)
                        else:
                            _tmp = _tmp()
                            _write(_tmp)
                            _tmp = None
                    if (_tmp is not None):
                        if not isinstance(_tmp, unicode):
                            _tmp = str(_tmp)
                        if ('&' in _tmp):
                            if (';' in _tmp):
                                _tmp = _re_amp.sub('&amp;', _tmp)
                            else:
                                _tmp = _tmp.replace('&', '&amp;')
                        if ('<' in _tmp):
                            _tmp = _tmp.replace('<', '&lt;')
                        if ('>' in _tmp):
                            _tmp = _tmp.replace('>', '&gt;')
                        _write(_tmp)
                    _write(u'</div>')
                    if (_tmp4 == 0):
                        break
                    _write(' ')
                _write(u'\n    </div>')
            u"''"
            _write(u'\n    ')
            _default.value = default = ''
            u'not isinstance(field.type, fatypes.Boolean)'
            _tmp3 = not isinstance(
                _lookup_attr(field, 'type'),
                _lookup_attr(econtext['fatypes'], 'Boolean'))
            if _tmp3:
                pass
                u'field.render()'
                _content = _lookup_attr(field, 'render')()
                attrs = _attrs_4355400464
                u'_content'
                _write(u'<div class="field_input">')
                _tmp3 = _content
                _tmp = _tmp3
                if (_tmp.__class__ not in (
                        str,
                        unicode,
                        int,
                        float,
                )):
                    try:
                        _tmp = _tmp.__html__
                    except:
                        _tmp = _translate(_tmp,
                                          domain=_domain,
                                          mapping=None,
                                          target_language=target_language,
                                          default=None)
                    else:
                        _tmp = _tmp()
                        _write(_tmp)
                        _tmp = None
                if (_tmp is not None):
                    if not isinstance(_tmp, unicode):
                        _tmp = str(_tmp)
                    _write(_tmp)
                _write(u'</div>')
            u'not field.is_readonly() and (fieldset.focus == field or fieldset.focus is True) and not focus_rendered'
            _write(u'\n  </div>\n  ')
            _tmp3 = (not _lookup_attr(field, 'is_readonly')() and
                     ((_lookup_attr(econtext['fieldset'], 'focus') == field) or
                      (_lookup_attr(econtext['fieldset'], 'focus') is True))
                     and not focus_rendered)
            if _tmp3:
                pass
                attrs = _attrs_4355400080
                u'True'
                _write(u'<script>\n    ')
                focus_rendered = True
                u'field.renderer.name'
                _write(
                    u'\n    jQuery(document).ready(function(){jQuery("[name=\''
                )
                _tmp3 = _lookup_attr(_lookup_attr(field, 'renderer'), 'name')
                _tmp = _tmp3
                if (_tmp.__class__ not in (
                        str,
                        unicode,
                        int,
                        float,
                )):
                    try:
                        _tmp = _tmp.__html__
                    except:
                        _tmp = _translate(_tmp,
                                          domain=_domain,
                                          mapping=None,
                                          target_language=target_language,
                                          default=None)
                    else:
                        _tmp = _tmp()
                        _write(_tmp)
                        _tmp = None
                if (_tmp is not None):
                    if not isinstance(_tmp, unicode):
                        _tmp = str(_tmp)
                    if ('&' in _tmp):
                        if (';' in _tmp):
                            _tmp = _re_amp.sub('&amp;', _tmp)
                        else:
                            _tmp = _tmp.replace('&', '&amp;')
                    if ('<' in _tmp):
                        _tmp = _tmp.replace('<', '&lt;')
                    if ('>' in _tmp):
                        _tmp = _tmp.replace('>', '&gt;')
                    _write(_tmp)
                _write(u'\']").focus();});\n  </script>')
            _write(u'\n')
            if (_tmp2 == 0):
                break
            _write(' ')
        _write(u'')
        return _out.getvalue()

    return render
コード例 #47
0
def bind():
    from cPickle import loads as _loads
    _lookup_attr = _loads('cchameleon.core.codegen\nlookup_attr\np1\n.')
    _attrs_4360318608 = _loads('(dp1\nVid\np2\nVfooter\np3\ns.')
    _attrs_4360315152 = _loads(
        '(dp1\nVhref\np2\nVhttp://docs.pylonshq.com/pyramid/dev/#tutorials\np3\ns.'
    )
    _re_amp = _loads(
        "cre\n_compile\np1\n(S'&(?!([A-Za-z]+|#[0-9]+);)'\np2\nI0\ntRp3\n.")
    _attrs_4360318480 = _loads('(dp1\nVid\np2\nVwrap\np3\ns.')
    _attrs_4360315536 = _loads(
        '(dp1\nVhref\np2\nVhttp://docs.pylonshq.com/pyramid/dev/#sample-applications\np3\ns.'
    )
    _attrs_4360315728 = _loads(
        '(dp1\nVclass\np2\nVmiddle align-center\np3\ns.')
    _attrs_4360317456 = _loads(
        '(dp1\nVcontent\np2\nVpython web application\np3\nsVname\np4\nVkeywords\np5\ns.'
    )
    _attrs_4360318864 = _loads('(dp1\nVid\np2\nVbottom\np3\ns.')
    _attrs_4360315216 = _loads('(dp1\nVclass\np2\nVtop align-center\np3\ns.')
    _attrs_4360315600 = _loads(
        "(dp1\nVsrc\np2\nV${request.static_url('pyramidapp:static/pyramid.png')}\np3\nsVheight\np4\nV169\np5\nsVwidth\np6\nV750\np7\nsValt\np8\nVpyramid\np9\ns."
    )
    _attrs_4360316624 = _loads('(dp1\nVclass\np2\nVfooter\np3\ns.')
    _attrs_4360315792 = _loads('(dp1\n.')
    _attrs_4360297616 = _loads(
        '(dp1\nVxmlns\np2\nVhttp://www.w3.org/1999/xhtml\np3\nsVxml:lang\np4\nVen\np5\ns.'
    )
    _attrs_4360316368 = _loads('(dp1\n.')
    _attrs_4360341136 = _loads('(dp1\nVid\np2\nVmiddle\np3\ns.')
    _attrs_4360315024 = _loads(
        '(dp1\nVhref\np2\nVhttp://docs.pylonshq.com/pyramid/dev/#api-documentation\np3\ns.'
    )
    _attrs_4360318288 = _loads('(dp1\n.')
    _attrs_4360316880 = _loads('(dp1\n.')
    _attrs_4360316944 = _loads('(dp1\n.')
    _attrs_4360315280 = _loads('(dp1\n.')
    _init_default = _loads(
        'cchameleon.core.generation\ninitialize_default\np1\n.')
    _attrs_4360317584 = _loads(
        '(dp1\nVcontent\np2\nVpyramid web application\np3\nsVname\np4\nVdescription\np5\ns.'
    )
    _attrs_4360318544 = _loads('(dp1\nVhref\np2\nVhttp://pylonshq.com\np3\ns.')
    _attrs_4360314960 = _loads('(dp1\n.')
    _init_tal = _loads('cchameleon.core.generation\ninitialize_tal\np1\n.')
    _attrs_4360318096 = _loads(
        '(dp1\nVmedia\np2\nVscreen\np3\nsVcharset\np4\nVutf-8\np5\nsVhref\np6\nVhttp://fonts.googleapis.com/css?family=Nobile:regular,italic,bold,bolditalic&subset=latin\np7\nsVrel\np8\nVstylesheet\np9\nsVtype\np10\nVtext/css\np11\ns.'
    )
    _attrs_4360317904 = _loads('(dp1\n.')
    _attrs_4360316816 = _loads(
        '(dp1\nVid\np2\nVright\np3\nsVclass\np4\nValign-left\np5\ns.')
    _attrs_4360316752 = _loads(
        '(dp1\nVid\np2\nVleft\np3\nsVclass\np4\nValign-right\np5\ns.')
    _attrs_4360315088 = _loads('(dp1\n.')
    _attrs_4360315408 = _loads(
        '(dp1\nVhref\np2\nVhttp://docs.pylonshq.com/pyramid/dev/#change-history\np3\ns.'
    )
    _attrs_4360318032 = _loads('(dp1\nVclass\np2\nVlinks\np3\ns.')
    _attrs_4360315472 = _loads('(dp1\n.')
    _attrs_4360318672 = _loads('(dp1\n.')
    _attrs_4360315344 = _loads('(dp1\n.')
    _attrs_4360316304 = _loads('(dp1\nVclass\np2\nVapp-name\np3\ns.')
    _attrs_4360317136 = _loads(
        '(dp1\nVcontent\np2\nVtext/html;charset=UTF-8\np3\nsVhttp-equiv\np4\nVContent-Type\np5\ns.'
    )
    _init_stream = _loads(
        'cchameleon.core.generation\ninitialize_stream\np1\n.')
    _attrs_4360315984 = _loads('(dp1\nVclass\np2\nVbottom\np3\ns.')
    _init_scope = _loads('cchameleon.core.utils\necontext\np1\n.')
    _attrs_4360318800 = _loads(
        '(dp1\nVhref\np2\nVhttp://docs.pylonshq.com/pyramid/dev/#narrative-documentation\np3\ns.'
    )
    _attrs_4360317776 = _loads(
        '(dp1\nVtype\np2\nVsubmit\np3\nsVid\np4\nVx\nsVvalue\np5\nVGo\np6\ns.')
    _attrs_4360317648 = _loads(
        '(dp1\nVname\np2\nVq\nsVvalue\np3\nV\nsVtype\np4\nVtext\np5\nsVid\np6\nVq\ns.'
    )
    _attrs_4360317392 = _loads(
        '(dp1\nVaction\np2\nVhttp://docs.pylonshq.com/pyramid/dev/search.html\np3\nsVmethod\np4\nVget\np5\ns.'
    )
    _attrs_4360315856 = _loads(
        '(dp1\nVhref\np2\nVhttp://docs.pylonshq.com/pyramid/dev/#support-and-development\np3\ns.'
    )
    _attrs_4360316112 = _loads(
        '(dp1\nVhref\np2\nVirc://irc.freenode.net#pyramid\np3\ns.')
    _attrs_4360318416 = _loads('(dp1\n.')
    _attrs_4360317968 = _loads(
        '(dp1\nVmedia\np2\nVscreen\np3\nsVcharset\np4\nVutf-8\np5\nsVhref\np6\nVhttp://fonts.googleapis.com/css?family=Neuton&subset=latin\np7\nsVrel\np8\nVstylesheet\np9\nsVtype\np10\nVtext/css\np11\ns.'
    )
    _attrs_4360317712 = _loads(
        "(dp1\nVhref\np2\nV${request.static_url('pyramidapp:static/favicon.ico')}\np3\nsVrel\np4\nVshortcut icon\np5\ns."
    )
    _attrs_4360318736 = _loads('(dp1\nVid\np2\nVtop\np3\ns.')
    _attrs_4360315920 = _loads('(dp1\nVclass\np2\nVapp-welcome\np3\ns.')
    _attrs_4360317328 = _loads('(dp1\n.')
    _attrs_4360317840 = _loads(
        "(dp1\nVmedia\np2\nVscreen\np3\nsVcharset\np4\nVutf-8\np5\nsVhref\np6\nV${request.static_url('pyramidapp:static/pylons.css')}\np7\nsVrel\np8\nVstylesheet\np9\nsVtype\np10\nVtext/css\np11\ns."
    )
    _attrs_4360297360 = _loads('(dp1\n.')

    def render(econtext, rcontext=None):
        macros = econtext.get('macros')
        _translate = econtext.get('_translate')
        _slots = econtext.get('_slots')
        target_language = econtext.get('target_language')
        u'_init_stream()'
        (
            _out,
            _write,
        ) = _init_stream()
        u'_init_tal()'
        (
            _attributes,
            repeat,
        ) = _init_tal()
        u'_init_default()'
        _default = _init_default()
        u'None'
        default = None
        u'None'
        _domain = None
        _write(
            '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n'
        )
        attrs = _attrs_4360297616
        _write(u'<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">\n')
        attrs = _attrs_4360297360
        _write(u'<head>\n\t')
        attrs = _attrs_4360316880
        _write(
            u'<title>The Pyramid Web Application Development Framework</title>\n\t'
        )
        attrs = _attrs_4360317136
        _write(
            u'<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />\n\t'
        )
        attrs = _attrs_4360317456
        _write(
            u'<meta name="keywords" content="python web application" />\n\t')
        attrs = _attrs_4360317584
        _write(
            u'<meta name="description" content="pyramid web application" />\n\t'
        )
        attrs = _attrs_4360317712
        'join(value("request.static_url(\'pyramidapp:static/favicon.ico\')"),)'
        _write(u'<link rel="shortcut icon"')
        _tmp1 = _lookup_attr(econtext['request'],
                             'static_url')('pyramidapp:static/favicon.ico')
        if (_tmp1 is _default):
            _tmp1 = u"${request.static_url('pyramidapp:static/favicon.ico')}"
        if ((_tmp1 is not None) and (_tmp1 is not False)):
            if (_tmp1.__class__ not in (
                    str,
                    unicode,
                    int,
                    float,
            )):
                _tmp1 = unicode(
                    _translate(_tmp1,
                               domain=_domain,
                               mapping=None,
                               target_language=target_language,
                               default=None))
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if ('&' in _tmp1):
                if (';' in _tmp1):
                    _tmp1 = _re_amp.sub('&amp;', _tmp1)
                else:
                    _tmp1 = _tmp1.replace('&', '&amp;')
            if ('<' in _tmp1):
                _tmp1 = _tmp1.replace('<', '&lt;')
            if ('>' in _tmp1):
                _tmp1 = _tmp1.replace('>', '&gt;')
            if ('"' in _tmp1):
                _tmp1 = _tmp1.replace('"', '&quot;')
            _write(((' href="' + _tmp1) + '"'))
        _write(u' />\n\t')
        attrs = _attrs_4360317840
        'join(value("request.static_url(\'pyramidapp:static/pylons.css\')"),)'
        _write(u'<link rel="stylesheet"')
        _tmp1 = _lookup_attr(econtext['request'],
                             'static_url')('pyramidapp:static/pylons.css')
        if (_tmp1 is _default):
            _tmp1 = u"${request.static_url('pyramidapp:static/pylons.css')}"
        if ((_tmp1 is not None) and (_tmp1 is not False)):
            if (_tmp1.__class__ not in (
                    str,
                    unicode,
                    int,
                    float,
            )):
                _tmp1 = unicode(
                    _translate(_tmp1,
                               domain=_domain,
                               mapping=None,
                               target_language=target_language,
                               default=None))
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if ('&' in _tmp1):
                if (';' in _tmp1):
                    _tmp1 = _re_amp.sub('&amp;', _tmp1)
                else:
                    _tmp1 = _tmp1.replace('&', '&amp;')
            if ('<' in _tmp1):
                _tmp1 = _tmp1.replace('<', '&lt;')
            if ('>' in _tmp1):
                _tmp1 = _tmp1.replace('>', '&gt;')
            if ('"' in _tmp1):
                _tmp1 = _tmp1.replace('"', '&quot;')
            _write(((' href="' + _tmp1) + '"'))
        _write(u' type="text/css" media="screen" charset="utf-8" />\n\t')
        attrs = _attrs_4360317968
        _write(
            u'<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Neuton&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />\n\t'
        )
        attrs = _attrs_4360318096
        u"request.static_url('pyramidapp:static/ie6.css')"
        _write(
            u'<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Nobile:regular,italic,bold,bolditalic&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />\n\t<!--[if lte IE 6]>\n\t<link rel="stylesheet" href="'
        )
        _tmp1 = _lookup_attr(econtext['request'],
                             'static_url')('pyramidapp:static/ie6.css')
        _tmp = _tmp1
        if (_tmp.__class__ not in (
                str,
                unicode,
                int,
                float,
        )):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp,
                                  domain=_domain,
                                  mapping=None,
                                  target_language=target_language,
                                  default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if (_tmp is not None):
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            if ('&' in _tmp):
                if (';' in _tmp):
                    _tmp = _re_amp.sub('&amp;', _tmp)
                else:
                    _tmp = _tmp.replace('&', '&amp;')
            if ('<' in _tmp):
                _tmp = _tmp.replace('<', '&lt;')
            if ('>' in _tmp):
                _tmp = _tmp.replace('>', '&gt;')
            _write(_tmp)
        _write(
            u'" type="text/css" media="screen" charset="utf-8" />\n\t<![endif]-->\n</head>\n'
        )
        attrs = _attrs_4360316944
        _write(u'<body>\n\t')
        attrs = _attrs_4360318480
        _write(u'<div id="wrap">\n\t\t')
        attrs = _attrs_4360318736
        _write(u'<div id="top">\n\t\t\t')
        attrs = _attrs_4360315216
        _write(u'<div class="top align-center">\n\t\t\t\t')
        attrs = _attrs_4360315280
        _write(u'<div>')
        attrs = _attrs_4360315600
        'join(value("request.static_url(\'pyramidapp:static/pyramid.png\')"),)'
        _write(u'<img')
        _tmp1 = _lookup_attr(econtext['request'],
                             'static_url')('pyramidapp:static/pyramid.png')
        if (_tmp1 is _default):
            _tmp1 = u"${request.static_url('pyramidapp:static/pyramid.png')}"
        if ((_tmp1 is not None) and (_tmp1 is not False)):
            if (_tmp1.__class__ not in (
                    str,
                    unicode,
                    int,
                    float,
            )):
                _tmp1 = unicode(
                    _translate(_tmp1,
                               domain=_domain,
                               mapping=None,
                               target_language=target_language,
                               default=None))
            else:
                if not isinstance(_tmp1, unicode):
                    _tmp1 = str(_tmp1)
            if ('&' in _tmp1):
                if (';' in _tmp1):
                    _tmp1 = _re_amp.sub('&amp;', _tmp1)
                else:
                    _tmp1 = _tmp1.replace('&', '&amp;')
            if ('<' in _tmp1):
                _tmp1 = _tmp1.replace('<', '&lt;')
            if ('>' in _tmp1):
                _tmp1 = _tmp1.replace('>', '&gt;')
            if ('"' in _tmp1):
                _tmp1 = _tmp1.replace('"', '&quot;')
            _write(((' src="' + _tmp1) + '"'))
        _write(
            u' width="750" height="169" alt="pyramid" /></div>\n\t\t\t</div>\n\t\t</div>\n\t\t'
        )
        attrs = _attrs_4360341136
        _write(u'<div id="middle">\n\t\t\t')
        attrs = _attrs_4360315728
        _write(u'<div class="middle align-center">\n\t\t\t\t')
        attrs = _attrs_4360315920
        _write(u'<p class="app-welcome">\n\t\t\t\t\tWelcome to ')
        attrs = _attrs_4360316304
        u'project'
        _write(u'<span class="app-name">')
        _tmp1 = econtext['project']
        _tmp = _tmp1
        if (_tmp.__class__ not in (
                str,
                unicode,
                int,
                float,
        )):
            try:
                _tmp = _tmp.__html__
            except:
                _tmp = _translate(_tmp,
                                  domain=_domain,
                                  mapping=None,
                                  target_language=target_language,
                                  default=None)
            else:
                _tmp = _tmp()
                _write(_tmp)
                _tmp = None
        if (_tmp is not None):
            if not isinstance(_tmp, unicode):
                _tmp = str(_tmp)
            if ('&' in _tmp):
                if (';' in _tmp):
                    _tmp = _re_amp.sub('&amp;', _tmp)
                else:
                    _tmp = _tmp.replace('&', '&amp;')
            if ('<' in _tmp):
                _tmp = _tmp.replace('<', '&lt;')
            if ('>' in _tmp):
                _tmp = _tmp.replace('>', '&gt;')
            _write(_tmp)
        _write(u'</span>, an application generated by')
        attrs = _attrs_4360316368
        _write(
            u'<br />\n\t\t\t\t\tthe Pyramid web application development framework.\n\t\t\t\t</p>\n\t\t\t</div>\n\t\t</div>\n\t\t'
        )
        attrs = _attrs_4360318864
        _write(u'<div id="bottom">\n\t\t\t')
        attrs = _attrs_4360315984
        _write(u'<div class="bottom">\n\t\t\t\t')
        attrs = _attrs_4360316752
        _write(u'<div id="left" class="align-right">\n\t\t\t\t\t')
        attrs = _attrs_4360317328
        _write(u'<h2>Search documentation</h2>\n\t\t\t\t\t')
        attrs = _attrs_4360317392
        _write(
            u'<form method="get" action="http://docs.pylonshq.com/pyramid/dev/search.html">\n\t\t      \t\t\t'
        )
        attrs = _attrs_4360317648
        _write(
            u'<input type="text" id="q" name="q" value="" />\n\t\t      \t\t\t'
        )
        attrs = _attrs_4360317776
        _write(
            u'<input type="submit" id="x" value="Go" />\n\t\t  \t\t\t</form>\n\t\t\t\t</div>\n\t\t\t\t'
        )
        attrs = _attrs_4360316816
        _write(u'<div id="right" class="align-left">\n\t\t\t\t\t')
        attrs = _attrs_4360317904
        _write(u'<h2>Pyramid links</h2>\n\t\t\t\t\t')
        attrs = _attrs_4360318032
        _write(u'<ul class="links">\n\t\t\t\t\t\t')
        attrs = _attrs_4360318288
        _write(u'<li>\n\t\t\t\t\t\t\t')
        attrs = _attrs_4360318544
        _write(
            u'<a href="http://pylonshq.com">Pylons Website</a>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t\t'
        )
        attrs = _attrs_4360318416
        _write(u'<li>\n\t\t\t\t\t\t\t')
        attrs = _attrs_4360318800
        _write(
            u'<a href="http://docs.pylonshq.com/pyramid/dev/#narrative-documentation">Narrative Documentation</a>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t\t'
        )
        attrs = _attrs_4360318672
        _write(u'<li>\n\t\t\t\t\t\t\t')
        attrs = _attrs_4360315024
        _write(
            u'<a href="http://docs.pylonshq.com/pyramid/dev/#api-documentation">API Documentation</a>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t\t'
        )
        attrs = _attrs_4360314960
        _write(u'<li>\n\t\t\t\t\t\t\t')
        attrs = _attrs_4360315152
        _write(
            u'<a href="http://docs.pylonshq.com/pyramid/dev/#tutorials">Tutorials</a>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t\t'
        )
        attrs = _attrs_4360315088
        _write(u'<li>\n\t\t\t\t\t\t\t')
        attrs = _attrs_4360315408
        _write(
            u'<a href="http://docs.pylonshq.com/pyramid/dev/#change-history">Change History</a>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t\t'
        )
        attrs = _attrs_4360315344
        _write(u'<li>\n\t\t\t\t\t\t\t')
        attrs = _attrs_4360315536
        _write(
            u'<a href="http://docs.pylonshq.com/pyramid/dev/#sample-applications">Sample Applications</a>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t\t'
        )
        attrs = _attrs_4360315472
        _write(u'<li>\n\t\t\t\t\t\t\t')
        attrs = _attrs_4360315856
        _write(
            u'<a href="http://docs.pylonshq.com/pyramid/dev/#support-and-development">Support and Development</a>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t\t'
        )
        attrs = _attrs_4360315792
        _write(u'<li>\n\t\t\t\t\t\t\t')
        attrs = _attrs_4360316112
        _write(
            u'<a href="irc://irc.freenode.net#pyramid">IRC Channel</a>\n\t\t\t\t\t\t</li>\n\t\t  \t\t\t</ul>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t</div>\n\t'
        )
        attrs = _attrs_4360318608
        _write(u'<div id="footer">\n\t\t')
        attrs = _attrs_4360316624
        _write(
            u'<div class="footer">\xa9 Copyright 2008-2011, Agendaless Consulting.</div>\n\t</div>\n</body>\n</html>'
        )
        return _out.getvalue()

    return render