I have a number of mappers that look like this:
mapper(Photo,photo_table, properties = { "locale": relation(PhotoContent, uselist=False, primaryjoin=and_(photo_content_table.c.photoId == photo_table.c.id, photo_content_table.c.locale == get_lang()), foreign_keys=[photo_content_table.c.photoId, photo_content_table.c.locale])
I have dep...
So, Generic views are pretty cool, but what I'm interested in is something that's a generic template.
so for example, I can give it an object and it'll just tostring it for me.
or if I give it a list, it'll just iterate over the objects and tostring them as a ul (or tr, or whatever else it deems necessary).
for most uses you wouldn't ...
I'm importing from a CSV and getting data roughly in the format
{ 'Field1' : 3000, 'Field2' : 6000, 'RandomField' : 5000 }
The names of the fields are dynamic. (Well, they're dynamic in that there might be more than Field1 and Field2, but I know Field1 and Field2 are always going to be there.
I'd like to be able to pass in this dict...
I looked through the other posts and bug reports and couldn't figure out what's causing this. I'm using Jython 2.5.1, in a Java project in Eclipse (Ubuntu 8.10). It has been added to the project as a standalone .jar file (I just replaced the old Jython 2.1 jar with this one).
I'm running a script that uses the threading.py class. At som...
I've got several sites, each with a distinct settings file -- and with distinct names. There's a floral theme to all the variant settings. We have to keep the sites separate.
C:\Proj-Carnation> echo %DJANGO_SETTINGS_MODULE%
path.to.settings_carnation_win32
We have many test procedures which don't use the built-in django-admin.py tes...
I use matplotlib 0.99
so, I can`t change width of border of subplot..
how can I do it?
code like it:
fig = plt.figure(figsize = (4.1, 2.2))
ax = fig.add_subplot(111)
and then,
ax.patch.set _ linewidth(0.1) or
ax.get _ frame().set _ linewidth(0.1) doesn`t work!
but legend.get _ frame().set _ linewidth(0.1) works fine.
...
Hello guys.
I built (just for fun) 3 classes to help me log some events in my work.
here are them:
class logMessage:
def __init__(self,objectName,message,messageType):
self.objectName = objectName
self.message = message
self.messageType = messageType
self.dateTime = datetime.datetime.now()
def...
What's the easiest way to generate a bitmap using Python?
Text support would be nice but not required.
(On Mac, I was trying to use Quartz through Python, but Snow Leopard seems to have broken its functionality. Therefore I've decided to look for a solid, simple, cross-platform solution that won't break each time the OS is updated.)
...
Certain list comprehensions don't work properly when I embed IPython 0.10 as per the instructions. What's going on with my global namespace?
$ python
>>> import IPython.Shell
>>> IPython.Shell.IPShellEmbed()()
In [1]: def bar(): pass
...:
In [2]: list(bar() for i in range(10))
--------------------------------------------------------...
I am working with the new version of django-threadedcomments and making some progress; it integrates nicely with django's commenting system, however, I'm stuck and not sure how to proceed.
For threaded comments to work, the user needs to select a comment to "reply to" and then the correct submit form is brought up (with the appropriate ...
I'm using google-app-engine-django to run Django 1.1 on Google App Engine and I'm getting lots and lots of DeadlineExceededErrors, sometimes with . My entire app is quite simple, and it's happening throughout my app, so I suspect that there is a problem with my basic settings. Any advice would be greatly appreciated!
Sample error:
<cla...
I can't seem to find an elegant way to start from t and result in s.
>>>t = ['a',2,'b',3,'c',4]
#magic
>>>print s
{'a': 2, 'c': 4, 'b': 3}
Solutions I've come up with that seems less than elegant :
s = dict()
for i in xrange(0, len(t),2): s[t[i]]=t[i+1]
# or something fancy with slices that I haven't figured out yet
It's obviously ...
I want to run three commands at the same time from python. The command format is query.pl -args
Currently I am doing
os.system("query.pl -results '10000' -serverName 'server1' >> log1.txt")
os.system("query.pl -results '10000' -serverName 'server2' >> log2.txt")
os.system("query.pl -results '10000' -serverName 'server3' >> log3.txt"...
I'm trying to understand if the following Python function:
def factorial(i):
if not hasattr(factorial, 'lstFactorial'):
factorial.lstFactorial = [None] * 1000
if factorial.lstFactorial[i] is None:
iProduct = 1
for iFactor in xrange(1, i+1):
iProduct *= iFactor
factorial.lstFactorial[i]...
I'm trying to use urlretrieve to download files from urls that take the form:
http://example.com/download.php?id=6456&name=foo
yet for some reason I just get an empty response.
I've tried the method suggested in this question didn't seem to help because
remotefile.info()
doesn't contain the key 'content-disposition', only
['...
How to fetch multiple documents from CouchDB, in particular with couchdb-python?
...
I am tasked to develop a very simple web layer for a very complex algorithm that is implemented as an Excel worksheet. This script would be called from a Ruby on Rails app that would be presenting the user with the forms, check validations and whatnot, and should return just a number. After perusing this site, my best shot is to auto...
Hi,
I have the task of developing an application to pull data from remote REST services and generating Excel reports. This application will be used by a handful of users at the company (10-15). The data load can reach 10,000-200,000 records. I have been debating whether to use Python or C#...
The only reason I am considering Python is ...
The following sample code:
import token, tokenize, StringIO
def generate_tokens(src):
rawstr = StringIO.StringIO(unicode(src))
tokens = tokenize.generate_tokens(rawstr.readline)
for i, item in enumerate(tokens):
toktype, toktext, (srow,scol), (erow,ecol), line = item
print i, token.tok_name[toktype], toktext...
I have a simple thread that grabs bytes from a Bluetooth RFCOMM (serial-port-like) socket and dumps them into a Queue.Queue (FIFO), which seems like the typical method to exchange data between threads. Works fine.
Is this overkill though? Could I just use a bytearray then have my reader thread .append(somebyte) and the processing func...