pylons

Pylons Toscawidgets DataGrid what data format

Hello I can't seems to work out how to fill the toscawidgets DataGrid. In my controller I have: dgfileds = [('Email Address', 'email'), ('Logon ID', 'id')] c.data = [ dict(email ='[email protected]', id='1'), dict(email ='[email protected]', id='2') ] c.grid = twf.DataGrid(fields=dgfileds) In my mako tem...

How can I access the current URI in python's mako templating system?

I'd like to submit the form to the current URI, like this: <form action="${CURRENT_URI}" method="post"> <input type="text" name="email" /> </form> from within a mako template. But I am not sure what variable holds the current uri information. Thanks. ...

Routes in Pylons: Mapping to explicit .htm file

How do I write a route to map to an explicit .htm file? E.g. I have a something.htm under /templates in Pylons and I want to map http://myserver.com/something.htm to something.htm under /templates. Can I do this with Routes for Pylons or does everything get mapped to some combination of /controller/action/id ? I would assume one way is...

Pylons and Flex 3

Hi all, Has anyone used Python/Pylons as the server backend for a Flex 3 application? Does anyone have any thoughts on how well this would work? I read Bruce Eckel's article about tying Flex 3 to Twisted, and I've done Twisted programming, but for just a web service I think Pylons is simpler to use. Thanks in advance, Doug ...

How can I view the contents of an array within controller directly for debugging?

I'm just getting started with pylons, and am trying to figure out how to view the contents of variables for debugging without rendering the template. For example: class IndexController(BaseController): def index(self): # Return a rendered template #return render('/index.mako') # or, return a response return render('/...

What are the advantages, if any, to using mako's or pylon's form handlers instead of coding the form manually?

Trying to decide if I should be using mako to handle the forms in my application or not. Thanks for the input. ...

How do I access my classes from the python console on MAC OSX?

I'm trying to access my classes via from project import * But from the python console something seems to be off with the paths. How do I set the correct paths to my project so I can import classes? My models are stored in: /Users/username/project/project/model from project import * And the error reads: ImportError: No module...

I Keep receiving an "The MetaData is not bound to an Engine or Connection." when trying to create my SQL tables with pylons

Here is my current code: def init_model(engine): global t_user t_user = sa.Table("User", meta.metadata, sa.Column("id", sa.types.Integer, primary_key=True), sa.Column("name", sa.types.String(100), nullable=False), sa.Column("first_name", sa.types.String(100), nullable=False), sa.Column("last_name", sa.types.Stri...

Error "Could not locate a bind configured on mapper" for SQLAlchemy and pylons

I'm not sure what I'm doing wrong here to warrant this message. Any help with my configuration would be appreciated. """The application's model objects""" import sqlalchemy as sa from sqlalchemy import orm from project.model import meta def now(): return datetime.datetime.now() def init_model(engine): """Call me before using...

Multiple database connections with Python + Pylons + SQLAlchemy

I'm trying to implement the proper architecture for multiple databases under Python + Pylons. I can't put everything in the config files since one of the database connections requires the connection info from a previous database connection (sharding). What's the best way to implement such an infrastructure? ...

Only connect to database when necessary

I'm using Pylons + Python and am trying to figure how how to connect to our central database server only when necessary. I created a class called Central() which I would like to instantiate whenever a connection to the central database server is necessary, e.g.: class Central(): def __init__(self): engine = engine_from_config(c...

Deploying Pylons with uWSGI

Hi all, We're trying to move our intranet to Pylons. My boss is trying to set up Pylons to use uWSGI behind Apache so he can set up multiple, independent applications. However, he's having a difficult time getting it set up, with some apparent code problems in the C source code for uWSGI. Does anyone have any suggestions for how to depl...

Pylons: Webhelpers: missing secure_form module

I installed Pylons 0.9.7 using the go-pylons.py script. I have a line of python: from webhelpers.html.secure_form import secure_form When I try to serve my application I get the error: no module secure_form. I've tried writing import webhelpers.html.tags and other modules from webhelpers and those work. I'm wondering why I don't ha...

How do I prevent duplicating code with pylons html table updated via ajax?

I have a pylons web-page with a table. I have created python functions in the template which help with the construction of the table html. One of these functions takes an 'item' and generates an html row while also adding css zebra striping. The other def generates the header row's html. This works perfectly for loading the initial ...

Disable cache in Pylons app under development mode

Hello! I'm using @beaker_cache() decorator in my Pylons application. How can I disable the cache under development mode? ...

Pylons: Routes information availability from templates

Hi all, I'm building a Pylons application using evoque as our templating engine, though I think my question is relevant to other template engines. I have a base template that I'm using for our pages, and that base template does all the includes for CSS and Javascript files. I'd like to perform conditional test to include/exclude CSS and...

Pylons: response renaming? Is there a better way?

Hi, I've got a Pylons controller with an action called serialize returning content_type=text/csv. I'd like the response of the action to be named based on the input patameter, i.e. for the following route, produced csv file should be named {id}.csv : /app/PROD/serialize => PROD.csv (so a user can open the file in Excel with a proper nam...

Converting \n to <br> in mako files

I'm using python with pylons I want to display the saved data from a textarea in a mako file with new lines formatted correctly for display Is this the best way of doing it? > ${c.info['about_me'].replace("\n", "<br />") | n} ...

How to set cookies with redirect in Pylons

In light of the cookie-handling bugs affecting Safari and Chrome (see this thread), and Pylons implementation of redirect_to as an exception, is it possible to reliably set a tracking cookie and redirect at the same time? Is the META refresh method looked down upon? ...

Error while executing "paster shell example.ini" in reddit.com

Hi there!! Friends!!! I am frustated since last five days working on implementing reddit.com on a ubuntu 9.10 machine. Yes, I know that reddit.com has been tested on ubuntu intrepid. But now i want to install it on U9.10 I have installed postgresql database, created user copied the files, and installed all the dependencies. Everythi...