def _pretty_date(date_to_format): from datetime import datetime, timedelta from tg.i18n import lazy_ugettext now = datetime.utcnow() if date_to_format <= (now - timedelta(hours=24)): return date_to_format.strftime("%d/%m/%Y %H:%M") else: diff = now - date_to_format days, seconds = diff.days, diff.seconds minutes = (seconds % 3600) // 60 hours = days * 24 + seconds // 3600 if hours > 0: return lazy_ugettext('%s hours ago' % hours) return lazy_ugettext('%s minutes ago' % minutes)
class EditForm(HorizontalForm): uid = HiddenField() name = TextField(label='Memory\'s Name') content = TextField(label='Description') #data = datetime.utcnow submit = SubmitButton(value=lazy_ugettext('Save'), css_class='btn btn-success')
def lazy_hello(self, **kw): return dict(text=unicode_text(i18n.lazy_ugettext('Your application is now running')))
def lazy_hello(self, **kw): return dict(text=unicode_text( i18n.lazy_ugettext('Your application is now running')))