Login Script

S

Simon Faulkner

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?

Any advice...


Simon
(PS I know that I should probably be using Zope but I don't really
understand it yet...)
 
?

=?ISO-8859-1?Q?Gerhard_H=E4ring?=

Simon said:
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
Python: http://www.python.org/cgi-bin/moinmoin/WebProgramming

These seem to be particularly popular: Albatross, Webware, Quixote,
Jonpy. All of them can work with standalone CGI scripts as well.
Simon
(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.

-- Gerhard
 
S

Simon Faulkner

Big thanks for this comprehensive reply.

I am well versed with MySQL so that's my backend.

Any particular favorites for a front end?

Simon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,265
Latest member
TodLarocca

Latest Threads

Top