pylons

Is there any equivalent of XAMPP for Pylons?

I'd like to get started with Pylons, to be used on a Windows machine as a local web server. Is there any equivalent of e.g. XAMPP for Pylons that would set up everything with one installer? Edit: I've just discovered the Pylons web server. Could I use this to serve pages to computers on a LAN? ...

How to make Pylons work in Google App Engine?

I am new to Pylons and GAE and was wondering if any team has had success with this combination. I have followed this howto that is available on the web and have got it to work. But after I have everything working I cannot even create a controller. I have also gone through this but still no results. Also I want to able to put it in sourc...

How do I set a default page in Pylons?

I've created a new Pylons application and added a controller ("main.py") with a template ("index.mako"). Now the URL http://myserver/main/index works. How do I make this the default page, ie. the one returned when I browse to http://myserver/ ? I've already added a default route in routing.py: def make_map(): """Create, configure a...

Should we use Pylons or PHP for our webapp?

My friend and I are planning on building a sort of a forum type of webapp. We've used the major PHP frameworks but we're really thinking about using Python specifically the Pylons framework for our app. Although we're competent PHP programmers, we're somewhat noobs at Python (We could create practical scripts and such). But the thing is ...

Stream a file to the HTTP response in Pylons

I have a Pylons controller action that needs to return a file to the client. (The file is outside the web root, so I can't just link directly to it.) The simplest way is, of course, this: with open(filepath, 'rb') as f: response.write(f.read()) That works, but it's obviously inefficient for large files. What's the best way...

How to use lazy_gettext with Pylons and setup.py

Hello. Just a quick question. When I use the _() function provided by the Pylons i18n module, everything works just as expected. My problem is with the lazy version of this function, lazy_gettext. When I run : python setup.py extract_messages I get in the POT file the strings to be translated with the _() function, but not those wuth...

How to "flush" the response in Pylons (similar to ASP Response.Write)

I have a Pylons controller that is called via jQuery $.ajaxSubmit(). It executes a long-running operation and I want to have it return progress messages before the entire output is available. As a simple proof of concept I've tried this: response.body_file.write('<script>OnExecutionProgress("Starting");</script>\n') time.sleep(2) respon...

Disable browser caching in pylons

I'm have an action /json that returns json from the server. Unfortunately in IE, the browser likes to cache this json. How can I make it so that this action doesn't cache? ...

How to quickly learn Python and Ruby frameworks coming from a PHP background.

I've been using CakaPHP and Kohanaphp but now I want to try out other frameworks from a more sophisticated OOP language for my next projects. How can I learn the following frameworks quickly so I can immediately pick what to use: Pylons Sinatra Ramaze Tutorials and examples from online resources would really be great. For php deve...

Many to many relation SQLAlchemy (does relation exsist attribute)

I'm re-asking this question but with a different framework this time. I have two Models: User and Book with a M2M-relation. I want Book to have an attribute "read" that is True when the relation exists. Is this possible in SQLAlchemy? ...

Checkboxes with pylons

Hello, I have been trying to add some check boxes in a pylons mako. However I don't know how to get their values in the controller. It seems that it can only get the first value of the check boxes. I tried using form encode but i got several errors. Is there an easier way to do this? Thanks ...

How do I create self-relationships in polymorphic inheritance in Elixir and Pylons?

I am new to programming and am following the example in the Pylons documentation on creating a Wiki. The database I want to link to the wiki was created with Elixir so I rewrote the Wiki database schema and have continued from there. In the wiki there is a requirement for a Navigation table which is inherited by Pages and Sections. A s...

Rewriting An URL With Regular Expression Substitution in Routes

In my Pylons app, some content is located at URLs that look like http://mysite/data/31415. Users can go to that URL directly, or search for "31415" via the search page. My constraints, however, mean that http://mysite/data/000031415 should go to the same page as the above, as should searches for "0000000000031415." Can I strip leading...

How to get "paster request" to use config host value instead of localhost?

I'm trying to access my pylons application via cron job to send notifications to my users. The way I'm doing this is by running the application using something like: paster request myconfig.ini /maintenance/do In the actual controller I check for the "paste.command_request" to block public access. Everything works but the only problem...

Nose Tests - File Uploads

Hi Stackoverflow, How would one go about testing a Pylons controller (using Nose Tests) that takes a file upload as a POST parameter? ...

Renaming a pylons controller

Is there an automatic way I can use to rename a pylons controller? If I have to rename the controller manually which all files and filenames do I have to change. Thank you much! ...

Pylons error "No object (name: request) has been registered for this thread" with debug = false

I'm unable to access the request object in my Pylons 0.9.7 controller when I set debug = false in the .ini file. I have the following code: def run_something(self): print('!!! request = %r' % request) print('!!! request.params = %r' % request.params) yield 'Stuff' With debugging enabled this works fine and prints out: !!!...

Prevent wsgi from modifying 401 responses.

If I have the following pylons controller: def challange(self): response.status = '401 Unauthorized' return 'You are not logged in.' I would expect to see 'You are not logged in.' But I see : Unauthorized This server could not verify that you are authorized to access the document you requested. Either you supplied the...

Clear all class variables between instances

This is probably a stupid question, but what's the best way to clear class variables between instances? I know I could reset each variable individually in the constructor; but is there a way to do this in bulk? Or am I doing something totally wrong that requires a different approach? Thanks for helping ... class User(): def _...

Pylons/Routes Did url_for() change within templates?

I'm getting an error: GenerationException: url_for could not generate URL. Called with args: () {} from this line of a mako template: <p>Your url is ${h.url_for()}</p> Over in my helpers.py, I do have: from routes import url_for Looking at the Routes-1.12.1-py2.6.egg/routes/util.py, I seem to go wrong about line it calls _screen...