[Zope] Menu of Timezones

John Wheeler jdw27_42@hotmail.com
Fri, 15 Feb 2002 04:00:29


Thanks for the reply and the link.  What made me think this was possible was 
lines 673-675 in the page you gave the link to: "The module function 
Timezones() will return a list of the timezones recognized by the DateTime 
module. Recognition of  timezone names is case-insensitive."  I forgot to 
mention that I did look at the DateTime.py in the version of Zope I'm 
running (Revision: 1.68.2.2 instead of 1.68.2.1 in the page you pointed to), 
and the last four lines are:

# Module methods
def Timezones():
    """Return the list of recognized timezone names"""
    return _cache._zlst

If this isn't standard, though, there's not much point in persuing it, so I 
guess I will just hardcode the ones I think will be most useful.



>From: "Andy" <andy@agmweb.ca>
>To: "John Wheeler" <jdw27_42@hotmail.com>, <zope@zope.org>
>Subject: Re: [Zope] Menu of Timezones
>Date: Thu, 14 Feb 2002 15:04:38 -0800
>
>If you read the DateTime docs there is absolutely hint of a method that
>returns the list of time zones. Random guesses as to the function or
>attribute normally doesnt work.
>
>If you look in the time zone there are about a dozen ways of representing a
>time zone. I would suggest hardcoding the ones you want.
>http://www.zopezen.org/Source/Zope24/lib/python/DateTime/%7EDateTime.py#160
>scroll down...
>
>----- Original Message -----
>From: "John Wheeler" <jdw27_42@hotmail.com>
>To: <zope@zope.org>
>Sent: Thursday, February 14, 2002 10:16 PM
>Subject: [Zope] Menu of Timezones
>
>
> > For an input form, I'd like to make a menu of time zones.
> >
> > I saw in Appendix B: API Reference of the Zope Book that there already 
>is
>a
> > DateTime module function that returns a list of timezones, so I thought 
>I
> > could simply use <dtml-in> to go through the list, wrapping each
> > sequence-item with <option></option>.
> >
> > I tried every combination I could think of but got an error every time:
> >
> > <dtml-in {below}>         Error Name     Error Value
> > =================         ==========     ===========
> > DateTime.Timezones        KeyError       DateTime.Timezones
> > Timezones                 KeyError       Timezones
> > "_.Timezones()"           AttributeError Timezones
> > "DateTime.Timezones()"    NameError      global name 'DateTime' is not
> > defined
> > "_.DateTime.Timezones()"  AttributeError class DateTime has no attribute
> > 'Timezones'
> > "DateTime[Timezones]"     NameError      global name 'DateTime' is not
> > defined
> > "_.DateTime[Timezones]"   NameError      global name 'Timezones' is not
> > defined
> > "_.DateTime._Timezones()" SyntaxError    Line 2: "_Timezones" is an
>invalid
> > attribute name because it starts with "_".
> >
> > I even tried writing a python method using "from DateTime import
>Timezones"
> > but got an ImportError: import of "Timezones" from "DateTime" is
> > unauthorized.
> >
> > Is it just not possible to access Timezones() through the web?  If I'd
>have
> > to go to an external method, I'll just hardcode the timezones into the
>DTML
> > method by hand.




_________________________________________________________________
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx