Exemplo n.º 1
0
def confirm_payment():
    loop = ForLoop()
    _dummy = CompiledTemplate(lambda: None, "dummy")
    join_ = _dummy._join
    escape_ = _dummy._escape

    def __template__(transaction):
        yield 'title', join_('Confirm Payment')
        yield '', join_('\n')
        yield '', join_('<h1>Payment Result</h1>\n')
        yield '', join_('\n')
        yield '', join_('<div>Thank you for your payment.</div>\n')
        yield '', join_('\n')
        yield '', join_('<h2>Transaction Details</h2>\n')
        yield '', join_('\n')
        yield '', join_('<table>\n')
        yield '', join_('    <tr><td>Amount:</td><td>', '$',
                        '100.00</td></tr>\n')
        yield '', join_('    <tr><td>Transaction ID:</td><td>',
                        escape_(transaction.id, True), '</td></tr>\n')
        yield '', join_('    <tr><td>First Name:</td><td>',
                        escape_(transaction.customer_details.first_name, True),
                        '</td></tr>\n')
        yield '', join_('\n')
        yield '', join_('    <tr><td>Last Name:</td><td>',
                        escape_(transaction.customer_details.last_name, True),
                        '</td></tr>\n')
        yield '', join_('    <tr><td>Email:</td><td>',
                        escape_(transaction.customer_details.email, True),
                        '</td></tr>\n')
        yield '', join_(
            '    <tr><td>Credit Card:</td><td>',
            escape_(transaction.credit_card_details.masked_number, True),
            '</td></tr>\n')
        yield '', join_(
            '    <tr><td>Card Type:</td><td>',
            escape_(transaction.credit_card_details.card_type, True),
            '</td></tr>\n')
        yield '', join_('</table>\n')

    return __template__
Exemplo n.º 2
0
def layout():
    loop = ForLoop()
    _dummy = CompiledTemplate(lambda: None, "dummy")
    join_ = _dummy._join
    escape_ = _dummy._escape

    def __template__(page):
        yield '', join_('\n')
        yield '', join_('<html>\n')
        yield '', join_('  <head>\n')
        yield '', join_('    <title>', escape_(page.title, True), '</title>\n')
        yield '', join_(
            '    <link rel="stylesheet" type="text/css" href="/static/styles.css" />\n'
        )
        yield '', join_('  </head>\n')
        yield '', join_('  <body>\n')
        yield '', join_('    ', escape_(page, False), '\n')
        yield '', join_('  </body>\n')
        yield '', join_('</html>\n')

    return __template__
Exemplo n.º 3
0
def new_payment():
    loop = ForLoop()
    _dummy = CompiledTemplate(lambda: None, "dummy")
    join_ = _dummy._join
    escape_ = _dummy._escape

    def __template__(form, error_count, url):
        yield 'title', join_('New Payment')
        yield '', join_('\n')
        yield '', join_('<h1>Payment: ', '$', '100.00</h1>\n')
        yield '', join_('\n')
        if error_count > 0:
            yield '', join_('<h3 id="error-count">',
                            escape_(error_count, True), ' error(s)</h3>\n')
            yield '', join_('\n')
        yield '', join_('<form action="', escape_(url, True),
                        '" method="post" autocomplete="off">\n')
        yield '', join_('  ', escape_(form.render(), False), '\n')
        yield '', join_('  <input type="submit" value="Submit" />\n')
        yield '', join_('</form>\n')

    return __template__
Exemplo n.º 4
0
from web.template import CompiledTemplate, ForLoop, TemplateResult


# coding: utf-8
def index():
    __lineoffset__ = -5
    loop = ForLoop()
    self = TemplateResult()
    extend_ = self.extend
    extend_([u'ADMIN\n'])

    return self


index = CompiledTemplate(index, 'templates/admin/index.html')
join_ = index._join
escape_ = index._escape


# coding: utf-8
def blog(posts):
    __lineoffset__ = -4
    loop = ForLoop()
    self = TemplateResult()
    extend_ = self.extend
    extend_([u'<div class="row">\n'])
    extend_([u'        <div class="span8 offset2">\n'])
    extend_([u'                <h2>Blog Posts</h2>\n'])
    extend_([u'                <div class="pull-right">\n'])
    extend_([
        u'                        <button class="btn btn-action" >create</button>\n'
Exemplo n.º 5
0
    extend_([
        u'                                        <p>Twitter, Facebook, Google+, Last.fm.</p>\n'
    ])
    extend_([u'                                </div>\n'])
    extend_([u'                                </li>\n'])
    extend_([u'                </ul>                   \n'])
    extend_([u'        </div>\n'])
    extend_([u'</div>\n'])
    extend_([u'</section>\n'])
    extend_([u'\n'])
    extend_([u'<%include file="footer.html"/>\n'])

    return self


index = CompiledTemplate(index, 'templates/index.html')
join_ = index._join
escape_ = index._escape


# coding: utf-8
def layout(content):
    __lineoffset__ = -4
    loop = ForLoop()
    self = TemplateResult()
    extend_ = self.extend
    extend_([u'\n'])
    extend_([u'<!DOCTYPE html>\n'])
    extend_([u'<html lang="en">\n'])
    extend_([u'  <head>\n'])
    extend_([u'    <meta charset="utf-8">\n'])
Exemplo n.º 6
0
    extend_([u'            </div>\n'])
    extend_([u'        </div>\n'])
    extend_([u'        <div class="row">\n'])
    extend_(
        [u'            <div class="col-sm-12 text-center" id="mainfooter">\n'])
    extend_([u'                <p>Copyright 2015, Matthew Iannucci</p>\n'])
    extend_([u'            </div>\n'])
    extend_([u'        </div>\n'])
    extend_([u'    </div>\n'])
    extend_([u'</body>\n'])
    extend_([u'</html>\n'])

    return self


base = CompiledTemplate(base, 'templates/base.html')
join_ = base._join
escape_ = base._escape


# coding: utf-8
def index():
    __lineoffset__ = -5
    loop = ForLoop()
    self = TemplateResult()
    extend_ = self.extend
    posts = getAllReports()
    extend_([u'\n'])
    for post in loop.setup(posts):
        extend_([escape_(post.date, True), u'\n'])
        extend_([escape_(post.temperature, True), u'\n'])
Exemplo n.º 7
0
    extend_([u'    <script src="/static/bootstrap/js/bootstrap-scrollspy.js"></script>\n'])
    extend_([u'    <script src="/static/bootstrap/js/bootstrap-tab.js"></script>\n'])
    extend_([u'    <script src="/static/bootstrap/js/bootstrap-tooltip.js"></script>\n'])
    extend_([u'    <script src="/static/bootstrap/js/bootstrap-popover.js"></script>\n'])
    extend_([u'    <script src="/static/bootstrap/js/bootstrap-button.js"></script>\n'])
    extend_([u'    <script src="/static/bootstrap/js/bootstrap-collapse.js"></script>\n'])
    extend_([u'    <script src="/static/bootstrap/js/bootstrap-carousel.js"></script>\n'])
    extend_([u'    <script src="/static/bootstrap/js/bootstrap-typeahead.js"></script>\n'])
    extend_([u'        -->\n'])
    extend_([u'  </body>\n'])
    extend_([u'</html>\n'])
    extend_([u'\n'])

    return self

layout = CompiledTemplate(layout, 'templates/shared/layout.html')
join_ = layout._join; escape_ = layout._escape

# coding: utf-8
def post_form (form, action):
    __lineoffset__ = -4
    loop = ForLoop()
    self = TemplateResult(); extend_ = self.extend
    extend_([u'<form action="POST">\n'])
    extend_([u'        ', escape_(form.render(), True), u'\n'])
    extend_([u'</form>\n'])
    extend_([u'<script type="text/javascript" src="/static/tiny_mce/tiny_mce.js></script>\n'])

    return self

post_form = CompiledTemplate(post_form, 'templates/shared/post_form.html')
Exemplo n.º 8
0
    for post in loop.setup(posts):
        extend_(['                ', u'<div class="postlist">\n'])
        extend_(['                ', u'    <p><a href="/view/', escape_(post.url, True), u'">', escape_(post.title, True), u'</a> ', escape_(datestr(post.date), True), u'</p>\n'])
        extend_(['                ', u'    <ul class="list-inline">\n'])
        extend_(['                ', u'        <li><a class="btn btn-default" href="/edit/', escape_(post.url, True), u'">Edit</a></li>\n'])
        extend_(['                ', u'        <li><form action="/delete/', escape_(post.url, True), u'" method="post">\n'])
        extend_(['                ', u'            <input type="submit" class="btn btn-danger" value="Delete post" />\n'])
        extend_(['                ', u'        </form></li>\n'])
        extend_(['                ', u'    </ul>\n'])
    extend_([u'        </div>\n'])
    extend_([u'    </div>\n'])
    extend_([u'</div>\n'])

    return self

admin = CompiledTemplate(admin, 'templates/admin.html')
join_ = admin._join; escape_ = admin._escape

# coding: utf-8
def apps():
    __lineoffset__ = -5
    loop = ForLoop()
    self = TemplateResult(); extend_ = self.extend
    extend_([u'<div class="row">\n'])
    extend_([u'<div id="HackWindsCols" class="col-lg-12 jumbotron hackwinds-jumbotron">\n'])
    extend_([u'    <div class="container">\n'])
    extend_([u'        <div class="col-sm-2">\n'])
    extend_([u'            <img class="img-responsive apps-page-screenshot" src="/static/Images/hackwinds-logo.png" />\n'])
    extend_([u'        </div>\n'])
    extend_([u'        <div class="col-sm-10">\n'])
    extend_([u'            <h1>HackWinds</h1>\n'])
Exemplo n.º 9
0
        u'          <input name="Clue" type="text" id="clue_text" placeholder="Spin broken shingle (7) ..g...."/>\n'
    ])
    extend_([u'          <input type="submit" value="Solve"/>\n'])
    extend_([u'        </form>\n'])
    extend_([u'      </div>\n'])
    extend_([u'\n'])
    extend_([u'      <div id="solution">\n'])
    extend_([u'      </div>\n'])
    extend_([u'    </div>\n'])
    extend_([u'  </body>\n'])
    extend_([u'</html>\n'])

    return self


index = CompiledTemplate(index, 'templates/index.html')
join_ = index._join
escape_ = index._escape


# coding: utf-8
def solver(answers, clue, err_msg):
    __lineoffset__ = -4
    loop = ForLoop()
    self = TemplateResult()
    extend_ = self.extend
    if err_msg:
        extend_([u'    ', escape_(err_msg, False), u'\n'])
    else:
        if answers is not None:
            extend_(['    ', u'    <div id="answer_nav">\n'])
Exemplo n.º 10
0
        [escape_(greeting, True), u'<br>',
         escape_(greeting2, True), u'\n'])
    extend_([u'</center>\n'])
    extend_([u'</body>\n'])
    extend_([
        u'<footer style="width:100%;height:28px;border-top:1px solid #000000;left:0px;text-align:center;position:absolute;bottom:0;font-size:8pt;">\n'
    ])
    extend_([
        u'Made by dev1n on HN using the very cool <a href="https://www.hnsearch.com/api">HNSearch</a> API\n'
    ])
    extend_([u'</footer>\n'])

    return self


final = CompiledTemplate(final, 'templates/final.html')
join_ = final._join
escape_ = final._escape


# coding: utf-8
def register(form):
    __lineoffset__ = -4
    loop = ForLoop()
    self = TemplateResult()
    extend_ = self.extend
    extend_([u'<!DOCTYPE html>\n'])
    extend_([u'<title>HN Birthday Countdown</title>\n'])
    extend_([u'<center>\n'])
    extend_([
        u'<div style="background-color:#ff6600;min-height:25px;width:85%;">\n'
Exemplo n.º 11
0
    extend_([u'        <hr/>\n'])
    extend_([u'        <h4>Categories</h4>\n'])
    extend_([u'        <ul>\n'])
    extend_([u'                <li>stuff</li>\n'])
    extend_([u'        </ul>\n'])
    extend_([u'</div>\n'])
    extend_([u'</div>\n'])
    extend_([u'</section>\n'])
    extend_([u'<script type="text/javascript" language="javascript">\n'])
    extend_([u'        \n'])
    extend_([u'</script>\n'])

    return self


index = CompiledTemplate(index, 'templates/blog/index.html')
join_ = index._join
escape_ = index._escape


# coding: utf-8
def create(form):
    __lineoffset__ = -4
    loop = ForLoop()
    self = TemplateResult()
    extend_ = self.extend
    extend_([u'<div class="row">\n'])
    extend_([u'        <div class="span10 offset2">\n'])
    if not form.valid:
        extend_(['        ', u'<p class="error"> Try again.</p>\n'])
    extend_([u'        \n'])
Exemplo n.º 12
0
                        escape_(transaction.customer_details.email, True),
                        '</td></tr>\n')
        yield '', join_(
            '    <tr><td>Credit Card:</td><td>',
            escape_(transaction.credit_card_details.masked_number, True),
            '</td></tr>\n')
        yield '', join_(
            '    <tr><td>Card Type:</td><td>',
            escape_(transaction.credit_card_details.card_type, True),
            '</td></tr>\n')
        yield '', join_('</table>\n')

    return __template__


confirm_payment = CompiledTemplate(confirm_payment(),
                                   'templates/confirm_payment.html')


def layout():
    loop = ForLoop()
    _dummy = CompiledTemplate(lambda: None, "dummy")
    join_ = _dummy._join
    escape_ = _dummy._escape

    def __template__(page):
        yield '', join_('\n')
        yield '', join_('<html>\n')
        yield '', join_('  <head>\n')
        yield '', join_('    <title>', escape_(page.title, True), '</title>\n')
        yield '', join_(
            '    <link rel="stylesheet" type="text/css" href="/static/styles.css" />\n'
Exemplo n.º 13
0
    extend_([u"        c.type = 'text/javascript';\n"])
    extend_([u'        c.async = true;\n'])
    extend_([
        u"        c.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'www.clicki.cn/boot/47861';\n"
    ])
    extend_([u"        var h = document.getElementsByTagName('script')[0];\n"])
    extend_([u'        h.parentNode.insertBefore(c, h);\n'])
    extend_([u'    })();\n'])
    extend_([u'</script>\n'])
    extend_([u'</body>\n'])
    extend_([u'</html>\n'])

    return self


index = CompiledTemplate(index, '../templates/index.html')
join_ = index._join
escape_ = index._escape


# coding: utf-8
def readme():
    __lineoffset__ = -5
    loop = ForLoop()
    self = TemplateResult()
    extend_ = self.extend
    extend_([u'python web/template.py --compile templates\n'])

    return self