Example #1
0
def when_text(d, t=None):
    """Return a string with a concise representation of the given date
    and time combination.

    Examples:

    >>> print(when_text(datetime.date(2013,12,25)))
    Wed 25/12/2013
    
    >>> print(when_text(
    ...     datetime.date(2013,12,25), datetime.time(17,15,00)))
    Wed 25/12/2013 (17:15)
    
    >>> print(when_text(None))
    <BLANKLINE>

    """
    if d is None:
        return ''
    # fmt = 'yyyy MMM dd (EE)'
    # txt = d.strftime(settings.SITE.date_format_strftime)
    txt = format_date(d, 'EE ')
    txt += fds(d)
    if t is not None:
        txt += ' (%s)' % t.strftime(settings.SITE.time_format_strftime)
    return txt
Example #2
0
 def fmt(obj):
     s = E.tostring(ar.action_button(ba, obj))
     s += fds(obj.created) + " " + obj.created.strftime(
         settings.SITE.time_format_strftime) + " "
     s += ar.parse_memo(obj.body)
     # s += obj.body
     return "<li>{}</li>".format(s)
Example #3
0
File: utils.py Project: khchine5/xl
def when_text(d, t=None):
    """Return a string with a concise representation of the given date
    and time combination.

    Examples:

    >>> print(when_text(datetime.date(2013,12,25)))
    Wed 25/12/2013
    
    >>> print(when_text(
    ...     datetime.date(2013,12,25), datetime.time(17,15,00)))
    Wed 25/12/2013 (17:15)
    
    >>> print(when_text(None))
    <BLANKLINE>

    """
    if d is None:
        return ''
    # fmt = 'yyyy MMM dd (EE)'
    # txt = d.strftime(settings.SITE.date_format_strftime)
    txt = format_date(d, 'EE ')
    txt += fds(d)
    if t is not None:
        txt += ' (%s)' % t.strftime(settings.SITE.time_format_strftime)
    return txt
Example #4
0
 def statements(self, ar):
     if ar is None or not dd.is_installed('b2c'):
         return ''
     Account = rt.models.b2c.Account
     try:
         b2c = Account.objects.get(iban=self.iban)
     except Account.DoesNotExist:
         return ''
     return ar.obj2html(b2c, fds(b2c.last_transaction))
Example #5
0
 def statements(self, ar):
     if ar is None or not dd.is_installed('b2c'):
         return ''
     Account = rt.modules.b2c.Account
     try:
         b2c = Account.objects.get(iban=self.iban)
     except Account.DoesNotExist:
         return ''
     return ar.obj2html(b2c, fds(b2c.last_transaction))
Example #6
0
 def fmt(obj):
     s = tostring(ar.action_button(ba, obj))
     s += fds(obj.created) + " " + obj.created.strftime(
         settings.SITE.time_format_strftime) + " "
     if obj.body:
         s += ar.parse_memo(obj.body)
     else:
         s += ar.parse_memo(obj.subject)
     e = etree.parse(StringIO(s), html_parser)
     return E.li(E.div(*e.iter()))
Example #7
0
 def fmt(obj):
     s = tostring(ar.action_button(ba, obj))
     s += fds(obj.created) + " " + obj.created.strftime(
         settings.SITE.time_format_strftime) + " "
     if obj.body:
         s += ar.parse_memo(obj.body)
     else:
         s += ar.parse_memo(obj.subject)
     e = etree.parse(StringIO(s), html_parser)
     return E.li(E.div(*e.iter()))
Example #8
0
File: store.py Project: NewRGB/lino
    def format_value(self, ar, v):
        """Return a plain textual representation of this value as a unicode
        string.

        """
        return fds(v)
Example #9
0
def rangefmt(r):
    return fds(r[0]) + '...' + fds(r[1])
Example #10
0
def daterange_text(a, b):
    """
    """
    if a == b:
        return fds(a)
    return fds(a) + "-" + fds(b)
Example #11
0
    def format_value(self, ar, v):
        """Return a plain textual representation of this value as a unicode
        string.

        """
        return fds(v)
Example #12
0
def rangefmt(r):
    return fds(r[0]) + '...' + fds(r[1])
Example #13
0
def daterange_text(a, b):
    """
    """
    if a == b:
        return fds(a)
    return fds(a) + "-" + fds(b)
Example #14
0
 def fmt(obj):
     s = E.tostring(ar.action_button(ba, obj))
     s += fds(obj.created) + " " + obj.created.strftime(
         settings.SITE.time_format_strftime) + " "
     s += obj.body
     return "<li>{}</li>".format(s)