Moving from PHP to Python. Is it Possible

mdipierro massimodipierro71 at gmail.com
Sat Dec 19 23:08:00 EST 2009


About you point 3). You may want to look into:

http://www.web2py.com/php

It translates a PHP page into a web2py template. It is crude and
primitive and fails in some cases. Moreover a literal translation is
not what you really want since you want to follow a more MVC design.
Moreover it will not always maps PHP functions into valid Python/
web2py ones. Yet it may be a useful as a learning tool. I made it to
convert Drupal templates into web2py layouts.

Massimo


On Dec 11, 4:26 am, Sancar Saran <sancar.sa... at evodot.com> wrote:
> Greetings.
>
> I'm 35 yrs old self learner  and who do daily PHP coding for food more than a
> decade.
>
> After ten years of PHP coding I'm getting bored and give try for learning new
> things.
>
> After 3 days of crawling google, diving in python and cursing, now  I can show
> something on my linux/apache/mod_wsgi setup.
>
> And i'm struck on something.
>
> I had CMS design. It works with PHP very well. And I want to transfer my
> design in Python.
>
> My design depends on a Global Array. A huge array which store everything about
> requested Web page for a final rendering.
>
> In PHP accessing globals is easy. You may do direct access or use class
> something like ZEND Registry.
>
> I'm looking for similar facility in python world.
>
> Also I have couple of questions.
>
> 1-) Can I create Global (read/write access anywhere from my code) Multi
> dimensional, associative array (or hash) and store any kind of variable type.
>
> 2-) Is there any error trigger for mod_wsgi. When something go bad I god
> Internal Server error. Looking for error log was't nice. Is there any way to
> shows errors in the web page ?
>
> 3-) Any documents books sites about helping moving from php to python
>
> 4-) In php we had someting like
> ob_start(); // start Output buffering
> require('hede.php'); // include phtml similar to psp. mixed language and html
> (to avoiding string replacement (or marker based) html templates)
> $var = ob_get_clean(); // get rendered output and use anywhere
>
> can find a similar abilities in Python ?
>
> 5-) is there any Python documentation based on examples. When I give up about
> to finding  php's $_REQUEST or $_SERVER equivalents in python some demo code in
> Twisted docs are much helpful than any other words. Me and my kind already
> have  problem with English language. Example code much more helpful than full
> academic description.
>
> Thanks for support and patience for this old noob.
>
> Regards...




More information about the Python-list mailing list