Re: taking python enterprise level?...

2010-03-01 Thread mdipierro
On Mar 1, 6:32 am, simn_stv nany...@googlemail.com wrote:
...

  You have to follow some tricks:

  1) have the web server serve static pages directly and set the pragma
  cache expire to one month
  2) cache all pages that do not have forms for at least few minutes
  3) avoid database joins

 but this would probably be to the detriment of my database design,
 which is a no-no as far as im concerned. The way the tables would be
 structured requires 'joins' when querying the db; or could you
 elaborate a little??

Joins are the bottle neck of most web app that relay on relational
databases. That is why non-relational databases such as Google App
Engine, CouchDB, MongoDB do not even support Joins. You have to try to
minimize joins as much as possible by using tricks such as de-
normalization and caching.

  4) use a server with at least 512KB Ram.

 hmmm...!, still thinking about what you mean by this statement also.

I meant 512MB. The point is you need a lot of ram because you want to
run multiple python instances, cache in ram as much as possible and
also allow the database to buffer in ram as much as possible. You will
see Ram usage tends to spike when you have lots of concurrent
requests.

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


Re: taking python enterprise level?...

2010-02-26 Thread mdipierro
100,000 hits a day is not a low. I get that some day on my web server
without problem and without one request dropped.

Most frameworks web2py, Django, Pylons can handle that kind of load
since Python is not the bottle neck.
You have to follow some tricks:

1) have the web server serve static pages directly and set the pragma
cache expire to one month
2) cache all pages that do not have forms for at least few minutes
3) avoid database joins
4) use a server with at least 512KB Ram.
5) if you pages are large, use gzip compression

If you develop your app with the web2py framework, you always have the
option to deploy on the Google App Engine. If you can live with their
constraints you should have no scalability problems.

Massimo



On Feb 25, 4:26 am, simn_stv nany...@googlemail.com wrote:
 hello people, i have been reading posts on this group for quite some
 time now and many, if not all (actually not all!), seem quite
 interesting.
 i plan to build an application, a network based application that i
 estimate (and seriously hope) would get as many as 100, 000 hits a day
 (hehe,...my dad always told me to 'AIM HIGH' ;0), not some 'facebook'
 or anything like it, its mainly for a financial transactions which
 gets pretty busy...
 so my question is this would anyone have anything that would make
 python a little less of a serious candidate (cos it already is) and
 the options may be to use some other languages (maybe java, C (oh
 God))...i am into a bit of php and building API's in php would not be
 the hard part, what i am concerned about is scalability and
 efficiency, well, as far as the 'core' is concerned.

 would python be able to manage giving me a solid 'core' and will i be
 able to use python provide any API i would like to implement?...

 im sorry if my subject was not as clear as probably should be!.
 i guess this should be the best place to ask this sort of thing, hope
 im so right.

 Thanks

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


Re: python xmlrpc client with ssl client certificates and standard modules

2010-01-04 Thread mdipierro
xmlrpc acts at the application layer and ssl at the transport layer so
they can inter operate easily as long as you do not use the
certificate to authenticate the client but only validate the server
and encrypt data (which you can also do but it is more complicated)

One option for you is to use web2py which include an xmlrpc server
that uses a wsgi ssl enabled web server.

Here is how:

1) Install web2py
2) Visit http://127.0.0.1:8000/admin and create a new application from
the web based IDE
3) create your web service for example, in a controller default.py

 @service.xmlrpc
 def add(a,b): return int(a)+int(b)

4) Restart web2py with

 python web2py.py -a ADMIN_PASSWD -c SSL_CERTIFICATE -k
SSL_PRIVATE_KEY -i 0.0.0.0 -p 443

5) You can now access the service from any Python program:

  import xmlrpclib
  server_url = 'https://myserver:443/yourapp/default/call/
xmlrpc'
  server = xmlrpclib.Server(server_url)
  print server.add(3,4)
 7

Hope this helps.



On Jan 3, 8:12 pm, News123 news...@free.fr wrote:
 Hi,

 I was googling fot quite some time and was not really succesfull.

 I found one solution, which I will try soon.
 It ishttp://www.cs.technion.ac.il/~danken/xmlrpc-ssl.html
 (found inhttp://hamakor.org.il/pipermail/python-il/2008-February/29.html)

 This will probably work, but it requires the module M2Crypto.

 In order to avoid installing M2Crypto an all hosts that want to run the
 script I wondered, whether there is no other solution.

 I can do xmlrpc over ssl WITHOUT certificates with following code:

 import xmlrpclib
 server_url = 'https://myserver'
 server = xmlrpclib.Server(server_url);

 and I can perform a https get request WITH certificates with below snippet:

 import httplib
 conn = httplib.HTTPSConnection(
         HOSTNAME,
         key_file = KEYFILE,
         cert_file = CERTFILE
 )
 conn.putrequest('GET', '/')
 conn.endheaders()
 response = conn.getresponse()
 print response.read()

 I'm just lost of how to 'combine' both.

 Thanks in advance for any suggestions / hints

 N

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


Re: python xmlrpc client with ssl client certificates and standard modules

2010-01-04 Thread mdipierro
If it is a client problem than web2py will be on help.

If your server is written already you may be able to use it with the
ssl cherrypy wsgi server (the one that web2py uses) and you do not
need web2py at all.

Massimo

On Jan 4, 3:38 am, News123 news...@free.fr wrote:
 Thanks for your answer.

 I'll look at web2py.

 However web2py seems to address the xmlrpc server (at least in your
 example). The xmlrpc server application exists alerady and requires a
 client certificate.

 The client example doesn't seem to be using a certificate.

 So I'll be reading a little into web2py.

 bye

 N

 mdipierro wrote:
  xmlrpc acts at the application layer and ssl at the transport layer so
  they can inter operate easily as long as you do not use the
  certificate to authenticate the client but only validate the server
  and encrypt data (which you can also do but it is more complicated)

  One option for you is to use web2py which include an xmlrpc server
  that uses a wsgi ssl enabled web server.

  Here is how:

  1) Install web2py
  2) Visithttp://127.0.0.1:8000/adminand create a new application from
  the web based IDE
  3) create your web service for example, in a controller default.py

      �...@service.xmlrpc
       def add(a,b): return int(a)+int(b)

  4) Restart web2py with

       python web2py.py -a ADMIN_PASSWD -c SSL_CERTIFICATE -k
  SSL_PRIVATE_KEY -i 0.0.0.0 -p 443

  5) You can now access the service from any Python program:

        import xmlrpclib
        server_url = 'https://myserver:443/yourapp/default/call/
  xmlrpc'
        server = xmlrpclib.Server(server_url)
        print server.add(3,4)
       7

  Hope this helps.

  On Jan 3, 8:12 pm, News123 news...@free.fr wrote:
  Hi,

  I was googling fot quite some time and was not really succesfull.

  I found one solution, which I will try soon.
  It ishttp://www.cs.technion.ac.il/~danken/xmlrpc-ssl.html
  (found 
  inhttp://hamakor.org.il/pipermail/python-il/2008-February/29.html)

  This will probably work, but it requires the module M2Crypto.

  In order to avoid installing M2Crypto an all hosts that want to run the
  script I wondered, whether there is no other solution.

  I can do xmlrpc over ssl WITHOUT certificates with following code:

  import xmlrpclib
  server_url = 'https://myserver'
  server = xmlrpclib.Server(server_url);

  and I can perform a https get request WITH certificates with below snippet:

  import httplib
  conn = httplib.HTTPSConnection(
          HOSTNAME,
          key_file = KEYFILE,
          cert_file = CERTFILE
  )
  conn.putrequest('GET', '/')
  conn.endheaders()
  response = conn.getresponse()
  print response.read()

  I'm just lost of how to 'combine' both.

  Thanks in advance for any suggestions / hints

  N



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


Re: What is the best data structure for a very simple spreadsheet?

2010-01-03 Thread mdipierro
Perhaps this can be useful:
http://www.web2py.com/examples/spreadsheet

The code is in a single file with not dependencies and it does not
require web2py to run:
http://code.google.com/p/web2py/source/browse/gluon/contrib/spreadsheet.py

Here is a sample controller that shows you how to embed the
spreadsheet in web page:
http://code.google.com/p/web2py/source/browse/applications/examples/controllers/spreadsheet.py

Massimo



On Jan 3, 5:27 am, vsoler vicente.so...@gmail.com wrote:
 Hi,

 Not sure this is the best group to post, but I cannot think of any
 other.

 My application would contain a limited set of cells represented by
 the instances of a Cell class:

 class Cell:
 ...

 A1=Cell(7)
 A2=Cell(2*A1)
 A3=Cell(3*A1+A2)
 A4=Cell(A3*4)

 Of course, A1 = 7, A2 = 14, A3 = 35 and A4 = 140

 Now, I somehow want to be able to show a dependency tree

 1 level dependency trees
   A1: None
   A2: A1
   A3: A1, A2
   A4: A3

 All levels dependency trees

   A1: None
   A2: A1
   A3: A1, A2
   A4: A3, A2, A1

 Leaf + values dependency trees:

   A1: 7
   A2: A1=7, 2
   A3: 3, A1=7, 2
   A4: 3, A1=7, 2, 4

 What I'd like to know is:

 1) what are, in your opinion, the basic elements of the Cell class?
 2) Do I need a parser to evaluate the formulas like “3*A1+A2”? Can you
 recommend one library that already contains one?
 3) Do I need a tree data structure to represent my data? would the
 tree be an attribute of the class instance?

 I imagine a lot can be said on these questions. What I am looking for
 is some hints that help me get out of where I am now.

 Any help is highly appreciated.

 Vicente Soler

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


Re: Recommendation for small, fast, Python based web server

2009-12-25 Thread mdipierro
This is a new wsgi web server implemented in a single file.

http://code.google.com/p/web2py/source/browse/gluon/sneaky.py

I could use some help with testing.

Here is a version for Python 3.0

http://code.google.com/p/web2py/source/browse/gluon/sneaky.py


Massimo

On Dec 25, 12:38 pm, a...@pythoncraft.com (Aahz) wrote:
 In article mailman.1720.1260539582.2873.python-l...@python.org,
 Antoine Pitrou  solip...@pitrou.net wrote:



 Apparently you have debugged your speed issue so I suppose you don't have
 performance problems anymore. Do note, however, that Python is generally
 not as fast as C -- especially for low-level stuff -- and a Python Web
 server will probably serve around 10x less requests per second than a C
 Web server like Apache (this will still give you hundreds of simple
 requests per second on a modern machine).

 For static pages or dynamic pages?  Once you get into dynamic pages, I
 sincerely doubt that the smaller Apache overhead makes lots of
 difference.
 --
 Aahz (a...@pythoncraft.com)           *        http://www.pythoncraft.com/

 Looking back over the years, after I learned Python I realized that I
 never really had enjoyed programming before.

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


Re: Anybody use web2py?

2009-12-22 Thread mdipierro
Some may find useful to compare:

- A Crash Course on Django
http://articles.sitepoint.com/article/django-crash-course

- A Crash Course on Web2py
http://www.web2py.com/AlterEgo/default/show/253

They basically describe the same app and the steps to built it. Sorry
I had not time to make screenshots.

I personally think it is great that we can learn from each other from
this kind of comparison and we can both improve.
I also think that stressing the similarities and the differences will
help prospective users understand the underlying design patterns.

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


Re: Anybody use web2py?

2009-12-21 Thread mdipierro
  On Dec 19, 12:42 am, AppRe Godeck a...@godeck.com wrote:
  Just curious if anybody prefers web2py over django, and visa versa. I
  know it's been discussed on a flame war level a lot. I am looking for a
  more intellectual reasoning behind using one or the other.

  Of course I am the most biased person in the world on this topic

 Indeed !-)
  - In web2py models and controllers are not modules. They are not
  imported. They are executed.

 I assume you mean executed in an environment defined by the framework...

yes

  This means you do not need to import
  basic web2py symbols. They are already defined in the environment that
  executes the models and controllers

 Ok. As far as I'm concerned : show stops here.

It is your choice but, why?
Exec/eval is only true distinctive feature of an interpreted language
vs a compiled language.

 (like in Rails). This also means
  you do not need to restart the web server when you edit your app.

 The dev server that comes with Django do the autorestart thing. And you
 *don't* edit yoour app directly on the production server, do you ?

Unfortunately it has happened.
In my experience the distinction between development and production is
fiction.

  - You have a web based IDE with editor,

 Why should I care ? I have a way better development environment on my
 own box.

I only use emacs. I do not use the web based IDE much myself but I
found it really helps in learning how to use the framework.

  some conflict resolution,
  Mercurial integration,

 What if use something else than mercurial ?

You can use any version control you want, the same way you would in
Django. web2py itself is version controlled in both bazaar and
mercurial. The only think about mercurial is that, if you have it
installed, the web based IDE lets you commit at the click on a
button.

  ticketing system,

 ...doesn't belong to the framework. FWIW, I already have a ticketing
 system that's language/techno agnostic, thanks.

Perhaps we are not talking about the same thing. if an error occurs in
a web2py application and I want: 1) notify the user, 2) assign the
user a ticket number; 3) log the error in the framework; 4) allow
administrator to browse past error logs; I think this belongs to the
framework else it gets clunky. Web2py tickets are out of the box and
always on.

  - The DAL supports transactions. It means it will create and/or ALTER
  tables for you as your model changes.

 Err... how does schema changes relates to transactions ???

Type migrations not transactions sorry.

 Now FWIW, when my schema do change, the create/alter table code is
 usually the most trivial part - there are quite a few other things to
 do, that no framework will ever be abale to guess. IOW, you *do* have to
 write a migration script anyway.

No. We do not have migration scripts. It is nothing like Rails. You
just edit a model and, voila', database is migrated. Nothing to type.
Nothing to click on. (you can disable it)

I respect you choosing Django but it looks like you have never tried
web2py.

  - The DAL has partial support for some legacy databases that do not
  have an 'id' auto increment primary key.

 Django's ORM has full support for tables that don't use an auto_id key.

web2py too has support for legacy databases for tables without an
auto_id but not yet for all database back-ends.

  Anyway, I think both system are great. Spend 15 minutes (no more) with
  each to make up your mind, and stick with it.

 Once again, while doing a quick dummy test app can give you a first
 general feel of the tool, it means nothing wrt/ complex real-world
 applications.

While this may be true as a general statement could you explain which
feature you find in Django that is not in web2py and that is is
crytical for building large web applications? Could you provide a
coding example of such feature? This is an honest question because it
can help us make web2py better. I have personally learned a lot from
Django and thank the Django developers for their work, I would be
happy to learn more.

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


Re: Please Help Publicize PyCon

2009-12-21 Thread mdipierro
There is huge difference between what Steve is asking and spam.

Spam is Unsolicited e-mail, often of a commercial nature, sent
indiscriminately to multiple mailing lists, individuals, or
newsgroups.

Steve is asking us help him to identify communities that we may be
part of and that we believe may be interested in the PyCon conference
and inform them.

Not every communication on the internet is spam.

Massimo


On Dec 21, 11:31 am, John Nagle na...@animats.com wrote:
 Steve Holden, Chairman, PSF wrote: Hi,everyone.

  This year I hope all readers of this list will assist me in crass
  commercial promotion of next year's PyCon.
 ...
  One particularly effective way for you prodigious email producers to
  assist is to something to your signature (as you will see I have done).

 ...

     This guy wants people to spam for him to promote his $300 conference.

     Don't support spammers.  Boycott PyCon.

                                         John Nagle

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


Re: Anybody use web2py?

2009-12-20 Thread mdipierro
The concept of distributed transaction does not make sense on GAE
because there is only one datastore.

It supports regular transactions on GAE to the extent that GAE
supports them but you have to use the GAE run_in_transaction API
explictely.

It does support distributed transactions with multiple database
connection to postgresq, mysql and/or firebird.
I think this is related to the topic because it is a distinctive
feature of web2py.

Massimo

On Dec 20, 1:32 pm, Lacrima lacrima.ma...@gmail.com wrote:
 On Dec 20, 1:35 am, mdipierro massimodipierr...@gmail.com wrote:

  Errata. I said The dal supports transactions where I meant the dal
  supports migrations.
  Of course it also supports transactions as well as distributed
  transactions.

 Sorry, if this is not related to this topic.
 Does web2py support distributed transactions with Google App Engine
 Datastore?

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


Re: Anybody use web2py?

2009-12-20 Thread mdipierro
People seem to think that because web2py has a default for almost
everything (part of its design) than you must use the default.

- There is a web based IDE but you *can* use the shell instead (like
you do in Django)
- There are migrations but you *can* disable then (and it works like
Django that does not do migrations)
- There are default views for every action but you *can* make your own
- There is a default route to every action but you *can* create your
own routes.py, equivalent to Django urls.py
- There is a default for form layout but you *can* customize them in
multiple ways
- There is a default widget for every field but you *can* change it or
define your own
- There is a default validator for every field but you *can* change it
or create your own
- It comes with a default layout.html but you can user any other html/
css layout or make your own
- It comes with jQuery but you *can* use any other javascript library
- It default to email/password login but you *can* use other
authentication methods (gmail, twitter, openid, rpx, cas, ldap).
- etc.

The only things that web2py does not let you customize are things that
have security implications (like how sessions and uploads are
handled).

On Dec 20, 3:09 pm, Baron richar...@gmail.com wrote:
  If all
  web2py offers is default views, then it may be good for proof of concept
  projects, however I can't see in my right mind, proofing an application,
  and then turning around to write it in django because more than the
  defaults is needed.

 You *can* customize web2py views ...

  Why does web2py have classes that represent HTML? I can't see ever
  needing to write VIEW code in my controller, since thats what views are
  for.

 I use these in my views when a HTML tag has multiple dynamic
 properties because it looks more neat.

 I came to web2py a year back after writing applications in many other
 frameworks (Turbogears / Symonfy / Rails / Django) and find myself
 more productive with web2py.
 So as others have said - try both. Write a small application in both
 to see which suits you.

 Richard

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


Re: Anybody use web2py?

2009-12-19 Thread mdipierro
On Dec 19, 12:42 am, AppRe Godeck a...@godeck.com wrote:
 Just curious if anybody prefers web2py over django, and visa versa. I
 know it's been discussed on a flame war level a lot. I am looking for a
 more intellectual reasoning behind using one or the other.

Of course I am the most biased person in the world on this topic but
perhaps you want to hear my bias.

A little bit of history... I thought a Django course at DePaul
University and built a CMS for the United Nations in Django. I loved
it. Then I also learned RoR. I found RoR more intuitive and better for
rapid prototyping. I found Django much faster and more solid. I
decided to build a proof of concept system that was somewhat in
between Django and Rails with focus on 3 features: 1) easy to start
with (no installation, no configuration, web based IDE, web based
testing, debugging, and database interface); 2) enforce good practice
(MVC, postbacks); 3) secure (escape all output, talk to database via
DAL to present injections, server-side cookies with uuid session keys,
role based access control with pluggable login methods, regex
validation for all input including URLs).

Originally it was a proof of concept, mostly suitable for teaching.
Then lots of people helped to make it better and turn it into a
production system. Now he had more than 50 contributors and a more
than 20 companies that provide support.

There are some distinctive features of web2py vs Django. Some love
them, some hate hate them (mostly people who did not try them):

- We promise backward compatibility. I do not accept patches that
break it. It has been backward compatible for three years and I will
enforce the copyright, if necessary, in order to ensure it for the
future.

- In web2py models and controllers are not modules. They are not
imported. They are executed. This means you do not need to import
basic web2py symbols. They are already defined in the environment that
executes the models and controllers (like in Rails). This also means
you do not need to restart the web server when you edit your app. You
can import additional modules and you can define modules if you like.

- You have a web based IDE with editor, some conflict resolution,
Mercurial integration, ticketing system, web-based testing and
debugging.

- The Database Abstraction Layer (DAL) is closed to SQL than Dango ORM
is. This means it does less for you (in particular about many 2 many)
but it is more flaxible when it comes to complex joins, aggregates and
nested selects.

- The DAL supports out of the box SQLite, MySQL, PostgreSQL, MSSQL,
Oracle, FireBird, FireBase, DB2, Informix, Ingres, and the Google App
Engine (except for joins and multi-entity transactions). We plan
support for Sybase and MongoDB within one month.

- The DAL supports transactions. It means it will create and/or ALTER
tables for you as your model changes. This can be disabled.

- The DAL has partial support for some legacy databases that do not
have an 'id' auto increment primary key.

- It has a plugin and a component systems (here is an old video:
http://www.vimeo.com/7182692 the video says experimental but this is
now stable in trunk, although not very well documented).

- both systems have a web based database interface (Django calls it
admin, web2py calls it appadmin, not to be confused with web2py
admin, the IDE). The Django one is more polished, customizable and
designed to be exposed to users. The web2py one is raw and designed
for the administrator. It is not customizable. Because it is designed
for the administrator and requires administrator login it allows
arbitrary DAL code to be executed. It can be disabled.

Here is the last app I built with it: http://www.vimeo.com/7182692
running on GAE here: http://www.vimeo.com/7182692


Here http://www.vimeo.com/6507384 you can see a video in which I
rewrite the Django polls tutorial in web2py. You will get an idea of
some of the differences.

Anyway, I think both system are great. Spend 15 minutes (no more) with
each to make up your mind, and stick with it.

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


Re: Anybody use web2py?

2009-12-19 Thread mdipierro
Errata. I said The dal supports transactions where I meant the dal
supports migrations.
Of course it also supports transactions as well as distributed
transactions.


On Dec 19, 5:32 pm, mdipierro massimodipierr...@gmail.com wrote:
 On Dec 19, 12:42 am, AppRe Godeck a...@godeck.com wrote:

  Just curious if anybody prefers web2py over django, and visa versa. I
  know it's been discussed on a flame war level a lot. I am looking for a
  more intellectual reasoning behind using one or the other.

 Of course I am the most biased person in the world on this topic but
 perhaps you want to hear my bias.

 A little bit of history... I thought a Django course at DePaul
 University and built a CMS for the United Nations in Django. I loved
 it. Then I also learned RoR. I found RoR more intuitive and better for
 rapid prototyping. I found Django much faster and more solid. I
 decided to build a proof of concept system that was somewhat in
 between Django and Rails with focus on 3 features: 1) easy to start
 with (no installation, no configuration, web based IDE, web based
 testing, debugging, and database interface); 2) enforce good practice
 (MVC, postbacks); 3) secure (escape all output, talk to database via
 DAL to present injections, server-side cookies with uuid session keys,
 role based access control with pluggable login methods, regex
 validation for all input including URLs).

 Originally it was a proof of concept, mostly suitable for teaching.
 Then lots of people helped to make it better and turn it into a
 production system. Now he had more than 50 contributors and a more
 than 20 companies that provide support.

 There are some distinctive features of web2py vs Django. Some love
 them, some hate hate them (mostly people who did not try them):

 - We promise backward compatibility. I do not accept patches that
 break it. It has been backward compatible for three years and I will
 enforce the copyright, if necessary, in order to ensure it for the
 future.

 - In web2py models and controllers are not modules. They are not
 imported. They are executed. This means you do not need to import
 basic web2py symbols. They are already defined in the environment that
 executes the models and controllers (like in Rails). This also means
 you do not need to restart the web server when you edit your app. You
 can import additional modules and you can define modules if you like.

 - You have a web based IDE with editor, some conflict resolution,
 Mercurial integration, ticketing system, web-based testing and
 debugging.

 - The Database Abstraction Layer (DAL) is closed to SQL than Dango ORM
 is. This means it does less for you (in particular about many 2 many)
 but it is more flaxible when it comes to complex joins, aggregates and
 nested selects.

 - The DAL supports out of the box SQLite, MySQL, PostgreSQL, MSSQL,
 Oracle, FireBird, FireBase, DB2, Informix, Ingres, and the Google App
 Engine (except for joins and multi-entity transactions). We plan
 support for Sybase and MongoDB within one month.

 - The DAL supports transactions. It means it will create and/or ALTER
 tables for you as your model changes. This can be disabled.

 - The DAL has partial support for some legacy databases that do not
 have an 'id' auto increment primary key.

 - It has a plugin and a component systems (here is an old 
 video:http://www.vimeo.com/7182692the video says experimental but this is
 now stable in trunk, although not very well documented).

 - both systems have a web based database interface (Django calls it
 admin, web2py calls it appadmin, not to be confused with web2py
 admin, the IDE). The Django one is more polished, customizable and
 designed to be exposed to users. The web2py one is raw and designed
 for the administrator. It is not customizable. Because it is designed
 for the administrator and requires administrator login it allows
 arbitrary DAL code to be executed. It can be disabled.

 Here is the last app I built with it:http://www.vimeo.com/7182692
 running on GAE here:http://www.vimeo.com/7182692

 Herehttp://www.vimeo.com/6507384you can see a video in which I
 rewrite the Django polls tutorial in web2py. You will get an idea of
 some of the differences.

 Anyway, I think both system are great. Spend 15 minutes (no more) with
 each to make up your mind, and stick with it.

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


Re: Anybody use web2py?

2009-12-19 Thread mdipierro
Errata 2. Before people jump on me. I said copyright but I meant
trademark. Of course web2py is GPL2 so everybody can copy and modify
it.

The license has an exception that basically treats the compiled web2py
as freeware.

The license does not extend to apps that require web2py. They can be
distributed under any license you like, included closed source and
bundled with the web2py binary.

On Dec 19, 5:32 pm, mdipierro massimodipierr...@gmail.com wrote:
 On Dec 19, 12:42 am, AppRe Godeck a...@godeck.com wrote:

  Just curious if anybody prefers web2py over django, and visa versa. I
  know it's been discussed on a flame war level a lot. I am looking for a
  more intellectual reasoning behind using one or the other.

 Of course I am the most biased person in the world on this topic but
 perhaps you want to hear my bias.

 A little bit of history... I thought a Django course at DePaul
 University and built a CMS for the United Nations in Django. I loved
 it. Then I also learned RoR. I found RoR more intuitive and better for
 rapid prototyping. I found Django much faster and more solid. I
 decided to build a proof of concept system that was somewhat in
 between Django and Rails with focus on 3 features: 1) easy to start
 with (no installation, no configuration, web based IDE, web based
 testing, debugging, and database interface); 2) enforce good practice
 (MVC, postbacks); 3) secure (escape all output, talk to database via
 DAL to present injections, server-side cookies with uuid session keys,
 role based access control with pluggable login methods, regex
 validation for all input including URLs).

 Originally it was a proof of concept, mostly suitable for teaching.
 Then lots of people helped to make it better and turn it into a
 production system. Now he had more than 50 contributors and a more
 than 20 companies that provide support.

 There are some distinctive features of web2py vs Django. Some love
 them, some hate hate them (mostly people who did not try them):

 - We promise backward compatibility. I do not accept patches that
 break it. It has been backward compatible for three years and I will
 enforce the copyright, if necessary, in order to ensure it for the
 future.

 - In web2py models and controllers are not modules. They are not
 imported. They are executed. This means you do not need to import
 basic web2py symbols. They are already defined in the environment that
 executes the models and controllers (like in Rails). This also means
 you do not need to restart the web server when you edit your app. You
 can import additional modules and you can define modules if you like.

 - You have a web based IDE with editor, some conflict resolution,
 Mercurial integration, ticketing system, web-based testing and
 debugging.

 - The Database Abstraction Layer (DAL) is closed to SQL than Dango ORM
 is. This means it does less for you (in particular about many 2 many)
 but it is more flaxible when it comes to complex joins, aggregates and
 nested selects.

 - The DAL supports out of the box SQLite, MySQL, PostgreSQL, MSSQL,
 Oracle, FireBird, FireBase, DB2, Informix, Ingres, and the Google App
 Engine (except for joins and multi-entity transactions). We plan
 support for Sybase and MongoDB within one month.

 - The DAL supports transactions. It means it will create and/or ALTER
 tables for you as your model changes. This can be disabled.

 - The DAL has partial support for some legacy databases that do not
 have an 'id' auto increment primary key.

 - It has a plugin and a component systems (here is an old 
 video:http://www.vimeo.com/7182692the video says experimental but this is
 now stable in trunk, although not very well documented).

 - both systems have a web based database interface (Django calls it
 admin, web2py calls it appadmin, not to be confused with web2py
 admin, the IDE). The Django one is more polished, customizable and
 designed to be exposed to users. The web2py one is raw and designed
 for the administrator. It is not customizable. Because it is designed
 for the administrator and requires administrator login it allows
 arbitrary DAL code to be executed. It can be disabled.

 Here is the last app I built with it:http://www.vimeo.com/7182692
 running on GAE here:http://www.vimeo.com/7182692

 Herehttp://www.vimeo.com/6507384you can see a video in which I
 rewrite the Django polls tutorial in web2py. You will get an idea of
 some of the differences.

 Anyway, I think both system are great. Spend 15 minutes (no more) with
 each to make up your mind, and stick with it.

 Massimo

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


Re: Anybody use web2py?

2009-12-19 Thread mdipierro
 Why does web2py have classes that represent HTML? I can't see ever
 needing to write VIEW code in my controller, since thats what views are
 for.

You do not need to use but if, for example, you want to build a menu
recursively, having a server-side presentation of the DOM allows to do
it without string manipulation. It is safer and less error prone.
Anyway, it is not something you must use.

Lots of the features are optional. Like the web based IDE. If you do
not like it, you can use the shell like you use Django.

  It seems that even though web2py is fast, supports lots of
features, the
 fact that in the end it gets in the way of doing what you want is it's
 downfall. Django, even though requiring more ground work, this ground
 work becomes a solid foundation on which to build your application on.

What do you mean by gets in the way? Could you provide an example?

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


Re: Moving from PHP to Python. Is it Possible

2009-12-19 Thread mdipierro
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...@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...

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


Re: How decoupled are the Python frameworks?

2009-12-09 Thread mdipierro
Interesting post. I would like to make some comments about design
decisions that went into web2py:

- For each app Model/View/Controllers/Language Files/Static Files/
Modules/Cron Tasks are stored in separated folders
- You can code only the models (no controllers and no view) and you
get a fully functional admin interface
- You can develop only controllers (with or without models but no
views) and you get a fully working application with workflow
- There is a convention for dispatching. You can override it with
routes.
- There is no metadata in the framework. URLs are mapped into an app
(within the web2py instance), into a controller file, and into a
function (action) in that controller file.
- You can have multiple apps within a web2py instance (they can be
installed, uninstalled, packaged, compiled without restarting web2py)
- You can have multiple model files, multiple controllers and multiple
views. You can override the mapping between controllers and default
views.
- You can group files (models/controllers/views/static files)
functionally into plugins. Plugins can be packaged separately from the
app and applied to multiple apps.
- Plugins expose components (i.e. reusable objects that can be
embedded in a page and talk to their own controllers via ajax).
- Plugin components are coded as any other web2py models/controller/
view but the form submission is automatically trapped (transparently
to the user) and executed via ajax so that, if the component contains
a form only the component is reloaded upon submissions of the form.
- web2py supports FORM, SQLFORM, SQLFORM.factory and CRUD for
automtical generation of forms (from a model or other structure). All
web2py forms execute postbacks and modify themselves to report error
messages. A form is comprised of widgets that contain validators.
There is a default layout but it can be customized in the view by
allocating widgets or individual html tags.
- You can put doctests in actions and we provide a web interface for
testing the app online.
- It completely abstracts the database backend (we support 10
different database backends including Google App Engine) thus make the
code very portable.
- It authomatically writes sql for queries, for create table and alter
table.
-Web2py provides a Role Based Access Control mechanism with plugguble
login components so that you can authenticate using multiple mechanism
including Gmail and Twitter for example.

Specifically about you concerns:- better scalability
- easy to test = web2py is very easy to test because of the web based
interface to doctests
- easy to maintain = In web2py Do not repeat yourself trumps
explicit if better than implicit. This means code is very compact.
- easy to re-use code for different applications = using plugins
- easy to migrate/port = because of DAL

Massimo

On Dec 7, 4:38 pm, shocks benmari...@googlemail.com wrote:
 Hi

 I'm getting back into Python after a long break.  I've been developing
 large enterprise apps solely with Adobe Flex (ActionScript) for the
 past couple years.  During that time I've used a number of 'MVC'
 frameworks to glue the bits together - among them Cairngorm, a
 modified implementation of Cairngorm using the Presentation Model
 pattern, PureMVC, Mate (an IOC container but with an MVC
 implementation) and Parsley (IOC but you have to roll-you-own MVC).
 During that time I've been in large teams (30 Flex + 30 Java) to small
 teams (2 Flex + 1 Java).  The motivation of these frameworks is the
 decouple your concerns, allowing your apps to be more scalable, easier
 to test, and  supposedly easier to maintain.  Some do the decoupling
 better job than others, but there is also the question of how
 decoupled is your code from the framework?  It's all well and good
 having something clever working behind the scenes wiring and routing
 everything together, but I wonder where this leaves the code base if
 the framework, which was selected at the beginning of the project, is
 replaced with something else months or years later (i.e. the framework
 just doesn't scale as expected, the community involvement dies and
 it's no longer maintained properly, etc).  I've seen it happen and
 I've been experienced the pain of detangling massive amounts of code
 which is full of framework specific imports, methods and boilerplate
 code.  And then there's updating the unit tests!

 My question is how good are the current crop of Python frameworks?
 I've used Django twice in production and didn't like that much.  The
 implementation is Django specific for starters.  I've picked up Pylons
 and I'm trying that out.  I'm not sure how well it fares?  I do feel a
 bit uneasy about the code generation that some of the Python
 frameworks do.  Pylons creates something like 20 files for a
 'helloworld'.  It does do some great things out of the box, but I
 wonder where that leaves your own code.  After spending 3-6 months on
 your Pylons webapp, how easy is it to move to something else?  Maybe
 

Re: Frameworks

2009-10-20 Thread mdipierro
On Oct 19, 9:01 am, flebber flebber.c...@gmail.com wrote:
 In short it seems to me that Django and Web2py include more magic in
 assisting oneself to create you web/application, whilst Pylons and
 Werkzueg leave more control in the users hands hopefully leading to
 greater expression and power.

it depends on how one defines magic. web2py provides a DAL, not an
ORM. DAL expressions translate one-to-one into SQL statements in the
appropriate dialect (or GQL on GAE), no more, without additional
superstructure. The basic API are

   db.tablename.insert(filename=value)
   db(query).select(...)
   db(query).update(...)
   db(query).delete()
   db(query).count()

an example of query is

   query=(db.tablename.fieldname=='value')|(db.tablename.fieldname.like
('A%'))

which translates into

   WEHERE tablename.fieldname = 'value' OR tablename.fieldname LIKE 'A
%'

with the appropriate escaping for security or course.


Of course you can more complex expressions for nested selects, joins,
left joins, aggregates, etc. but the general principle stands. Here is
an example:


   db().select(db.table1.field1,db.table1.field2.sum
(),groupby=db.table1.field1)

and another (which does a nested select, a join and a left join):

   db((db.table1.field1.belongs(db(db.table2.field2.id0)._select
(db.table2.field3)))
  (db.table1.field4==db.table3.field5)).select
(
  db.table1.ALL,db.table2.field6,
  left=db.table4.on
(db.table4.field6==db.table1.field7),
  orderby=db.table1.field8)



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


Re: Frameworks

2009-10-20 Thread mdipierro
One more clarification to avoid confusion. Django has admin and it
is great. Web2py also has something called admin but that is not
apples to apples.

The closest thing to Django admin in web2py is called appadmin (it
comes with it).

For example consider the following complete program:

db=DAL('sqlite://test.sqlite)
db.define_table('person',Field('name'))

appadmin is a controller that comes with each web2py app and provides
a web based interface to the database, that can be customized at the
app level, and that inherits the layout of the app.

The Django admin can be customized more and it is designed for
users. It is very sleek. The web2py appadmin is designed for the
administrator not users, and allows you to insert DAL queries
directly.

web2py also has something called admin which has nothing to do with
Django admin. It is instead a web based IDE including web based
tools for installing apps remotely, packaging apps, editing apps,
debugging, running doctests, etc. via the web interface.

Massimo

On Oct 19, 4:54 pm, Emmanuel Surleau emmanuel.surl...@gmail.com
wrote:
  Django : very strong integration, excellent documentation and support,
  huge community, really easy to get started with. And possibly a bit more
  mature and stable...

 One strong point in favour of Django: it follows Python's philosophy of
 batteries included, and features a large array of plugins. There are also
 numerous other add-ons created by the community.

 Also, it has a pretty great administration interface.

 It still manages to retain flexibility, but you're basically stuck with
 Django's ORM (which is OK for simple things) and templating language (which is
 OK as long as you don't need custom tags).

  Pylons : more loosely coupled (imply: less integration), based on
  standard components - which is both a blessing and a curse, specially
  wrt/ documentation -, requires a good knowledge of Python and the HTTP
  protocol to get started with. Very powerful and flexible but this comes
  with a price...

 Haven't used Pylons, but the documentation has improved the last few years
 with the Pylons book (http://pylonsbook.com/en/1.0/), while still not being up
 to par with Django's. It has also a methodology for deployment, which Django
 decidedly lacks.

 Cheers,

 Emm

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


Re: New Web2Py framework SLASHES development time...

2008-09-23 Thread mdipierro
Hi Paul,

yes, the model designer is the one from Ondras. We modified it so that
it generates DAL (Database Abstraction Layer) code instead of SQL and
it is a work in progress.
Technically it is not pat of web2py and in fact it is not distributed
with it.
It is just one of the many web2py apps.
You can find more on http://mdp.cti.depaul.edu/appliances

Massimo

On Sep 22, 5:48 am, Paul Boddie [EMAIL PROTECTED] wrote:
 On 22 Sep, 04:49, Steve Shephed [EMAIL PROTECTED] wrote:

  bhttp://www.web2py.comWeb2Py- Python Framework/b is the newest
  kid on the block for Python frameworks.

 I'm not going to dwell on the merits of web2py, I'm afraid...

  It has a lot of features that simply are not there in other
  frameworks. Even Ruby!. You can design database models graphically
  online.

 I had a closer look at the model designer, and the client-side magic
 seems to originate from this project:

 http://ondras.zarovi.cz/sql/

 It looks quite fancy, especially since it all seems to be happening in
 the browser. Thanks for indirectly bringing this to our attention! ;-)

 Paul

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


web2py 1.38

2008-07-10 Thread mdipierro
web2py version 1.38 is out at http://www.web2py.com

Full stack framework for agile development of secure database driven
web based applications.
Stable. Always backward compatible. No installation required. Do
everything via the browser (or the shell).

Main New features:

- ORM has MSSQL support (SQLite, MySQL, PostgreSQL and Oracle were
already supported)
- Better Google App Engine support. The ORM now maps directly into
google API and not to GQL.
- You can install web2py appliances directly from the web
- You can run everything from browser or from shell, including
doctests
- Better JS calendar for both date and datetime fields.

web2py uses the cherrypy wsgiserver but also has handlers for Apache
and Lightptd: wsgi, fcgi, cgi.

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

Support the Python Software Foundation:
http://www.python.org/psf/donations.html


KPAX 0.1

2008-07-10 Thread mdipierro
KPAX, the human CMS form another planet is out. version 0.1.

One video says ore than many words:

http://www.vimeo.com/1098656

Includes: wikis, blogs, news, rss feeds, relay chats, web pages,
surveys, assignments, versioning, media player, music/video streaming
server, group based memberships and access control, memberships
request/approval mechanism, Centralized Access Control.

KPAX is written in Python and requires web2py. From the web2py [site]
page you can install by typing the KPAX url:
http://mdp.cti.depaul.edu/appliances/default/download/app.source.221663266939.tar

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

Support the Python Software Foundation:
http://www.python.org/psf/donations.html


Gluon 1.15 is out

2007-12-25 Thread mdipierro
Hello everybody,

Gluon 1.15 is out. This is a free open source framework for agile
development of secure database driven web applications, written in
Python, programmable in Python. Stable API and supported since October
1st 2007.

http://mdp.cti.depaul.edu
http://www.vimeo.com/428474 (video tutorial)
http://mdp.cti.depaul.edu/appliances (free plugin apps for gluon with
source)

Some features:

no installation (it is a single executable), no configuration 
files,
no shell commands, all development, deployment and 
maintenance is
done via a web interface

built-in ticketing system; if your app has a bug it is logged, the
user is notified and ticket is issued so that the administrator can
retrieve the event via the administrative interface.

Example of a COMPLETE working gluon app:

-- model: db.py 
db=SQLDB('sqlite://file.db')
db.define_table('images',SQLField('file','upload'))
-- controller: default.py -
def index():
 
   form=SQLFORM(db.images)
 
   if form.accepts(request.vars,session): response.flash='image
uploaded'
 
   return dict(form=form)
---

what does it do? 
it creates the database, creates the table (if it
does not exists) or 
alters the table (if description does not match),
creates a web page 
called index with an upload form for the image.
When the visitor 
clicks submit, the file is uploaded, renamed in a
safe way, stored in 
a file serverside, the name is stored in the
database, and the user is 
a notified. It also creates a session and
handles it via a cookie. It also writes a web based administrative
interface for the newly created database.

Merry Christmas.

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

Re: Yet another comparison of Python Web Frameworks

2007-10-09 Thread mdipierro
Since you are starting a new project you may want to look into
something new and different

http://mdp.cti.depaul.edu/examples


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