Hi Ben,

I'm going to implement your patch, but I'd like to cut down the number 
of additional config settings. The number of parameters is already 
scaring enough ;-) What do you think about:

1) Assuming that the class name is always the same as the module name 
(this is also backward compatible and reduces confusion).

2) If the setting contains no dot, then try "Session%sStore" % setting,
if this fails or the name contains a dot, then use the name as is.

This way we can get on only with the old 'SessionStore' setting in a 
backward compatible way, plus one additional setting for the session 
module (and class).

Would this be ok for you?

-- Chris

Ben Parker wrote:
> Hi - It would be really nice to have the session store class and session 
> classes fully configurable from the Application.config file. Currently 
> Webware is limited to the included Memory/File/Dynamic setting which is 
> translated into ("Session%sStore" % setting) and used to import the 
> store. Then the session class is hard-coded as Session in the Application.
> 
> What do you think of having config settings for importing custom session 
> stores and session classes for use by the app? I built a custom store 
> for one application that happens to use MySQL as the back-end, coupled 
> with a custom Session object, and I have to jump through some hoops to 
> get the app to use them.
> 
> It could be as simple as four new config settings:
> 
> SessionStoreModule
> SessionStoreClass
> SessionModule
> SessionClass
> 
> The Application object could do the same process it does now to import 
> SessionXxxStore. Something like this (rough, untested):
> 
> CURRENT:
>     # For session store:
>     sessionStore = 'Session%sStore' % self.setting('SessionStore')
>     exec 'from %s import %s' % (sessionStore, sessionStore)
>     klass = locals()[sessionStore]
>     assert isinstance(klass, ClassType) or issubclass(klass, Object)
>     self._sessions = klass(self)
> 
> NEW:
>     # For session store:
>     exec 'from %s import %s' % (self.setting('SessionStoreModule'), 
> self.setting('SessionStoreClass'))
>     klass = locals()[self.setting('SessionStoreClass')]
>     assert isinstance(klass, ClassType) or issubclass(klass, Object)
>     self._sessions = klass(self)
>     # For session class:
>     exec 'from %s import %s' % (self.setting('SessionModule'), 
> self.setting('SessionClass'))
>     klass = locals()[self.setting('SessionClass')]
>     self._session = klass
> 
> If there is interest in this, I can whip up a patch. I can include 
> support for the current "SessionStore" param as well, rather than force 
> a change to config files.
> 
> Thanks - Ben

-------------------------------------------------------------------------
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