webpy

Thread specific data with webpy

I'm writing a little web app with webpy, and I'm wondering if anyone has any information on a little problem I'm having. I've written a little ORM system, and it seems to be working pretty well. Ideally I'd like to stitch it in with webpy, but it appears that just using it as is causes thread issues (DB connection is instantiated/access...

Random name generator strategy - help me improve it

I have a small project I am doing in Python using web.py. It's a name generator, using 4 "parts" of a name (firstname, middlename, anothername, surname). Each part of the name is a collection of entites in a MySQL databse (name_part (id, part, type_id), and name_part_type (id, description)). Basic stuff, I guess. My generator picks a ra...

How do I use python for web development without relying on a framework?

I know the various frameworks have their benefits, but I personally want my web development in python to be as straight-forward as possible: less writing to the framework, more writing python. The only thing I have found so far that lets me do this in the most obvious way possible is web.py but I have slight concerns on its performance....

How do we precompile base templates in Cheetah so that #include, #extends and #import works properly in Weby

How do you serve Cheetah in production? Guys can you share the setup on how to precompile and serve cheetah in production Since we dont compile templates in webpy it is getting upstream time out errors. If you could share a good best practise it would help * Jeremy [email protected] wrote: For a production site, I use Cheet...

How do we setup Cheetah so it runs with all templates in the templates directory and all code in the .. directory

How do we setup Cheetah so it runs with all templates in the templates directory and all code in the .. directory in code.py production=True if not production: try:web.render('mafbase.tmpl', None, True, 'mafbase') except:pass else: from templates import mafbase in templates/mafbase.tmpl and templates/mafbase.py try:web.r...

What should I learn? Python or Ruby?

Possible Duplicate: Should I learn Ruby or Python? Hi guys. I am a PHP developer so, mainly a web developer, and I'm used to work with MVC. I use CakePHP, which is a powerful PHP framework to develop web apps and such. I'm comming from the web scene and I really want to keep my work on the web but I also would like to learn a n...

Using WebPy as a static HTTP content server

How is it possible to tune up WebPy to use it to serve static content for several websites? I run two websites on one IP using web.subdomain_application for name-based virtual hosting. The implied solution for hosting static content is to create a static/ directory in the directory containing HTTP server script and put all static files ...

How to use SQLite :memory: database in webpy for unittesting

I want to use a SQLite in memory (":memory:") DB for the tests in my webapp. I'm using nosetests for the tests, and webpy as framework. I want to populate the DB in the setup() function, and then run all my tests. My problem is that webpy closes all the open DB connections after each request, and the SQLite :memory: DB only lasts until ...

Can't get Beaker sessions to work (KeyError)

I'm a newb to the Python world and am having the dangest time with getting sessions to work in my web frameworks. I've tried getting Beaker sessions to work with the webpy framework and the Juno framework. And in both frameworks I always get a KeyError when I try to start the session. Here is the error message in webpy (its pretty mu...

IF statement causing internal server error with webpy

I have this class: class View(object): def main_page(self, extra_placeholders = None): file = '/media/Shared/sites/www/subdomains/pypular/static/layout.tmpl' placeholders = { 'site_name' : 'pypular' } # If we passed placeholders vars, append them if extra_placeholders != None: for k, v in extra_placehol...

Detect prematurely closed connection in web.py

Is there a way in Web.py to detect and handle connection being closed by user while the request is processing? I tried setting unloadhook handler, but it doesn't get called in this case. It's only called after the request was successfully completed: class handler: def __init__(self): pass def GET(self): try: ...

Send a file with webpy and urllib2

Hi, I need to send a file to another server using oauth and webpy. For now I'll ignore the oauth part as sending the file itself is already a challenge. Here's my partial code: class create_video: def POST(self): x = web.input(video_original={}) At this point I want to send the file over the network using urllib2. Note that I a...

Running a python script from webpy

I setup a lighttpd server along with webpy and fastcgi. I am trying to simply run a python script everytime the wenpy app is accessed. Though it seems even when I give the normal python code to execute the script it does nothing. So Id like to be able to run this script, any idea would be helpful. #!/usr/bin/env python import web, o...

how to send file via http with python

Hello, I have a problem. I use Apache with mod_wsgi and webpy, and when i send a file on http, a lot packets are lost. This is my code : web.header('Content-Type','video/x-flv') web.header('Content-length',sizeFile) f = file(FILE_PATH, 'rb') while True: buffer = f.read(4*1024) if buffer : yield buffer ...

plupload with webpy.

Hi, i have a problem. I want to upload a file with plupload with the HML5 runtime. This is my html/js code : jQuery(function(){ jQuery("#uploader").pluploadQueue({ // General settings runtimes : 'html5', name : 'file', url : 'http://server.name/addContent', max_file_size : '${maxSize}$_("...

More efficient web framework than Web.py? Extremely Pythonic please!

I love webpy, it's really quite Pythonic but I don't like having to add the url mappings and create a class, typically with just 1 function inside it. I'm interested in minimising code typing and prototyping fast. Does anyone have any up and coming suggestions such as Bobo, Nagare, Bottle, Flask, Denied, cherrypy for a lover of webpy's ...

i18n with webpy

Hello, i Have a problem with i18n, using webpy. I have followed this : http://webpy.org/cookbook/i18n_support_in_template_file So, in my .wsgi there is : #i18n gettext.install('messages',I18N_PATH,unicode=True) gettext.translation('messages',I18N_PATH,languages=['fr_FR','en_US']).install(True) So i ran : pygettext.py -a -v -d messa...

Google app engine users Auth: djangoappengine Vs Web2py Vs Webpy

I'm going to develop a small web application on Gae with a registration section, login\logout and stuff like that. Since Google app Engine does not support session out of the box and i don't want to restrict access using google Accounts, i am forced to pick a Framework that offers this kind of facilities. My choices are: Web2py Djan...

webpy: How to serve JSON

Is it possible to use webpy to serve JSON? I built my website and I need to serve some information in JSON to interact with the Javascript on some pages. I try to look for answers in the documentation, but I'm not able to find anything. Thanks, Giovanni ...

Profiling Python generators

I'm adapting an application that makes heavy use of generators to produce its results to provide a web.py web interface. So far, I could wrap the call to the for-loop and the output-producing statements in a function and call that using cProfile.run() or runctx(). Conceptually: def output(): for value in generator(): print(...