Re: Moving to Python from PHP - 3 questions

2005-02-21 Thread Fredrik Lundh
Joe Francia wrote:

 You'll also want to probably look at some of the templating kits, of which 
 Cheetah and/or 
 ElementTree work best for me.  (Well, ElementTree isn't exactly a templating 
 kit - it's a 
 general-purpose XML tookit - but it is easily used for templating.)

if you want element-based templating, see:

http://lesscode.org/projects/kid/

/F 



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Moving to Python from PHP - 3 questions

2005-02-21 Thread bruno modulix
Michal Migurski wrote:
The python-based zope application server has session management. Togther
with a built-in user and access rights management.
...
This can be done in zope if you name a variable name:list. That then 
will
give you the variable as list regardless of the number of occurences.

Thank you. My impression of Zope in the past has been that it does what 
I need, along with 10,000 other things I don't (built in WebDAV 
server?!),
Our web designer just *loves* it (and ZopePageTemplates too, since they 
work quite ok with it's favorite html editor...). Might not be useful to 
you, but...

but clearly I owe it another chance. I've been initially 
attracted to mod_python because of its raw simplicity and its apparent 
similarity to mod_php and mod_perl, which I am familiar with. I'll give 
Zope a try.
Zope is a great product, but hard to get into, and it's sometime just 
too big and fat for some simple things. So while it may be worth giving 
it a try, I would not recommend it for all and any project.

Now when it comes to session management and the like, there are many 
other libs/frameworks/etc based on mod_python.

This might be a good start :
http://www.python.org/topics/web/
HTH
--
bruno desthuilliers
python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for 
p in '[EMAIL PROTECTED]'.split('@')])
--
http://mail.python.org/mailman/listinfo/python-list


Re: Moving to Python from PHP - 3 questions

2005-02-21 Thread grahamd

Michal Migurski wrote:
 3) Structured request variables. PHP has a really handy feature where

 request variables with name like foo[], foo[bar], or
 foo[bar][baz] are automatically structured into nested associative
 arrays. I can see that the python cgi module will make a list of
 MiniFieldStorage objects when more than one variable with the same
name

Someone already piped in by suggesting Vampire for mod_python, so
would add that Vampire supports structured form variables by making
use of:

  http://svn.colorstudy.com/trunk/Validator/validator/variabledecode.py

Thus, if you follow the form naming conventions this code supports,
then data can be turned into lists and dictionaries as appropriate. The
only thing is the naming convention is different to what you list
above.
Read the comments in linked code to see what it does actually use.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Moving to Python from PHP - 3 questions

2005-02-21 Thread grahamd
 If you do manage to get mod_python working, I suggest taking a look
at
 Vampire as well: http://www.dscpl.com.au/projects/vampire/
 I have had good experience with it. Once you start using mod_python
 you'll realize you can really go anywhere you want; and that's not
 necessarily a good thing. Vampire points you in a nice direction (I
 don't want to say 'the right' direction).

Vampire is still in a growing phase, so would be interested to hear any
comments you may have about how it can be improved. Up until now
I have mainly been focusing on making the basic features of mod_python
just that bit easier to use.

And yes I know that a lot more documentation would be a good start.
I am so snowed under with work in my real job at the moment that
progress is slow in that respect. :-(

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Moving to Python from PHP - 3 questions

2005-02-20 Thread Diez B. Roggisch
Hi,

 2) Session management. Cookie-based sessions in PHP are pretty
 transparent, with a small library of basic functions that do 95% of
 what anyone may need to store session data in serialized files and
 associate them with cookies. I've seen python code that accomplishes
 this, but so far no pre-built server-side session management modules.

The python-based zope application server has session management. Togther
with a built-in user and access rights management. 

 3) Structured request variables. PHP has a really handy feature where
 request variables with name like foo[], foo[bar], or
 foo[bar][baz] are automatically structured into nested associative
 arrays. I can see that the python cgi module will make a list of
 MiniFieldStorage objects when more than one variable with the same name
 is provided, but that's about the extent of it that I've seen.

This can be done in zope if you name a variable name:list. That then will
give you the variable as list regardless of the number of occurences.

 
 An RTFM answer with a URL for the M would be great. :)

For zope: http://www.zope.org/

But there are plenty of other python http frameworks. The mod_python is
AFAIK the most basic and primitive one. But build on top of it or fully
python-based you have plenty of options. Google is your friend - this NG
features similar discussions every other week.


-- 
Regards,

Diez B. Roggisch
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Moving to Python from PHP - 3 questions

2005-02-20 Thread Michal Migurski
The python-based zope application server has session management. 
Togther
with a built-in user and access rights management.
...
This can be done in zope if you name a variable name:list. That then 
will
give you the variable as list regardless of the number of occurences.
Thank you. My impression of Zope in the past has been that it does what 
I need, along with 10,000 other things I don't (built in WebDAV 
server?!), but clearly I owe it another chance. I've been initially 
attracted to mod_python because of its raw simplicity and its apparent 
similarity to mod_php and mod_perl, which I am familiar with. I'll give 
Zope a try.

--
michal migurski- contact info, blog, and pgp key:
sf/cahttp://mike.teczno.com/contact.html
--
http://mail.python.org/mailman/listinfo/python-list


Re: Moving to Python from PHP - 3 questions

2005-02-20 Thread Diez B. Roggisch
 Thank you. My impression of Zope in the past has been that it does what
 I need, along with 10,000 other things I don't (built in WebDAV
 server?!), but clearly I owe it another chance. I've been initially

The apache has a built in webdav server too - is that a reason _not_ to use
it? If you don't want a feature, don't use it. You can turn them off, btw. 

But what you might not be aware of is that zope does not store its
templates, scripts and files in general in the filesystem as php does, but
as objects in the zodb database. So webdav and ftp are other views to that
objects that allow you to load and save these files using normal editors
and tools, not only the web-interface of zope. The advantage of this
approach is that versioning of content - regardless of it's type - is
built-in. Can be a life-saver sometimes :)

 attracted to mod_python because of its raw simplicity and its apparent
 similarity to mod_php and mod_perl, which I am familiar with. 

It certainly is the most simple way to create dynamic content. But there is
a big difference between python and php: php started as a web-developers
tool, and it's features are a direct consequence of that. python oth is a
general purpose programming language - it is certainly suited for web
development, but not limited to. There are people who also want to use php
as general purpose programming language - but nevertheless, its design has
been influenced by its main purpose. So you e.g. get session state handling
for free  - as more or less _all_ web-apps today need them.


-- 
Regards,

Diez B. Roggisch
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Moving to Python from PHP - 3 questions

2005-02-20 Thread Brian Beck
Michal Migurski wrote:
Thank you. My impression of Zope in the past has been that it does what 
I need, along with 10,000 other things I don't (built in WebDAV 
server?!), but clearly I owe it another chance. I've been initially 
attracted to mod_python because of its raw simplicity and its apparent 
similarity to mod_php and mod_perl, which I am familiar with. I'll give 
Zope a try.
Personally, I'd have to say that your impression was right. Once you 
start using Zope, you'll start to feel locked in. Sure, it does a lot 
for you, but it's also a big investment.

I can't really help you to get mod_python working on OS X, but 
concerning your other two points, did you notice these two sections in 
the documentation?

http://modpython.org/live/current/doc-html/pyapi-sess.html
http://modpython.org/live/current/doc-html/pyapi-mprequest.html
mod_python and Zope are not your only options by far. In fact, they're 
at completely opposite ends of the spectrum; mod_python being low-level 
in that you are in control of everything and have the necessary tools to 
build a framework, and Zope being the highest-level in that it does tons 
of stuff for you. There are dozens of frameworks in between.

If you do manage to get mod_python working, I suggest taking a look at 
Vampire as well: http://www.dscpl.com.au/projects/vampire/
I have had good experience with it. Once you start using mod_python 
you'll realize you can really go anywhere you want; and that's not 
necessarily a good thing. Vampire points you in a nice direction (I 
don't want to say 'the right' direction).

--
Brian Beck
Adventurer of the First Order
--
http://mail.python.org/mailman/listinfo/python-list


Re: Moving to Python from PHP - 3 questions

2005-02-20 Thread Brian Beck
Maybe this can help you get it working on OS X:
http://thread.gmane.org/gmane.comp.python.mod-python/4039
But as stated in my other post, you may want to take a look at your 
other options first. Web development with Python is really nothing like 
PHP, unless you really want it to be.

--
Brian Beck
Adventurer of the First Order
--
http://mail.python.org/mailman/listinfo/python-list


Re: Moving to Python from PHP - 3 questions

2005-02-20 Thread Joe Francia
Michal Migurski wrote:
Thank you. My impression of Zope in the past has been that it does what 
I need, along with 10,000 other things I don't (built in WebDAV 
server?!), but clearly I owe it another chance. I've been initially 
attracted to mod_python because of its raw simplicity and its apparent 
similarity to mod_php and mod_perl, which I am familiar with. I'll give 
Zope a try.

I am moving my band's website from an antiquated and horrible PHPNuke 
site to a Python-based site, and so have done quite a bit of research 
about this (though I never considered myself a PHP expert).  Here's what 
I've come up with...

Zope is excellent (especially with Plone), but if you are not building 
applications that require lots of levels of access and permissions and 
collaborations, as well as the 10,000 other things you speak of, you 
probably would like something simpler than Zope, such as CherryPy or 
Quixote.  Both are excellent and light-weight frameworks that give you 
session support and easy access to request variables (as well as full 
access to the entire Python language).  Conceptually, the two are very 
close, but I am slightly more biased towards CherryPy lately.  Quixote 
has better built in form support, but now that I've discovered FormKit, 
this seems to becoming a non-issue.  Also, both are pure Python so 
should run anywhere Python does (though Quixote has a C extension, it 
will fallback to a somewhat slower pure-Python version if your platform 
cannot compile the extension).

There are other good frameworks out there, like Nevow and Webware, but 
have a somewhat larger conceptual overhead which doesn't rest as easy 
with me.  You'll also want to probably look at some of the templating 
kits, of which Cheetah and/or ElementTree work best for me.  (Well, 
ElementTree isn't exactly a templating kit - it's a general-purpose XML 
tookit - but it is easily used for templating.)

General Python web programming:
http://www.python.org/topics/web/
Frameworks/toolkits:
[CherryPy] http://www.cherrypy.org/
[Quixote] http://www.mems-exchange.com/software/quixote
[FormKit] http://dalchemy.com/opensource/formkit/
[Cheetah] http://www.cheetahtemplate.org/
[ElementTree] http://effbot.org/zone/element-index.htm
[Nevow] http://nevow.com/
[Webware] http://www.webwareforpython.org/
For more comparisons of some of the various frameworks:
[PyWebOff] http://pyre.third-bit.com/pyweb/index.html
[Python Web Shootout (older)] http://www.colorstudy.com/docs/shootout.html
--
Soraia: http://www.soraia.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: Moving to Python from PHP - 3 questions

2005-02-20 Thread Michal Migurski
Thank you. My impression of Zope in the past has been that it does 
what I need, along with 10,000 other things I don't (built in WebDAV 
server?!), but clearly I owe it another chance. I've been initially 
attracted to mod_python because of its raw simplicity and its 
apparent similarity to mod_php and mod_perl, which I am familiar 
with. I'll give Zope a try.
I am moving my band's website from an antiquated and horrible PHPNuke 
site to a Python-based site, and so have done quite a bit of research 
about this (though I never considered myself a PHP expert).  Here's 
what I've come up with...
[snip]
This is awesome, quote a bit to chew on. Thank you Joe!
--
michal migurski- contact info, blog, and pgp key:
sf/cahttp://mike.teczno.com/contact.html
--
http://mail.python.org/mailman/listinfo/python-list