pylons

Filtering by relation count in SQLAlchemy

Hi all, I'm using the SQLAlchemy Python ORM in a Pylons project. I have a class "Project" which has a one to many relationship with another class "Entry". I want to do a query in SQLAlchemy that gives me all of the projects which have one or more entries associated with them. At the moment I'm doing: [project for project in Session.que...

Pydev and Pylons inside virtual environment, auto completion won’t work.

I have Pydev installed and running without problem with Python 2.6. I installed Pylons 0.9.7 RC 4 into virtual environment, then configured new interpreter to pint into virtual environment and this one is used for pylons project. My problem is that code auto completion does not work for a classes from base library (one that are installed...

One view ( frontpage ) for many controllers (sub views)

Notes: Cannot use Javascript or iframes. In fact I can't trust the client browser to do just about anything but the ultra basics. I'm rebuilding a legacy PHP4 app as a MVC application, with most of my research currently focused with the Pylon's framework. One of the first weird issues I've run into and one I've solved in the past by us...

Miminal Linux For a Pylons Web App?

I am going to be building a Pylons-based web application. For this purpose, I'd like to build a minimal Linux platform, upon which I would then install the necessary packages such as Python and Pylons, and other necessary dependencies. The other reason to keep it minimal is because this machine will be virtual, probably over KVM, and wil...

benchmarking PHP vs Pylons

I want to benchmark PHP vs Pylons. I want my comparison of both to be as even as possible, so here is what I came up with: PHP 5.1.6 with APC, using a smarty template connecting to a MySQL database Python 2.6.1, using Pylons with a mako template connecting the the same MySQL database Is there anything that I should change in that set...

can pylons + authkit ignore particular responses with 401 status?

hey all ... i am writing a pylons app, and I am using authkit for authentication/authorization. if a user is not logged in and hits a page that requires authorization, authkit swallows the 401 (not authenticated) response and redirects to a login page. this is great for the web interface, but not great for our web services. when an una...

HTML Rich Textbox

I'm writing a web-app using Python and Pylons. I need a textbox that is rich (ie, provides the ability to bold/underline/add bullets..etc...). Does anyone know a library or widget I can use? It doesn't have to be Python/Pylons specific, as it can be a Javascript implementation as well. Thanks! ...

Elixir Event Handler

I want to use the @after_insert decorator of Elixir, but i can't access the Session within the model. Since i have autocommit set to False, i can't commit any changes in the event handler. Is there any best practice how to deal with that? The Code I used to build model, database connection etc. are mostly taken off the documentations. ...

Investigating python process to see what's eating CPU

I have a python process (Pylons webapp) that is constantly using 10-30% of CPU. I'll improve/tune logging to get some insight of what's going on, but until then, are there any tools/techniques that allow to see what python process is doing, how many and how busy threads it has etc? Update: configured access log which shows that there ...

Pylons or TurboGears vs. .NET or Java

We're embarking on a project for a client. They plan on having about 50k users by the end of the year. We're pushing to use Pylons w/ Mako and SQLAlchemy, and our contact there is excited about it, but some of his colleagues are wary because it's not .NET or J2ee (they're used to enterprisey stuff). Their web app will have some data an...

How do I return a CSV from a Pylons app?

I'm trying to return a CSV from an action in my webapp, and give the user a prompt to download the file or open it from a spreadsheet app. I can get the CSV to spit out onto the screen, but how do I change the type of the file so that the browser recognizes that this isn't supposed to be displayed as HTML? Can I use the csv module for th...

Elixir reflection

I define some Entities wich works fine; for meta programming issues, i now need to reflect the field properties defined in the model. For example: class Foo(Entity): bar = OneToMany('Bar') baz = ManyToMany('Baz') here i need the information which type of relation is set: "ManyToMany", "OneToMany" or even a plain "Field", ...

If I want to use a pylons app with Apache, should I use mod_wsgi or proxy to paste?

Or should I be using a totally different server? ...

What is a good way to handle cookies in Pylons?

I've seen a few references that say there is WSGI middleware to do it, but I don't know a lot about the choices for WSGI middelware that handles cookies. ...

Should my python web app use unicode for all strings?

I see some frameworks like Django using unicode all over the place so it seems like it might be a good idea. On the other hand, it seems like a big pain to have all these extra 'u's floating around everywhere. What will be a problem if I don't do this? Are there any issues that will come up if I do do this? I'm using Pylons right no...

How can I set a custom response header for pylons static (public) files?

How do I add a custom header to files pylons is serving from public? ...

Is there a way to flag cookies as HttpOnly in Pylons?

I can't find any documentation on the web about how to do this. I think its probably possible to send some sort of custom HTTP header response, but it seems kind of lame to do that if there is a more canonical way. ...

Why won't pylons close the connection if a subprocess is running?

If I try to spawn a process from a pylons controller, the server does not close the connection after sending the reply. Assume that test.py is a long running process, then this method in a pylons controller creates a response, but keeps the connection open: def index(self): from subprocess import Popen Popen(["python", "/temp/t...

Is it possible to launch a Paster shell with some modules pre-imported?

Is it possible to run "paster shell blah.ini" (or a variant thereof) and have it automatically load certain libraries? I hate having to always type "from foo.bar import mystuff" as the first command in every paster shell, and would like the computer to do it for me. ...

Pylons FormEncode with an array of form elements

I have a Pylons app and am using FormEncode and HtmlFill to handle my forms. I have an array of text fields in my template (Mako) <tr> <td>Yardage</td> <td>${h.text('yardage[]', maxlength=3, size=3)}</td> <td>${h.text('yardage[]', maxlength=3, size=3)}</td> <td>${h.text('yardage[]', maxlength=3, size=3)}</td> <td>...