pylons

What is the best method to get a number from an user?

Hello all, I was wondering for a small list of numbers [1..20], what kind of control will you advise to prompt the user for his selection. I was thinking of a NumericUpDown control but it does not exist for WebForm and to make matters worse, I am deploying on a Pylons application (Python Framework) Do you feel a DropDown control will s...

Importing Model / Lib Class and calling from controller

I'm new to python and pylons although experienced in PHP. I'm trying to write a model class which will act as a my data access to my database (couchdb). My problem is simple My model looks like this and is called models/BlogModel.py from couchdb import * class BlogModel: def getTitles(self): # code to get titles here ...

Default route doesnt work

Hey I'm using the standard routing module with pylons to try and setup a default route for the home page of my website. I've followed the instructions in the docs and here http://routes.groovie.org/recipes.html but when I try http://127.0.0.1:5000/ I just get the 'Welcome to Pylons' default page. My config/routing.py file looks like...

nose tests of Pylons app with models in init_model?

I have a stock Pylons app created using paster create -t pylons with one controller and matched functional test, added using paster controller, and a SQLAlchemy table and mapped ORM class. The SQLAlchemy stuff is defined in the init_model() function rather than in module scope (and needs to be there). Running python setup.py test raises...

Check whether debug is enabled in a Pylons application

I'm working on a fairly simple Pylons 0.9.7 application. How do I tell, in code, whether or not debugging is enabled? That is, I'm interested in the value of the debug setting under [app:main] in my INI file. More generally, how do I access the other values from there in my code? ...

What's the equivalent of Rails' Migrations or Django's South in Pylons and TG2?

Does anyone know how Pylons and TG2 projects handle database migrations? I'm looking for something similar to Rails' Migrations and Django's South. ...

Unit testing Couchdb model in Pylons

Given a default pylons installation are there any examples available on the best practices for unit testing a CouchDB model? ...

refer to map via. maps() action in python/ pylonshq

Hey I just started to learn python, and i'm totally new and n00b. Normally i work with php. I choose to use this framework: http://pylonshq.com/ I have created an map called ajax in my controller map. now i just need my "htaccees" file to find the ajax map. I want the file to go into the map /ajax/ where the file ajax_load.py is. ...

Do not require non-NULL field (allow empty strings) in FormAlchemy

I'm fairly novice to FormAlchemy and it seems that I don't get something. I have a SQLAlchemy model defined like this: ... class Device(meta.Base): __tablename__ = 'devices' id = sa.Column('id_device', sa.types.Integer, primary_key=True) serial_number = sa.Column('sn', sa.types.Unicode(length=20), nullable=False) mac = ...

Sqlalchemy : association table for many-to-many relationship between groups and members. How can I delete a relationship?

I have those tables setup : http://pastie.org/627764 ... # This is the association table for the many-to-many relationship between # groups and members - this is, the memberships. user_group_table = Table('user_group', metadata, Column('user_name', Integer, ForeignKey('user.user_name', onupdate="CASCA...

set URL when enter site - pylons

Hey My problem is that when a user enter my website like: www.mywebsite.com I use pylonshq I want the URL to be change to /#home if its possible via. map.connect. I have no idéa how to fix it via. python, so therefore a guide or maybe some samples would be a help. Right now it looks like this: map.connect('/', controller='home',a...

Creating tables with pylons and SQLAlchemy

I'm using SQLAlchemy and I can create tables that I have defined in /model/__init__.py but I have defined my classes, tables and their mappings in other files found in the /model directory. For example I have a profile class and a profile table which are defined and mapped in /model/profile.py To create the tables I run: paster setu...

Paster cannot stop daemon

I'm using the following command in my pylons app in an attempt to stop the daemon on the server: paster serve --daemon dev.ini stop This is the error I get: No PID file exists in paster.pid Could not stop daemon; aborting Wondering how I can stop this daemon so I can reload dev.ini. Thanks! ...

Python Image Uploading with AjaxUpload

I'm trying to use AjaxUpload with Python: http://valums.com/ajax-upload/ I would like to know how to access the uploaded file with Python. On the web site, it says: * PHP: $_FILES['userfile'] * Rails: params[:userfile] What is the Syntax for Python? request.params['userfile'] doesn't seem to work. Thanks in advance! Here is my c...

How to keep query parameters during pagination with webhelpers.paginate

I look an example of paginating from http://rapidprototype.ch/bg2docs/tg2pagination.html for my Turbogears 2 project and it works great but, I have a problem regarding my query parameters when I change the page I'm looking. This is what I have in my controller when listing. def list(self, page=1, **kw): q = "" if kw.has_key('q...

Snow Leopard Python 2.6 problems getting PIL to work

I installed libjpeg and PIL, but when I try to save a JPG image, I always get this error: ImportError: The _imaging C module is not installed Any help much appreciated! I tried to import _imaging w/ Python interpreter to see what's wrong and got this: >>> import _imaging Traceback (most recent call last): File "<stdin>", line 1...

Random ids in sqlalchemy (pylons)

I'm using pylons and sqlalchemy and I was wondering how I could have some randoms ids as primary_key. ...

redirect() Not Actually Redirecting (Routes for Pylons)

I am constructing a table of routes in my Pylons app. I can't get redirect() to work the way that it should work. I'm not sure what I'm doing wrong. Here is an example of redirect() usage from the Routes documentation: map.redirect("/home/index", "/", _redirect_code="301 Moved Permanently") Here is what appears in my routing.py f...

call pylons controller from vb.net

Hello, i have a application thats writen with the pylons framework. Now i want to call some controllers from a vb.net application. How should i do this? I've tried it like this: Dim webclient As New WebClient Dim dataStream As IO.Stream = webclient.OpenRead("http://192.168.0.20:5000/controller/default") Dim reader As New StreamReader(...

Install custom modules in a python virtual enviroment

I am doing some pylons work in a virtual python enviorment, I want to use MySQL with SQLalchemy but I can't install the MySQLdb module on my virtual enviorment, I can't use easyinstall because I am using a version that was compiled for python 2.6 in a .exe format, I tried running the install from inside the virtual enviorment but that d...