pylons

Best Practices for Python UnicodeDecodeError

I use Pylons framework, Mako template for a web based application. I wasn't really bother too deep into the way python handles the unicode strings. I had tense moment when I did see my site crash when the page is rendered and later I came to know that it was related to Unicode Decode error http://wiki.python.org/moin/UnicodeDecodeError ...

Pylons, cookies not being destroyed

I am trying to remove a cookie called "session" to logout a user. request.cookies.pop('session', None) response.set_cookie('session', '', max_age=-100, domain='.example.org') response.set_cookie('session', '', max_age=-100, domain='www.example.org') response.delete_cookie('session', '', domain='.example.org') response.delete_cookie('ses...

MySQL server has gone away error with Pylons, SQLAlchemy, Apache

sorry if this is addressed, but i'm running apache2 SQLAlchemy 0.5.8 Pylons 1.0 Python 2.5.2 and on a simple page (just retrieve data from DB), I get: Error - : (OperationalError) (2006, 'MySQL server has gone away') every few other requests, not after a long time as other posts I've searched for. I still added sqlalchemy....

UnicodeEncodeError: 'latin-1' codec can't encode character

What could be causing this error when I try to insert a foreign character into the database? >>UnicodeEncodeError: 'latin-1' codec can't encode character u'\u201c' in position 0: ordinal not in range(256) And how do I resolve it? Thanks! ...

Where is the best place to associate a 'form display text' with SQLAlchemy mapped property?

In django orm I can use the 'verbose_name' kwarg to set a label that will be displayed in model forms. Now I'm dynamically generating WTForms for each model in a SQLAlchemy mapped backend, but I'm not sure where to associate a display text to use in the auto generated fields for each form. For example, in django I could do this: class U...

Pylons + mod_wsgi -> ImportError: No module named paste.deploy

I'm following the example here: http://code.google.com/p/modwsgi/wiki/IntegrationWithPylons however, it doesn't work - I get "ImportError: No module named paste.deploy" in the apache error log. Googling in this case helps not - I see some stuff about permissions, but all my permissions are fine. Where does paste.deploy really come from?...

passenger_wsgi.py on dreamhost to get pylons working

This is what I found that in theory should work from git hub.com passenger-pylons-wsgi-example import os, sys sys.path.append('/home/user/test.sample.com/Helloworld') os.environ['PYTHON_EGG_CACHE'] = '/home/user/tmp' from paste.deploy import loadapp ...

Routing POST and GET Requests: Controller or Dispatcher?

When you're making a web app, you frequently need different things to happen at a given URL for HTTP POST requests than happen for HTTP GET requests. I am making a web app in Pylons, and I'm encountering this question. Is it better to distinguish between POST and GET in my URL dispatcher (Routes) or in my controllers? What factors wou...

Show pdf only to authentificated users

Hello, I'm building a web site from the old one and i need to show a lot of .pdf files. I need users to get authenficated before the can't see any of my .pdf but i don't know how (and i can't put my pdf in my database). I'm using Pylons with Python. Thank for you help. If you have any question, ask me! :) ...

Has anyone succeeded in using celery with pylons

Hi, I have a pylons based webapp and i'd love to use celery + rabbitmq for some time taking tasks. I've taken a look at the celery-pylons project but I haven't succeeded in using it. My main problem with celery is: where do i put the celeryconfig.py file or is there any other way to specify the celery options eg. BROKER_HOST and the lik...

Pylons: accidentally typed 'setup.py install', how can I fix?

While working on a Pylons app, I accidentally typed python setup.py install in the home directory of a project, instead of what I meant to type, namely python setup.py egg_info Oops. It looks like the Pylons app has now been installed as a Python package. Whenever I make changes to the project, they don't get propagated unless I r...

How come when I use the tComment VIM plugin in a .ini file it adds/removes semi-colons instead of hashes as comment?

I am using gVIM and the tComment plug-in during editing the development.ini file in a Pylons/Python project. The default development.ini file has lines commented out using the hash # symbol which is the standard method of commenting out lines in Python. However, when I try to uncomment lines by using a tComment keyboard shortcut in gVIM,...

Proper location to set up MySQLdb connection in Pylons: app_globals? Thread safety?

I want to use MySQLdb in Pylons, but can't figure out where to actually connect. It would seem that making the connection in app_globals.py would be convenient: class Globals(object): def __init__(self): self.db = MySQLdb.connect() Then controllers can access the db via the globals. However, this seems to lead to problems ...

Pylons: Sharing SQLAlchemy MySQL connection with external library

I am running Pylons using SQLAlchemy to connect to MySQL, so when I want to use a database connection in a controller, I can do this: from myapp.model.meta import Session class SomeController(BaseController): def index(self): conn = Session.connection() rows = conn.execute('SELECT whatever') ... Say my controller ...

Pylons: nosetests, specify location of development.ini?

I'm running nosetests on a remote server. On my local server my test.ini and development.ini files are in the same directory. On my remote server, they are not. If I try to run just nosetests on the remote server, I get: IOError: File '/foo/bar/development.ini' not found Is there an option to specify the location of development...

Need help with KeyError when building epydoc files for project

I have a pylons project with an extensive set of functional tests that I want my manual QA's to be able to read from time to time, so I'm using epydoc to build out the html pydocs on the functional test modules. It seems to be working fine. It generates the docs, and I can navigate through them without any apparent problems. However, ...

trouble getting pylint to find inherited methods in pylons/SA models

I have a Pylons app that I'm using SqlAlchemy declarative models for. In order to make the code a bit cleaner I add a .query onto the SA Base and inherit all my models from that. So in my app.model.meta I have Base = declarative_base() metadata = Base.metadata Session = scoped_session(sessionmaker()) Base.query = Session.query_proper...