Thanks, Chris. For purposes of these comments, I'm browsing svn rev 
6414. http://svn.w4py.org/Webware/trunk/WebKit/Application.py

The SessionStore initialization seems a bit more complicated than it 
needs to be. Rather than the for loop, and the prefix/suffix check, you 
can check if the setting is 'Memory', 'File', or 'Dynamic'. Otherwise 
everyone with a custom SessionStore needs to follow the SessionXxxxStore 
naming convention needlessly.

Here's the snippet from rev 6414 Application.py's initSessions(), 
updated to remove the for loop:

        sessionStore = self.setting('SessionStore')
        if sessionStore in ('Memory', 'File', 'Dynamic'):
                moduleName = className = 'Session' + sessionStore + 'Store'
        else:
                moduleName = sessionStore
                className = sessionStore.split('.')[-1]
        try:
                exec 'from %s%s import %s' % (moduleName, className)
        except ImportError:
                self._sessions = None
        else:
                try:
                        klass = locals()[className]
                        if not isinstance(klass, ClassType) \
                                        and not issubclass(klass, Object):
                                raise KeyError
                        self._sessions = klass(self)
                except KeyError:
                        print "ERROR: ", moduleName, " module" \
                                " does not contain class", className
                        self._sessions = None
        if self._sessions is None:
                print "ERROR: Session store not found!"


Regards - Ben

Christoph Zwerschke wrote on 4/5/07 3:41 PM:
> Ok, this is now in the trunk if you want to check it out.
>
> Ben Parker wrote:
>   
>> Agreed about too many config settings - I thought about having the 
>> Session / SessionStore set through some kind of runtime configuration. 
>> Allow each context to set its own session/store combo perhaps? but that 
>> is a larger effort, and I didn't need that full solution. :)
>>     
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Webware-devel mailing list
> Webware-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/webware-devel
>
>
>   

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Webware-devel mailing list
Webware-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/webware-devel

Reply via email to