Pylons + Google App Engine

2008-04-09 Thread Alagu Madhu

Hi

How to get started with Pylons and Google App Engine ?


Thanks

Madhu Alagu
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Pylons + Google App Engine

2008-04-09 Thread Jamie Wilkinson

This one time, at band camp, Alagu Madhu wrote:

Hi

How to get started with Pylons and Google App Engine ?

Follow the appengine tutorial, and then apply your pylons knowledge to it.
it's WSGI so bootstrapping your application into it should be pretty easy.
The hard part will be porting your database to the data store model.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Pylons + Google App Engine

2008-04-09 Thread Mike Orr

On Wed, Apr 9, 2008 at 4:25 AM, Jamie Wilkinson [EMAIL PROTECTED] wrote:

  This one time, at band camp, Alagu Madhu wrote:
  
  Hi
  
  How to get started with Pylons and Google App Engine ?

  Follow the appengine tutorial, and then apply your pylons knowledge to it.
  it's WSGI so bootstrapping your application into it should be pretty easy.
  The hard part will be porting your database to the data store model.

According to IRC yesterday, appengine doesn't allow C modules, so that
takes out Mako, SQLAlchemy, and parts of Paste and Setuptools.  So it
will take a while to get any non-trivial Pylons app running on it.

http://pylonshq.com/irclogs/%23pylons/


-- 
Mike Orr [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Pylons + Google App Engine

2008-04-09 Thread Lawrence Oluyede

On Wed, Apr 9, 2008 at 5:08 PM, Mike Orr [EMAIL PROTECTED] wrote:
  According to IRC yesterday, appengine doesn't allow C modules, so that
  takes out Mako, SQLAlchemy, and parts of Paste and Setuptools.  So it
  will take a while to get any non-trivial Pylons app running on it.

  http://pylonshq.com/irclogs/%23pylons/


Let's be rational about this. I haven't tried app engine yet altough I
have an account (plan to do it this weekend)
but I'm reading a lot of stuff about it.

My bigger concern (putting aside the terms of service for a moment)
is: what's the point in porting existing libraries/frameworks and so
on
to make them work in the google infrastructure?

Maybe I am short sighted but I guess it is too much work having two
different versions of the framework just for Google.

They chose the language and ported Django, let's try the system for a
while before diving in the realm of forking just for the sake of it.
There's also something else which bothers me, which is explained in
the following use case:

1 - you have an application written in XYZ (Pylons in this case)
2 - it makes use of 10 to 15 libraries (third parties or standard) not supported

-or-

1 - you decide to write it from scratch
2 - you need something not supported

3 - you port the code
4 - you try to maintain the fork following the main version

5 - one day in the future you want to get out from the Google cloud.

Now you have two set of incompatibles stuff and you cannot get out
unless rewriting the same stuff you ported and adapting the code
from the old version.

I guess AppEngine is great, and Alex Martelli will speak about it at
PyCon Italy, but I'm not really sure will be for every and each type
of web app.

-- 
Lawrence, stacktrace.it - oluyede.org - neropercaso.it
It is difficult to get a man to understand
something when his salary depends on not
understanding it - Upton Sinclair

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Pylons + Google App Engine

2008-04-09 Thread Bob Ippolito

On Wed, Apr 9, 2008 at 8:50 AM, Mike Orr [EMAIL PROTECTED] wrote:

  On Wed, Apr 9, 2008 at 8:27 AM, Lawrence Oluyede [EMAIL PROTECTED] wrote:
  
On Wed, Apr 9, 2008 at 5:08 PM, Mike Orr [EMAIL PROTECTED] wrote:
  According to IRC yesterday, appengine doesn't allow C modules, so that
  takes out Mako, SQLAlchemy, and parts of Paste and Setuptools.  So it
  will take a while to get any non-trivial Pylons app running on it.

  http://pylonshq.com/irclogs/%23pylons/
  
  
Let's be rational about this. I haven't tried app engine yet altough I
have an account (plan to do it this weekend)
but I'm reading a lot of stuff about it.
  
My bigger concern (putting aside the terms of service for a moment)
is: what's the point in porting existing libraries/frameworks and so
on
to make them work in the google infrastructure?
  
Maybe I am short sighted but I guess it is too much work having two
different versions of the framework just for Google.

  You're discounting the fun effect: people want to see if they can
  accomplish it.  There is no fork of Pylons/Mako/Paste.  Merely
  people exploring the incompatibilities to see if the same package can
  be made compatible for both environments.  Or conversely, to go to
  Google (or our man in Google, Guido), and say this restriction is
  really unworkable for us for X, Y, and Z reasons.  Because if it's
  unworkable for us, it's unworkable for other Python frameworks and
  packages that a lot of people making websites want/need to use, which
  excludes Google from hosting said apps.  Since they want apps on their
  servers, and they're Python fans just like us, they may be interested
  in doing something about it.  Anyway, pkg_resources incompatibility
  will give them a bigger headache in the long run than it gives us.

  The problem with C libraries is a lot bigger than just Google.  It
  frustrates users on Windows and Macintosh to no end, and many of them
  give up trying to install Pylons/lxml/ToscaWidgets/wxPython and go on
  to something else.  Precompiled binaries don't always exist, are too
  old, hard to find, or built with the wrong C compiler or Unicode
  width.

  That's why we didn't use lxml in the WebHelpers upgrade.  We looked
  and finally found a pure Python module that did what we need.  But
  appengine has shown us there's a few other C dependencies to be worked
  around if possible (without killing the performance).  Because these
  same problems presumably come up when porting Pylons to Jython,
  IronPython, PyPy, etc.  And if Django can do it and Pylons can't... :(


You can always take the approach where C modules are used if
available, otherwise pure Python code can be used. simplejson does
this, for example.

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Pylons + Google App Engine

2008-04-09 Thread Ian Bicking

Alagu Madhu wrote:
 Hi
 
 How to get started with Pylons and Google App Engine ?

Reports of the framework neutrality of Google App Engine are much 
exaggerated.  At this point running Pylons is not feasible.

I'm very excited about App Engine, and trying to get things working, but 
it's going to take a while and for a while it won't be a satisfying 
experience for anyone who doesn't already have a lot of experience with 
Pylons, Paste, setuptools, and some other parts of the typical stack 
that are currently tricky on App Engine.  Actually it won't be 
satisfying for anyone ;) -- but if you have experience, you can have a 
constructively unsatisfying experience.

   Ian

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Pylons + Google App Engine

2008-04-09 Thread Ben Bangert

On Apr 9, 2008, at 8:27 AM, Lawrence Oluyede wrote:


Let's be rational about this. I haven't tried app engine yet altough I
have an account (plan to do it this weekend)
but I'm reading a lot of stuff about it.


You're definitely not alone in your concerns about this. Note both of  
these well written blog articles:

http://www.b-list.org/weblog/2008/apr/08/batteries-sold-separately/

And the very nice sum-up of how annoying (or even crippling) such lock- 
in can be:

http://www.joyeur.com/2008/04/08/let-my-people-have-root

Maybe I'm a bit paranoid, but portability is always key to me. I want  
to be able to pack up and move if a hosting provider has a Terms of  
Service change that I don't agree with, or maybe becomes more  
expensive for my needs than I can get elsewhere.


That said, if we can make Pylons run there with only minor tweaks to  
some libraries involved that does not result in a fork, I see no harm  
in making Pylons an option on Google App Engine. So far, the thought  
seems to be that most of Pylons can be made to work fairly easily  
(mainly by small patches to setuptools, and Paste). Beaker will also  
need a few small tweaks so that it can use DataStore as an optional  
backend (like how it optionally can use a db).


That's certainly not a fork, though of course, some libraries would  
require such hefty changes. I'm not sure how much tweaking Mako or  
Genshi will need to function under AppEngine for example, but it  
didn't sound trivial. So, no forking just for Google, but some  
tweaks that don't affect performance, efficiency, etc. to Pylons or  
libraries it needs... I see no harm in.


Cheers,
Ben

smime.p7s
Description: S/MIME cryptographic signature


Re: Pylons + Google App Engine

2008-04-09 Thread Lawrence Oluyede

On Wed, Apr 9, 2008 at 5:50 PM, Mike Orr [EMAIL PROTECTED] wrote:
  You're discounting the fun effect: people want to see if they can
  accomplish it.  There is no fork of Pylons/Mako/Paste.  Merely
  people exploring the incompatibilities to see if the same package can
  be made compatible for both environments.

Yes, exactly. I left out the fun effect because it would not be
rational anymore :-)
I agee with you for the most part but:

  The problem with C libraries is a lot bigger than just Google.  It
  frustrates users on Windows and Macintosh to no end, and many of them
  give up trying to install Pylons/lxml/ToscaWidgets/wxPython and go on
  to something else.  Precompiled binaries don't always exist, are too
  old, hard to find, or built with the wrong C compiler or Unicode
  width.

This is, in my ideal world, a Windows problem, not a Python one. For
the record: I use Linux and MacOSX day by day and never had issues
with C libraries. I already know Windows is an entire different
matter. For this and a lot of other reasons I don't use Windows at
all, unless to test HTML pages with IE 6/7.

BTW even if the developer likes Windows as his platform most of the
deployment in the Python world is done on unix machine, at least in my
side of the universe. I am not sure someone will go with (for example)
(Django|Pylons|TG) + Apache2 + PostgreSQL on a Windows box as the
server.

In my opinion the problem of the C libraries is not as big as it
seems. Just don't use Windows to develop, use it at home if you like
it to surf, listen to music, play games :D

  That's why we didn't use lxml in the WebHelpers upgrade.  We looked
  and finally found a pure Python module that did what we need.

I know and I don't blame you as developers of an entire framework.
Losing compatibility with the most widespread platform is a shame but
AFAIK there are lxml binaries, see:
http://pypi.python.org/pypi/lxml/2.0.3

-- 
Lawrence, stacktrace.it - oluyede.org - neropercaso.it
It is difficult to get a man to understand
something when his salary depends on not
understanding it - Upton Sinclair

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Pylons + Google App Engine

2008-04-09 Thread Lawrence Oluyede

On Wed, Apr 9, 2008 at 6:43 PM, Bob Ippolito [EMAIL PROTECTED] wrote:
 You can always take the approach where C modules are used if
  available, otherwise pure Python code can be used. simplejson does
  this, for example.

Yes and it's maybe the way to go but requires careful coding at import
time, something not everyone does.
My complain was about the overall limitations, I know that we (as the
Python community) will work around them in due time.
As we will cope with the Python 3.0 migration, which I like

-- 
Lawrence, stacktrace.it - oluyede.org - neropercaso.it
It is difficult to get a man to understand
something when his salary depends on not
understanding it - Upton Sinclair

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Pylons + Google App Engine

2008-04-09 Thread Justin Driscoll
Have you ever compiled PIL on OS X? It's kind of a PITA. On Windows it's a
simple install exe. I've had more problems on my Mac with C libs than on my
Windows box/server at work. For Linux a lot of it depends on your
distribution. Calling it a Windows problem is just wrong.

- Justin

On Wed, Apr 9, 2008 at 2:05 PM, Lawrence Oluyede [EMAIL PROTECTED]
wrote:


 On Wed, Apr 9, 2008 at 5:50 PM, Mike Orr [EMAIL PROTECTED] wrote:
   You're discounting the fun effect: people want to see if they can
   accomplish it.  There is no fork of Pylons/Mako/Paste.  Merely
   people exploring the incompatibilities to see if the same package can
   be made compatible for both environments.

 Yes, exactly. I left out the fun effect because it would not be
 rational anymore :-)
 I agee with you for the most part but:

   The problem with C libraries is a lot bigger than just Google.  It
   frustrates users on Windows and Macintosh to no end, and many of them
   give up trying to install Pylons/lxml/ToscaWidgets/wxPython and go on
   to something else.  Precompiled binaries don't always exist, are too
   old, hard to find, or built with the wrong C compiler or Unicode
   width.

 This is, in my ideal world, a Windows problem, not a Python one. For
 the record: I use Linux and MacOSX day by day and never had issues
 with C libraries. I already know Windows is an entire different
 matter. For this and a lot of other reasons I don't use Windows at
 all, unless to test HTML pages with IE 6/7.

 BTW even if the developer likes Windows as his platform most of the
 deployment in the Python world is done on unix machine, at least in my
 side of the universe. I am not sure someone will go with (for example)
 (Django|Pylons|TG) + Apache2 + PostgreSQL on a Windows box as the
 server.

 In my opinion the problem of the C libraries is not as big as it
 seems. Just don't use Windows to develop, use it at home if you like
 it to surf, listen to music, play games :D

   That's why we didn't use lxml in the WebHelpers upgrade.  We looked
   and finally found a pure Python module that did what we need.

 I know and I don't blame you as developers of an entire framework.
 Losing compatibility with the most widespread platform is a shame but
 AFAIK there are lxml binaries, see:
 http://pypi.python.org/pypi/lxml/2.0.3

 --
 Lawrence, stacktrace.it - oluyede.org - neropercaso.it
 It is difficult to get a man to understand
 something when his salary depends on not
 understanding it - Upton Sinclair

 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: retrieving host and port from within application

2008-04-09 Thread Ian Bicking

Moshe C. wrote:
 How can I retrieve the host and port (defined in the server:main
 section of the ini file) from within the application code?

request.environ['HTTP_HOST'].  SERVER_NAME and SERVER_PORT also give the 
same(ish) info -- generally HTTP_HOST is the what the client saw, and 
SERVER_NAME/SERVER_PORT is what the server is actually connected to.

   Ian

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Pylons + Google App Engine

2008-04-09 Thread Cliff Wells


On Wed, 2008-04-09 at 08:50 -0700, Mike Orr wrote:

 The problem with C libraries is a lot bigger than just Google.  It
 frustrates users on Windows and Macintosh to no end, and many of them
 give up trying to install Pylons/lxml/ToscaWidgets/wxPython and go on
 to something else.  Precompiled binaries don't always exist, are too
 old, hard to find, or built with the wrong C compiler or Unicode
 width.
 

I think this is less true that it used to be.  Microsoft now makes a
free version of Visual Studio available which is sufficient to compile
Python extensions on Windows:

http://www.microsoft.com/express/download/

I've only used it once, several months ago, but it seemed to work fine.
I think issues people might have with this will be documentation issues.

As far as Mac, I don't think C extensions are much of an issue (unless
you include OS9).

Obviously C extensions that aren't written in a portable way are going
to be a problem, but that's *their* problem.

Regards,
Cliff


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Pylons + Google App Engine

2008-04-09 Thread Justin Driscoll
Compiling PIL with all it's dependencies on OS X WITHOUT MacPorts or Fink is
a PITA. I myself am lazy and just use MacPorts as well :). However, even
with projects like MacPorts you're reliant on the project keeping updated
ports of all the C libraries you need. These libraries can add a lot of
value and power to Python but as Python grows beyond the standard C-Python
implementation more and more, being portable will carry increased value. If
you can keep your performance and do it in pure-python or even just support
a alternate pure-python implementation that's a win-win.

- Justin

On Wed, Apr 9, 2008 at 2:36 PM, Lawrence Oluyede [EMAIL PROTECTED]
wrote:


 On Wed, Apr 9, 2008 at 8:12 PM, Justin Driscoll
 [EMAIL PROTECTED] wrote:
  Have you ever compiled PIL on OS X? It's kind of a PITA. On Windows it's
 a
  simple install exe. I've had more problems on my Mac with C libs than on
 my
  Windows box/server at work. For Linux a lot of it depends on your
  distribution. Calling it a Windows problem is just wrong.

 Yes I did, and it worked just fine. Maybe it is because I'm used to
 use MacPorts for almost everything.
 I can only speak about my experience, not others.

 --
 Lawrence, stacktrace.it - oluyede.org - neropercaso.it
 It is difficult to get a man to understand
 something when his salary depends on not
 understanding it - Upton Sinclair

 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Pylons + Google App Engine

2008-04-09 Thread Lawrence Oluyede

On Wed, Apr 9, 2008 at 8:12 PM, Justin Driscoll
[EMAIL PROTECTED] wrote:
 Have you ever compiled PIL on OS X? It's kind of a PITA. On Windows it's a
 simple install exe. I've had more problems on my Mac with C libs than on my
 Windows box/server at work. For Linux a lot of it depends on your
 distribution. Calling it a Windows problem is just wrong.

Yes I did, and it worked just fine. Maybe it is because I'm used to
use MacPorts for almost everything.
I can only speak about my experience, not others.

-- 
Lawrence, stacktrace.it - oluyede.org - neropercaso.it
It is difficult to get a man to understand
something when his salary depends on not
understanding it - Upton Sinclair

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Paginate module

2008-04-09 Thread blaf

Is it possible to get only the target dataset (like records 20 to 30)?
It can be very memory consuming?

There is any example out there about paginator+sqlalchemy?

Blaise

On Mar 13, 10:30 am, Mike Orr [EMAIL PROTECTED] wrote:
 I have an example of Paginator + SQLAlchemy at work, but I'm at PyCon
 now so I can't access it.  But the gist is, you get a SQLAlchemy query
 object covering the entire dataset (all pages), and instantiate the
 paginator with it. There's another argument to set the number of
 records per page.

 Then in your template, you iterate the paginator to get the records to
 display.  You put the navigator on the top and/or bottom of the page
 as you wish.  I don't have the sytax with me but it's clear from the
 source.

 --
 Mike Orr [EMAIL PROTECTED]
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Pylons + Google App Engine

2008-04-09 Thread Mike Orr

On Wed, Apr 9, 2008 at 11:08 AM, Lawrence Oluyede [EMAIL PROTECTED] wrote:

  On Wed, Apr 9, 2008 at 6:43 PM, Bob Ippolito [EMAIL PROTECTED] wrote:
   You can always take the approach where C modules are used if
available, otherwise pure Python code can be used. simplejson does
this, for example.

  Yes and it's maybe the way to go but requires careful coding at import
  time, something not everyone does.

It requires careful coding by the package developer, which may not
have been done.  So the user knows that some module has a Python
fallback, but easy_install doesn't, and the user doesn't know how to
coax easy_install into bypassing the C module, or how to configure it
manually.

That happened a couple weeks ago when Pylons-dev changed its
dependency to the new version of simplejson.  It wouldn't install on
Windows, and the only binary eggs were for the older version.  After I
said, Does Pylons really need the newest version?, we downgraded the
dependency to allow the older version.  Since Pylons doesn't use
simplejson for anything except optional features anyway (@json).

-- 
Mike Orr [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Pylons + Google App Engine

2008-04-09 Thread Ian Bicking

Mike Orr wrote:
 On Wed, Apr 9, 2008 at 11:08 AM, Lawrence Oluyede [EMAIL PROTECTED] wrote:
  On Wed, Apr 9, 2008 at 6:43 PM, Bob Ippolito [EMAIL PROTECTED] wrote:
   You can always take the approach where C modules are used if
available, otherwise pure Python code can be used. simplejson does
this, for example.

  Yes and it's maybe the way to go but requires careful coding at import
  time, something not everyone does.
 
 It requires careful coding by the package developer, which may not
 have been done.  So the user knows that some module has a Python
 fallback, but easy_install doesn't, and the user doesn't know how to
 coax easy_install into bypassing the C module, or how to configure it
 manually.

With App Engine, the likely case is that you install the module (which 
typically includes the C extension directly), then upload it, and (I 
*think*) in the App Engine environment the C extension just won't be 
importable, and so the library should fall back to the Python 
implementation.  This is how simplejson should work.  But I haven't 
tried it, and it's hard to know until then.  It's possible, for 
instance, that importing the C extension will not raise an ImportError 
(maybe instead OSError), and that would mess things up.

   Ian

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Pylons + Google App Engine

2008-04-09 Thread Mike Orr

On Wed, Apr 9, 2008 at 11:24 AM, Cliff Wells [EMAIL PROTECTED] wrote:


  On Wed, 2008-04-09 at 08:50 -0700, Mike Orr wrote:

   The problem with C libraries is a lot bigger than just Google.  It
   frustrates users on Windows and Macintosh to no end, and many of them
   give up trying to install Pylons/lxml/ToscaWidgets/wxPython and go on
   to something else.  Precompiled binaries don't always exist, are too
   old, hard to find, or built with the wrong C compiler or Unicode
   width.
  

  I think this is less true that it used to be.  Microsoft now makes a
  free version of Visual Studio available which is sufficient to compile
  Python extensions on Windows:

  http://www.microsoft.com/express/download/

But is every Pylons user willing to/smart enough to/allowed to install
and run the compiler?  More to the point, it's pretty far from what
they wanted to do in the first place, which is to write a web
application.If Pylons doesn't do it conveniently, they'll go to
something else.  Arguing whether it's Microsoft's fault or not doesn't
change the situation.  One can say we don't care about those users,
but I don't think Pylons wants to do that.

-- 
Mike Orr [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Paginate module

2008-04-09 Thread blaf

Just found how... I think... pretty impressive this module...

page_nr = request.params.get('page_nr', 1)
q = request.params.get('q')
rs = Session.query(Search).filter(Search.q.like('%'+q
+'%')).order_by('q asc')
c.page = h.Page(rs, count=rs.count(), page_nr=page_nr,
items_per_page=25, q=q)

Would be nice if we can change the «page_nr» param

Blaise
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Paginate module

2008-04-09 Thread Mike Orr

On Wed, Apr 9, 2008 at 12:05 PM, blaf [EMAIL PROTECTED] wrote:

  Is it possible to get only the target dataset (like records 20 to 30)?
  It can be very memory consuming?

That's what it does.  You instantiate Page with the Query object.  In
the template you iterate the Page, which downloads only the records
needed for the current page.

  There is any example out there about paginator+sqlalchemy?

Here's a stripped-down version of what I'm using in my app.  I have a
slightly older version of Paginate so you may find an argument renamed
here or there.

=== CONTROLLER ===
from webhelpers.paginate import Page

q = Session.query(MySQLAlchemyClass).filter( ... whatever
...).sort_by([my_table.c.something])
page = 1
records_per_page = 20
c.records = Page(q, page, records_per_page)
return render(/my_template.html)

=== TEMPLATE ===
!-- Navigation bar --
div${c.records.pager()}/div

!-- Data table --
table
  tr
  thName/th
  /tr
% for r in c.records:
  tr
  td${r.name | h}/td
  /tr
% endfor   r
/table


You can pass a formatter to make a different kind of navigation bar.
Here's a Mako function I use to make all paged tables have the same
navigation UI.  I'm not using the Ajax feature (which has changed
since anyway), so i'm not sure if it works as-is.

##  PAGED REGION ***
%def name=paged(page, whats, id='dynamic', ajax=False, **pager_kw)
%
Put a paged section on a webpage, with links to the other pages.

   page:A Page object from Christoph Haas' 'paginate' package.
   whats:   A plural word that best describes the elements in the page.
   id:  The id of the surrounding div that will be generated.
If multiple paged regions appear in the same webpage, they
should have unique IDs.
   ajax:True to enable Ajax mode.  The pager method will be called
as page.pager(..., ajax_id=id, partial=id, ...)
   **pager_kw:  Additional keyword args to pass to page.pager.  Include
all query parameters that generated the original page!

   Your controller action should look for the 'partial' query parameter.
   If present, return the paged region indicated by its value rather than
   the entire HTML page.

%
% if page.item_count == 0:
p class=instructionsNo ${whats} found./p
% else:
%
format = \
Page: ~3~
span style=padding: 0 30px
%(link_first)s
%(link_previous)s
%(link_next)s
%(link_last)s
/span
if ajax_id:
pager_kw[ajax_id] = id
pager_kw[partial] = id
pager = page.pager(format, link_var=page, **pager_kw)
%
div id=${id}
% if page.first_item is None:
p class=instructionsNo ${whats} on this page./p
% else:
div class=instructions
Displaying ${whats} b${page.first_item + 1}/b
to b${page.last_item + 1}/b of b${page.item_count}/b.
/div
div${pager}/div
div style=margin: 1em 0
${caller.body()}
/div
div${pager}/div
% endif page.items
/div
% endif   page.item_count
/%def



You call it with the extended call syntax  where the caller provides
the content of the page.  sort here is a query parameter that
specifies the order of the records; it will be propagated to every URL
generated by pager.

%call expr=paged(c.records, records, sort=c.sort)
table
tr ... headers ... /tr
% for r in c.records:
tr
td${r.name | h}/td
/tr
% endfor   r
/%call

-- 
Mike Orr [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Paginate module

2008-04-09 Thread blaf

Thanks Mike... you got a more complete one =)

The more I use Pylons the more I'm impressed by all the
contributions... juste started using your Flash webhelper today...
Thanks.

On Apr 9, 3:58 pm, Mike Orr [EMAIL PROTECTED] wrote:

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Pylons + Google App Engine

2008-04-09 Thread Jonathan Share

Lawrence Oluyede wrote:
 
 This is, in my ideal world, a Windows problem, not a Python one. For
 the record: I use Linux and MacOSX day by day and never had issues
 with C libraries. I already know Windows is an entire different
 matter. For this and a lot of other reasons I don't use Windows at
 all, unless to test HTML pages with IE 6/7.

Not perfect but perhaps

http://www.kronenberg.org/ies4osx/

or

http://www.tatanka.com.br/ies4linux/page/Main_Page

can help you avoid switching to windows at all then ;-)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Pylons + Google App Engine

2008-04-09 Thread Jonathan Share

Mike Orr wrote:
 On Wed, Apr 9, 2008 at 4:25 AM, Jamie Wilkinson [EMAIL PROTECTED] wrote:
  This one time, at band camp, Alagu Madhu wrote:
  
  Hi
  
  How to get started with Pylons and Google App Engine ?

  Follow the appengine tutorial, and then apply your pylons knowledge to it.
  it's WSGI so bootstrapping your application into it should be pretty easy.
  The hard part will be porting your database to the data store model.
 
 According to IRC yesterday, appengine doesn't allow C modules, so that
 takes out Mako, SQLAlchemy, and parts of Paste and Setuptools.  So it
 will take a while to get any non-trivial Pylons app running on it.
 
 http://pylonshq.com/irclogs/%23pylons/
 
 

Mako can be easily switched for another templating language that does 
not require native code. I believe genshi fits this, if not you can of 
course use the django templating language, this works fine.

SQLAlchemy is a non issue as the intention is that you use Google's ORM 
interface (looks like it's based on the Django ORM, and I'm sure I read 
somewhere the data ends up in a BigTable instance). Paste is replaced by 
google's dev_appserver.py and setup tools is almost replaced by appcfg.py.

As long as you are happy to buy in to Django/Google's api's there's no 
problem here. Using Pylons routing/controllers + Genshi/django templates 
+ Google's ORM shouldn't be a problem at all. You don't have all the 
choice in the world, but hey, the service is currently free, what do you 
expect?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Pylons + Google App Engine

2008-04-09 Thread Philip Jenvey


On Apr 9, 2008, at 9:43 AM, Bob Ippolito wrote:

 You can always take the approach where C modules are used if
 available, otherwise pure Python code can be used. simplejson does
 this, for example.

Unfortunately it's not just C extensions that are the problem on app  
engine, it's actually Python builtin modules written in C.

E.g. the problem with Mako and Genshi on app engine is that they need  
the builtin parser module to parse python code to AST. Rumor has it  
some C modules, like parser, are restricted due to security concerns  
-- like they would need to audit the parser module's rather hairy C  
code to ensure it's not violating their restricted Python sandboxing  
(though I'm not sure about this).

I'm getting the impression that the guys behind google app engine are  
very Django centric, and might not be that aware of how important  
Mako and Genshi are outside of Django (I think they're very important  
for Django too, not every Django app uses Django templates).

I'd encourage everyone to help make them aware of how important it is  
to get the pieces of our stack working: one way is by voting  
('starring', click on the star) the related issues logged on their  
ticket tracker:

The Mako templating doesn't work:
http://code.google.com/p/googleappengine/issues/detail?id=9

Incompatible with pkg_resources
http://code.google.com/p/googleappengine/issues/detail?id=60

Expand Python framework support to Zope3, Turbogears, and Pylons
http://code.google.com/p/googleappengine/issues/detail?id=33

--
Philip Jenvey



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Paginate module

2008-04-09 Thread Mike Orr

On Wed, Apr 9, 2008 at 1:04 PM, blaf [EMAIL PROTECTED] wrote:

  Thanks Mike... you got a more complete one =)

  The more I use Pylons the more I'm impressed by all the
  contributions... juste started using your Flash webhelper today...

The new helpers haven't gotten much testing, so please give me or Ben
feedback on how well they work.  Also let us know about anything you
don't understand, because that's a hole in the documentation.  The new
helpers are:

webhelpers.date
webhelpers.html
webhelpers.paginate
webhelpers.tags
webhelpers.text
webhelpers.tools

(These all refer to the WebHelpers development version, or future 0.6.)

-- 
Mike Orr [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Secure Cookies

2008-04-09 Thread Dennis Muhlestein

I've seen some conversation about securing sessions with SSL.  I need
to do that for an application I'm working on.  Thus far, I'm pretty
happy using sessions provided by beaker.  What If I want the cookie to
be marked secure?  Is there a way to configure that?  I didn't find
any documentation on the subject.  It would be nice to simply set
something like this:

beaker.session.secure_cookie=True

-Dennis
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Paginate module

2008-04-09 Thread Mike Orr

On Wed, Apr 9, 2008 at 2:57 PM, blaf [EMAIL PROTECTED] wrote:

  Haven't tried everything but had problem having the Flash message
  appears on the next page... A session.save() in the __call__()
  function fixed it.

D'oh, stupid me!  I've pushed an update.

Which comes back to my question yesterday, is it inefficient to call
session.save() several times in an action?  If so, it's difficult to
have utility methods or library classes that modify the session.

  I found that form tags have changed comparing to current examples...
  I'm learning while I progress on my project and try to figure out how
  to do things the pylon way.

I'm planning to fill out the docstrings in the next few days.  Yes,
the APIs have been changed, hopefully improved.  But we've stuck close
to the original API unless there was a reason for changing.

-- 
Mike Orr [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Paginate module

2008-04-09 Thread blaf

On Apr 9, 7:00 pm, Mike Orr [EMAIL PROTECTED] wrote:

 D'oh, stupid me!  I've pushed an update.

Thanks

 Which comes back to my question yesterday, is it inefficient to call
 session.save() several times in an action?  If so, it's difficult to
 have utility methods or library classes that modify the session.

Like something that looks if the session have changed and do a save?
Or have a save in __after__ base controller, but seems a bit
inefficient on each request?

 I'm planning to fill out the docstrings in the next few days.  Yes,
 the APIs have been changed, hopefully improved.  But we've stuck close
 to the original API unless there was a reason for changing.

Sounds good to me.

Blaise
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Paginate module

2008-04-09 Thread blaf

Latest paginate gives me lt;lt; and gt;gt; in the pager links
instead of  
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---