[mod_python] Re: MySQLSession, wiki, development and other stuff

Jim Gallacher jpg at jgassociates.ca
Tue Nov 28 12:20:34 EST 2006

Graham Dumpleton wrote:
> On 28/11/2006, at 10:04 AM, Martijn Moeling wrote:
>> I emailed you guy's personally since you are the driving forces behind
>> mod_python (i think) and this is not a real subject for that mailing
>> list.
> I see no reason why anything you talk about needs to be handled off
> the mailing list, so have sent my response back there.
>> I just send in a proposed new Session.py as a RFC backed with some
>> documentation.
>> I also found an today's article on the mailing list with subject:
>> [mod_python] Wiki for mod_python. Contributors welcome.
>> Which is about this subject, keeping the MySQLdb out as much as possible
>> was one of my goals, but I do not see another option.
> There should be no reason for a MySQL session class to be within the
> mod_python session code file for it to work. The only thing you don't 
> get from
> having it separate is the ability for it to be created underneath the 
> Session.Session()
> call based on the value of PythonOption for setting the session type.
> Instead you would use:
>   req.session = MySqlSession(req)
> The only place where having to do this would be a problem is if you are
> using mod_python.psp as it internally uses Session.Session(). It only
> does this though if req.session doesn't exist as an attribute. Thus, if 
> you are
> using mod_python.psp you need to create your own handler which does:
>   from mod_python import psp
>   def handler(req):
>     req.session = MySqlSession(req)
>     return psp.handler(req)
> By assigning session instance to req.session, mod_python.psp will use it.
> You will need to have a recent version of mod_python for this to work
> though.
> In mod_python 3.3, the ability to use the Apache authentication handler
> phase properly means that creating sessions in the main content handler
> phase is probably not as a good an option as writing a proper 
> authentication
> handler for the job. In that scenario, you wouldn't even need to wrap
> mod_python.psp as session creation would be in a separate handler
> anyway.
>> (yes I do: copy
>> Session.py to my app dir and not include it from mod_python right?)
> Making a copy of Session.py and modifying it is a bad idea as it is already
> out of date if you are using mod_python 3.2.10 or older as various changes
> have been made in code in mod_python 3.3. You will loose the benefit of
> these changes/fixes if you have your own copy based on an older version.
>> Storing the Sessions in an SQL database can be a huge advantage and I
>> think it should be in Session.py since it expands possibilities. (think
>> of the multiple front end severs in my situation, and there are File,
>> DBM memory possibilities, so why not add MySQL (which is used by most
>> mod_python users anyway). With my current project I am preparing for
>> 1.000.000 pageviews per hour!! One apache server with mod_python can not
>> handle that amount of users. (not all use sessions)
>> Personally I think mod_python and MySQLdb should team up, I am an
>> experienced programmer, but all those newbie guys run into trouble
>> configuring the lot
> The topic of having SQL database backed sessions included as a standard
> part of mod_python has been discussed before and rejected. Even the
> sqlite version which I referred you to was rejected. The issue was that 
> having
> dependencies on external packages was not desirable as it makes the
> development and testing more burdensome. This was even though sqlite itself
> doesn't require a big database system but can work direct out of the
> filesystem.

Now that sqlite is included with python 2.5 I can see the possibility of 
adding that to Session.py at some point. Such an implementation could 
then be used as a reference for creating other database backends.

> If there is every to be database backed sessions included in mod_python as
> a standard feature, I'd suggest it is more likely to be code which uses the
> Apache 2.2 mod_dbd module in some way so that that stuff in Apache can
> be leveraged for the task of database connection management etc.


This is something I think we should pursue. If we don't make any 
progress on it in the near term I think it might make a nice Google 
Summer of Code project for 2007.

> Keep in
> mind that mod_python is all about trying to use what Apache provides as
> much as possible, rather than creating a separate universe and just using
> Apache as a hopping off point.
>> I would love to contribute to the wiki, I'll see into it over the next
>> few days. I have been a programmer devoted to Open Source since Linux
>> was half a kernel (I implemented large parts of the V4 TCP/IP stack).
> If you want to get involved in the wiki great. Adding the MySQLSession
> class as an example would be a good thing to add to the wiki and for the
> time being at least is probably the most appropriate place for it to go.
>> Can you help me getting into mod_python development? I am interested in
>> adding useful features (like MySQLSession haha)
> The way the Apache software foundation works is that new developers on
> projects get commit access on the repository by way of invitation. They 
> will
> get an invitation by demonstrating good knowledge of the package by
> helping out on the mailing lists by giving useful assistance to others. 
> Finding
> bugs in the package and investigating it to the level of being able to 
> provide
> a fix also helps. With the wiki now in place, contributing there would also
> show your abilities and knowledge and in conjunction with other things
> give confidence that providing you commit access to the source code would
> be the right thing to do.
> As a first step though, I would suggest you get yourself subscribed to the
> mod_python developers mailing list in addition to the standard user mailing
> list. I have never seen you post on the developers list so am assuming you
> aren't subscribed there at present. Use the mailing list to learn, and 
> contribute
> as you can. If over time you give the core developers a good impression and
> when we are looking for extra developers, then you would be considered.

Getting on the developers list is definitely  the first step. Subscribe 
by sending a message to python-dev-subscribe at httpd.apache.org.


More information about the Mod_python mailing list