I have written a small Python web database which was initially just
used in house.
Now we want people to be able to read some pages from outside so I
need to implement some sort of security.
Does Python have sessions like PHP?
If not should I roll my own from a cookie and a MySQL table?
(PS I know that I should probably be using Zope but I don't really
understand it yet...)
Re: Login Script
Simon Faulkner wrote:
> I have written a small Python web database which was initially just
> used in house.
Is this a CGI-based solution?
> Now we want people to be able to read some pages from outside so I
> need to implement some sort of security.
> Does Python have sessions like PHP?
The cgi module doesn't include anything for sessions, but there are tons
of third-party solutions for sessions.
All Python web frameworks should have integrated support for sessions.
I'm right now using Quixote to create a web frontend for a custom
PostgreSQL-backed hosting solution I've developed. It needs sessions,
because each user can configure her or his mailboxes and HTTP domains.
> If not should I roll my own from a cookie and a MySQL table?
Ouch, MySQL. Sounds like you're using CGI as well :-P
> Any advice...
The quick solution is to grab an existing standalone session module. I
believe you could use the one from Jonpy. Rolling your own with Cookies
and a persistent database isn't that hard either.
My advice is that if you plan to do more web development with Python,
that you start using a web framework. Perhaps Jonpy is a good candidate
for you (http://jonpy.sourceforge.net/).
Here's an overwhelming resource for web programming solutions for
These seem to be particularly popular: Albatross, Webware, Quixote,
Jonpy. All of them can work with standalone CGI scripts as well.
> (PS I know that I should probably be using Zope but I don't really
> understand it yet...)
Nah. You don't need to use something as complex as ZOPE to get sessions.
Nor do you need to use something as primitive as the cgi module. There
are lots of solutions which are in-between in complexity and features.
Re: Login Script
Big thanks for this comprehensive reply.
I am well versed with MySQL so that's my backend.
Any particular favorites for a front end?
|All times are GMT. The time now is 08:42 AM.|
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.