What was the decision on supporting python 1.5.2 vs 2.0?
In integrating SessionSQLStore I propose changing the SessionStore piece
of Application.__init__ to read as follows:
-----------
## Session store
# Create the session store
session_config = self.setting("SessionStore")
class_name = session_config["class"] # or "factory"
path = class_name.split(".")
class_name = path[-1]
path = ".".join(path[:-1])
namespace={}
module = __import__(path,namespace,namespace,[class_name])
factory = namespace[class_name]
#this does not have to be a class, just a callable factory
self._sessions = factory(self,session_config)
## End Session store
-----------
This is more flexible than requiring a ClassType, and eliminates the
need to import unused modules (especially important for OneShot).
Application.config would have a dictionary value instead of a string
value, e.g.
-------
"SessionStore": "File",
==>
"SessionStore": {
"class": "WebKit.SessionFileStore.SessionFileStore",
"folder": "/path/to/webware/WebKit/Sessions/",
},
-------
Analogous changes apply to other stores (and of course, minor changes to
the __init__ methods of the affected classes).
In particular the SessionSQLStore config might look like this:
-------
"SessionStore":{
"class": "WebKit.SessionSQLStore.SessionSQLStore",
"session_table": "webkit_sessions",
"connection": """## this string gets exec'ed. SessionSQLStore
expects a name "connection" to refer to a DB API compliant Connection
object
import my_db_connection_pool
connection = my_db_connection_pool.get_connection()
""", # (OR, we could use the same strategy as with the factory in
##SessionStore of Application.__init__ (cleaner, but less flexible.))
}
------
If this is cool with everyone, I will build and submit a patch.
--Terrel
|