I had recently dug into QP to discover exactly what it expects in terms
of api from the DB, and then I extracted the methods into a separate
class. In my QP-based environment, this class is then instantiated by
the SIte's Publisher... (but more on this soon hopefully...)
In the light of the ongoing discussion of precisely the issue of what
QP expects from the DB, here's the gutted version of that interface
class, that I think speaks very clearly. In last release of QP, these
methods have been re-organized, thus improving clarity in the source
code itself.
To tell the whole story, one should keep in mind that there *is* a
specific API that the Session and User class hierarchies are expected
to implement... for example SessionDB.get(key), Session.is_valid(),
Session.get_owner(), Session.set_authenticated(), User.has_password(),
etc. However, in my variations I retained the same API's on these
classes so I never worried about it too much.
Anyhow, as such, QP would not be at be able to know anything about how
the Session and User classes are achieved... they could be thin
wrappers of raw sql queires for that matter, and none of QP's features
will be affected in any way (please correct me if I am wrong!). So, if
anyone is reluctant to check QP out because of Durus... just do it ;)
But, the only place where there are any real Durus-specific assumptions
is in the qp admin script itself. If the logic for starting and
stopping the db, along with that for getting a connection (in
Site.get_publisher()), are hooked out in some way, then QP in and of
itself will have nothing that is Durus specific -- something that
probably would be a good thing for both QP and Durus...
class QPDB(object):
def __init__(self, connection=None):
# Called by SitePublisher.__init__()
def ensure_database_initialized(self):
# Called from Publisher.__init__()
def get_sessions(self):
''' () -> SessionDatabase '''
# Called from Publisher.fill_response()
def create_session(self):
# Called from Publisher.fill_response()
def get_users(self):
''' () -> UserDatabase '''
# Called from Publisher.ensure_signed_in_*
# Called from within session.py
def create_user(self, userid, ... ):
# Not called from QP code outside User class
def get_connection(self):
# Called from Site.get_connection()
# Initialized in Site.get_publisher()
def commit(self):
# shortcut on self.get_connection. commit()
def abort(self):
# shortcut on self.get_connection.abort()
def get_root(self):
# shortcut on self.get_connection.get_root()
_______________________________________________
Quixote-users mailing list
[email protected]
http://mail.mems-exchange.org/mailman/listinfo/quixote-users