Hi!

Thanks for keeping Webware alive, I'm actively using it in a couple of
projects and I'd still choose Webware for a specific type of project.

But I think there is a problem with Funcs.dateForEmail() in Webware
1.0.1:

    >>> import locale
    >>> locale.setlocale(locale.LC_ALL, "de_DE.ISO-8859-1")
    'de_DE.ISO-8859-1'
    >>> from Funcs import dateForEmail
    >>> dateForEmail()
    'Di, 03 Mär 2009 15:53:45 +0100'

According to RFC 5322, English abbreviations have to be used for date
and time specifications
(http://tools.ietf.org/html/rfc5322#section-3.3).  Some MTAs complain
about umlauts within e-mail headers.

I can't think of a method to get the abbreviated day name without
changing the locale settings.  This is not elegant, but it works for me:

8<----------------------------------------------------------------------

MONTHNAMES= ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep",\
        "Oct", "Nov", "Dec"]
DAYNAMES= ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]

def dateForEmail(now=None):
    """Return a properly formatted date/time string for email messages."""
    if now is None:
        now = time.localtime(time.time())
    if now[8] == 1:
        offset = -time.altzone / 60
    else:
        offset = -time.timezone / 60
    if offset < 0:
        plusminus = '-'
    else:
        plusminus = '+'
    return '%s, %02d %s ' % (DAYNAMES[now[6]], now[2], MONTHNAMES[now[1]-1]) \
            + time.strftime('%Y %H:%M:%S', now) + plusminus \
            + '%02d%02d' % (abs(offset/60), abs(offset%60))

8<----------------------------------------------------------------------

I'm sure there is a way to get the names without having to list them.

-- 
Bye, Andreas

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Webware-devel mailing list
Webware-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/webware-devel

Reply via email to