Beispiel #1
0
 def GET(self, resource, context):
     try:
         from lpod.rst2odt import rst2odt
     except ImportError:
         msg = MSG(u'<p>Please install <a href="{href}">{name}</a> '
                   u'for Python on the server.</p>')
         msg = msg.gettext(href='http://lpod-project.org/', name='LpOD')
         return msg.encode('utf_8')
     # Just to ignore pyflakes warning
     rst2odt
     proxy = super(WikiPage_ToODT, self)
     return proxy.GET(resource, context)
Beispiel #2
0
 def get_payment_way_description(self, context, total_amount):
     msg = MSG(u"Pay {percent}% of {original_amount} now ({amount})")
     percent = self.get_property('percent')
     if self.get_property('pay_tax'):
         total_amount = total_amount['with_tax'].split(' ')[0]
         total_amount = decimal(total_amount)
     else:
         total_amount = total_amount['without_tax'].split(' ')[0]
         total_amount = decimal(total_amount)
     amount = total_amount * (percent / decimal('100.0'))
     msg = msg.gettext(percent=percent,
                       original_amount=format_price(total_amount),
                       amount=format_price(amount))
     return list(XMLParser(msg.encode('utf-8'))) + self.get_property('data')
Beispiel #3
0
    def get_email_html(self, context, web_version=False):
        header = []
        if web_version is False:
            header = MSG(u"""
                <center>
                  <span style="font-size:10px;font-weight:bold;
                    font-family:Arial,Helvetica,sans-serif;">
                    <a href="{page_uri}" target="_blank">Click here</a>
                    to see this news on you browser
                  </span>
                </center>
                """).gettext(page_uri=self.get_newsletter_uri(context))
            header = HTMLParser(header.encode('utf-8'))
        footer = MSG(u"""
            <center>
              <span style="font-size:10px;font-weight:bold;
                font-family:Arial,Helvetica,sans-serif;">
                <a href="{unsub_uri}" target="_blank">Click here</a>
                to unsubscribe
              </span>
            </center>
            """).gettext(unsub_uri=self.get_unsubscribe_uri(context))
        footer = HTMLParser(footer.encode('utf-8'))

        handler = self.handler
        body = handler.get_body()
        events = (handler.events[:body.start + 1]
                  + header
                  + handler.events[body.start + 1:body.end]
                  + footer
                  + handler.events[body.end:])
        # Rewrite link with scheme and autority
        prefix = self.get_site_root().get_pathto(self)
        html_data = set_prefix(events, prefix='%s/' % prefix, uri=context.uri)
        html_data = stl(events=html_data, mode='xhtml')
        return html_data
Beispiel #4
0
 def on_query_error_default(self, resource, context):
     message = MSG(u'The query could not be processed.').gettext()
     return message.encode('utf-8')
Beispiel #5
0
 def on_query_error_default(self, resource, context):
     message = MSG(u'The query could not be processed.').gettext()
     return message.encode('utf-8')