Hello Everybody!!
I am implementing the reddit.com source code on ubuntu karmic 9.10.
I have followed all the steps and in one step where i am using paster command it throws an error.
$paster shell example.ini
File "/usr/local/lib/python2.6/dist-packages/Pylons-0.9.6.2-
py2.6.egg/pylons/middleware.py", line 11, in
from webhelper...
Let's say I have a settings.py file in my app's root folder (/myapp/myapp/settings.py) with just a bunch of variables in it:
var1 = ''
var2 = ''
Can I automatically set one of those variables from the .ini file? I tried this:
myapp.settings.var1 = 'this is from development.ini'
But when I call var1 it is still the empty string:
i...
What the best way to make pylons application internationalist?
...
I keep receiving the error, "TypeError: 'Shard' object is unsubscriptable."
#Establish an on-demand connection to the central database
def connectCentral():
engine = engine_from_config(config, 'sqlalchemy.central.')
central.engine = engine
central.Session.configure(bind=engine)
#Establish an on-demand connection to a shard ...
I'm performing all my form validation in a class, and would like to be able to get the errors from the class to the rendered html. One approach I was thinking about was to create a global variable "c" that would store all the errors and to set them from within the class, as I still want the individual methods to return false when they f...
Should I access global db object directly from within the methods of each class? Or from each method, should I instantiate an instance of the db object?
One of my database objects changes depending on the id of the info being accessed so it is created through a function connectToDatabase(id). Should I make this a global function, ha...
I'm trying to figure out the problem in this short paragraph of code. Any help would be appreciated. Regardless of what I specify User.email to be, it always returns false.
def add(self):
#1 -- VALIDATE EMAIL ADDRESS
#Check that e-mail has been completed
try:
#Validate if e-mail address is in correct format
...
Using pylons 0.9.7, I'm trying to make a function that connects to a database on demand. I'd like it to be accessible from all functions within all model classes.
In model/__init__.py, I have:
#Establish an on-demand connection to the central database
def connectCentral():
engine = engine_from_config(config, 'sqlalchemy.central.'...
I'd like to calculate a MAX() value for a column. What's the proper way to do this in sqlalchemy while preserving database independence?
...
SQLAlchemy seems really heavyweight if all I use is MySQL.
Why are convincing reasons for/against the use of SQLAlchemy in an application that only uses MySQL.
...
Is there a way to make a form where it can simultaneously upload to several servers at once?
Currently in my web application, I am asking the users to type in some info + select a few files to upload.
Title, Description, Info, etc
File 0
File 1
File 2
File ...
On the backend, I'm using Pylons. Currently it accepts POST of (info + ...
I'm having trouble creating a global function accessible from within all classes. I receive an error from within user.py that says:
NameError: global name 'connectCentral' is not defined
Here is my current code.
project/model/__ init __.py:
"""The application's model objects"""
import sqlalchemy as sa
from sqlalchemy im...
I have a class in my existing python project, User, that I would like to map to tables. But I'm not sure what the best way to do this is?
Does this mean I can remove:
class User:
pass
from my model/__ init __.py?
Or should I leave that in there, and have something like:
from project.model.user import User
class User:
pass
...
I have a Python list that I'm supplying to the template:
{'error_name':'Please enter a name',
'error_email':'Please enter an email'}
And would like to display:
<ul>
<li>Please enter a name</li>
<li>Please enter an email</li>
</ul>
...
Are there alternatives to manually coding the JS and HTML?
Is there a Pylons-way to do this?
Sample code is appreciated.
...
I have a simple form in python + pylons that submits to a controller. However, each page load doesn't seem to be a fresh instantiation of the class. Rather, class variables specified on the previous page load are still accessible.
What's going on here? And what's the solution?
...
Hi All,
One of my URLs is for a tracking cookie. In the basic configuration, the pylons controller parses the query string, does a DB query, and sets the cookie accordingly.
I want to move to nginx. I am wondering if this is possible:
nginx fetches value of cookie from memcached
nginx writes the headers and serves static file
nginx r...
Specifically for the ff: topics:
Windows installation
Using mod_wsgi/mod_python
Python best practices
Python security stuff
Using Pylons
Thanks
...
I have a pylons application where, under certain cirumstances I want to spawn multiple worker threads to process items in a queue. Right now we aren't making use of a ThreadPool (would be ideal, but we'll add that in later). The main problem is that the worker threads logging does not get written to the log files.
When I run the code ou...
Trying to figure out the best way to do this:
Should I do something like:
def index(self):
if request.POST:
u = User(id)
u.setCookie() #All session logic in def setCookie()
Or set the cookie in the controller like:
def index(self):
if request.POST:
u = User(id)
response.set_cookie('session_key...