pylons

A means to access my db in python - what is my problem afterall?

I have a remote database (at the moment sqlite, but eventually mysql) that I want to be able to call from a webpage dynamically. Basically to query for data that will populate goog viz charts etc on the page (and possibly images). I have a small, slow server that i can basically run anything on. I've also located the python lib that let...

Sharing Jinja2 templates between Pylons and Django applications

I'm writing a couple of Jinja2 templates that basically implement some common grid layouts. I'd like to be able to share this 'library' of templates between a Pylons app and Django app. I've hit a minor stumbling block in that Django's template context is accessible from the "top-level" of the template, whereas Pylons wraps your conte...

in pylongs, is there a way to loop through all the controllers and actions?

in pylons, is it possible to loop through all the controllers and their actions? I want to create a javascript object that has all the controllers and their actions ...

Using Pylons validate and authenticate_form decorator

The validate and authenticate_form decorators don't seem to play nice together. This is my template: <html> <title>Test</title> <body> ${h.secure_form('/meow/do_post')} <input type="text" name="dummy"> <form:error name="dummy"><br> <input type="submit" name="doit" value="Do It"> ${h.end_form()} </body> </html> And this is the controll...

Decorators vs. classes in python web development.

I've noticed three main ways Python web frameworks deal request handing: decorators, controller classes with methods for individual requests, and request classes with methods for GET/POST. I'm curious about the virtues of these three approaches. Are there major advantages or disadvantages to any of these approaches? To fix ideas, her...

Pylons 1.0 AttributeError: 'module' object has no attribute 'metadata'

Python noob trying to learn Pylons. I'm using the QuickWiki tutorial (http://pylonshq.com/docs/en/1.0/tutorials/quickwiki_tutorial/) from the 1.0 documentation, but this alleged "1.0" doc seems to just be "0.9.7"; I suspect that this has something to do with the error I'm getting. When I execute "paster setup-app development.ini", I get...

Handle mysql restart in SQLAlchemy

My Pylons app uses local MySQL server via SQLAlchemy and python-MySQLdb. When the server is restarted, open pooled connections are apparently closed, but the application doesn't know about this and apparently when it tries to use such connection it receives "MySQL server has gone away": File '/usr/lib/pymodules/python2.6/sqlalchemy/engi...

Pylons: how to declarative with reflection model definition

Good day! I'm learning Pylons web framework to create web UI for my database. Currently I'm exploring ways to declare my model. The most sexy way seems to be declarative with reflection. Can I use it with Pylons? (Because model/init.py states that I need to define reflection related staff inside init_model) Thanks! ...

pylons file uploading - access 1st file

Currently, I'm using request.params["filename"] to access uploaded files. In Pylons, what is the syntax to access a file if you don't know the filename, something like request.files[0]? ...

Pylons: Proper Way to Establish Per-Thread/Per-Request Resource?

I have a connection to an external resource that I need to make for my Pylons app (think along the lines of a database connection.) There is a modest amount of overhead involved in establishing the connection. I could setup a piece of middleware that opens and closes the connection with every request but that seems wasteful. I'd like to...

Pylons and NodeJS / Comet

Hi all, I'm building Pylons web applications that use a lot of jQuery and AJAX/JSON to make these apps more Web 2.0'ie. I've been looking at the server push technologies and have questions about how to do this with Pylons. I've looked at Comet and NodeJS (though I don't know much about NodeJS yet) and am confused about what would be a g...

Template tags like Django with Mako and Pylons

Hi to all, For my site need some "widgets" that elaborate output from various data models, because this widgets are visible in any page is possible with mako to retrieve the data without pass (and elaborate) every time with render() in controllers? ...

What a base controller that will look for a session cookie, and if present, set the User object

I want to use a custom base controller for my wep application that has a User object as a property, and a boolean IsLoggedIn property. In the constructor of the base controller (or whatever event I need to do this in??) I want to look for a session cookie, if present, load the user and set the User object and set the IsLoggedIn property...

Disable (mako) template caching in Pylons 1.0

I recently jumped on a project using Pylons. I'm not familiar with either Python or Pylons, but I haven't had very much trouble getting the hang of things. Pylon projects seem to cache templates indefinitely by default and I can't figure out a way to clear the cached templates (stored by default in /data/templates) except by manually de...

How do I "print" something to the console in pylons?

paster serve --reload development.ini ..for debug = true THis is what I do to load a development server for Pylons. However, when I do: print "hello world" THis message doesn't print out in the console. In Django, it does. ...

Pylons Controller Tests Don't Pass Request Params

We're trying to setup controller tests for our Pylons app. I made a very simple controller and a very simple test. The tests looks like: class TestMainController(TestController): def test_index(self): response = self.app.get(url(controller='main', action='index', var1 = '1'), params={'var2':'2'}) print response.req ...

How do you debug (trace execution) of a pylons web application?

How do you debug (trace execution) of a pylons web application? (using a mac with textmate) ...

Pylons + SQLAlchemy problem: The transaction is inactive due to a rollback in a subtransaction

I have a problem with Pylons + SQLAlchemy. When something goes wrong (in my case it is integrity error, due to a race condition) and the database error is raised, all following requestы result in the error being raised: InvalidRequestError: The transaction is inactive due to a rollback in a subtransaction. Issue rollback() to cancel t...

SQLAlchemy recursive many-to-many relation

Heya! I've a case where I'm using one table to store user and group related datas. This column is called profile. So, basically this table is many-to-many table for the cases where one user is belonging in to many groups or there are many users in one group. I'm a bit confused how it should be described... Here's a simplified presenta...

Pylons TextMate Bundle

I am looking for a TextMate Bundle for Pylons development. Does anyone know of an existing bundle for Mako and/or SQLAlchemy. I found these two existing articles but the links are no longer valid If someone knows of a currently active link please let me know Thanks ...