Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #35677

Re: How to get time.strptime()?

Newsgroups comp.lang.python
Date 2012-12-27 19:48 -0800
References <5692cd23-84e0-46d4-b48c-5c11a5377c0a@googlegroups.com> <01d20782-8c4a-4a88-87e2-62cee50115f9@googlegroups.com> <mailman.1381.1356662889.29569.python-list@python.org>
Subject Re: How to get time.strptime()?
From Gnarlodious <gnarlodious@gmail.com>
Message-ID <mailman.1383.1356666498.29569.python-list@python.org> (permalink)

Show all headers | View raw


Thank you for a reasonable discussion of the problem, although I don't really understand what you said. This is a WSGI webapp configured for one-process and one-thread.

I can imagine my unorthodox handling of imported modules is suspect. To explain, my webapp first loads modules from a dict of allowed pages:

__init__
    for module in self.allowedPages:
        try:
            self.Pages[module]=getattr(__import__(module), module)


This gives me a dict of objects like this:
self.Pages
{'Yijing': <Yijing.YijingProto object at 0x1067a4f90>, 'Strand': <Strand.StrandProto object at 0x1067b52d0>, 'Gnomon': <Gnomon.GnomonProto object at 0x10675a450>, 'Lexicon': <Lexicon.LexiconProto object at 0x1067c4a50>, 'Dream': <Dream.DreamProto object at 0x106800a50>, 'Grid': <Grid.GridProto object at 0x1067ac310>}


I can then extract the first query string variable name and get the page content:
__call__
    page='Gnomon'
    xml=self.Pages[page](EnvDict, qList) # sends environ & query list


I don't know how several modules are normally handled in a CGI webapp, but this homegrown system has served me well. Threadlocking, however, may find this sort of referencing problematic. That would be my first suspicion.

-- Gnarlie

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

How to get time.strptime()? Gnarlodious <gnarlodious@gmail.com> - 2012-12-26 08:33 -0800
  Re: How to get time.strptime()? Chris Rebert <clp2@rebertia.com> - 2012-12-26 09:34 -0800
  Re: How to get time.strptime()? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-12-26 17:43 +0000
    Re: How to get time.strptime()? Gnarlodious <gnarlodious@gmail.com> - 2012-12-26 11:18 -0800
  RE: How to get time.strptime()? Nick Cash <nick.cash@npcinternational.com> - 2012-12-26 21:06 +0000
    Re: How to get time.strptime()? Gnarlodious <gnarlodious@gmail.com> - 2012-12-26 19:09 -0800
      Re: How to get time.strptime()? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-12-27 04:40 +0000
      Re: How to get time.strptime()? Roy Smith <roy@panix.com> - 2012-12-26 23:53 -0500
      Re: How to get time.strptime()? Mitya Sirenef <msirenef@lightbird.net> - 2012-12-27 00:06 -0500
      Re: How to get time.strptime()? Chris Angelico <rosuav@gmail.com> - 2012-12-27 16:41 +1100
        Re: How to get time.strptime()? Gnarlodious <gnarlodious@gmail.com> - 2012-12-26 22:19 -0800
        Re: How to get time.strptime()? Gnarlodious <gnarlodious@gmail.com> - 2012-12-26 22:19 -0800
      Re: How to get time.strptime()? Ben Finney <ben+python@benfinney.id.au> - 2012-12-27 17:24 +1100
    Re: How to get time.strptime()? Gnarlodious <gnarlodious@gmail.com> - 2012-12-26 19:09 -0800
  Re: How to get time.strptime()? Gnarlodious <gnarlodious@gmail.com> - 2012-12-27 16:33 -0800
    Re: How to get time.strptime()? Ian Kelly <ian.g.kelly@gmail.com> - 2012-12-27 19:47 -0700
      Re: How to get time.strptime()? Gnarlodious <gnarlodious@gmail.com> - 2012-12-27 19:48 -0800
      Re: How to get time.strptime()? Gnarlodious <gnarlodious@gmail.com> - 2012-12-27 19:48 -0800

csiph-web