there is any sample showing how to use the blobstore api with ajax?
when i use forms works fine, but if i use jquery i don't know how to send the file and i get this error:
blob_info = upload_files[0]
IndexError: list index out of range
I have this code in javascript
function TestAjax()
{
var nombre="Some random name";
aja...
Current version:
def chop(ar,size):
p=len(ar)/size
for i in xrange(p):
yield ar[(i*size):((i+1)*size)]
ar is type of list().
What i want is that chop() takes iterator and return iterator.
for i in chop(xrange(9),3):
for j in i:
print j,
print
prints
0 1 2
3 4 5
6 7 8
...
I'm wondering if anyone has an elegant solution to checking for a valid kerberos ticket using python. I'm not seeing anyway with kinit or klist that will show if a ticket is expired with a return code.
I could run klist and use a regex for the output but... Thanks much!
...
I've begun planning a kind of web store interface that I want to work on soon. I'm starting to import products from China and want to have a completely unique feel for my site. Now I'm kinda a google fanboy and have heard alot about google app engine. Mostly I like the hosting available with google more then anything though. But I wanted...
I'm using the following software stack on Ubuntu 10.04 Lucid LTS to
connect to a database:
python 2.6.5 (ubuntu package)
pyodbc git trunk commit eb545758079a743b2e809e2e219c8848bc6256b2
unixodbc 2.2.11 (ubuntu package)
freetds 0.82 (ubuntu package)
Windows with Microsoft SQL Server 2000 (8.0)
I get this error when trying to do nativ...
I have code that looks something like this:
self.ui.foo = False
self.ui.bar = False
self.ui.item = False
self.ui.item2 = False
self.ui.item3 = False
And I would like to turn it into something like this:
items = [foo,bar,item,item2,item3]
for elm in items:
self.ui.elm = False
But obviously just having the variables in the list ...
Is there a way to view the source code of a function, class, or module from the python interpreter? (in addition to using help to view the docs and dir to view the attributes/methods)
...
I'm using Django/Python, but pseudo-code is definitely acceptable here.
Working with some models that already exist, I have Employees that each have a Supervisor, which is essentially a Foreign Key type relationship to another Employee.
Where the Employee/Supervisor hierarchy is something like this:
Any given Employee has ONE Super...
I am fetching all the instances for a given linkname but I want to call all their values(rating2) to perform a calculation, I debugged and all my time is in the query and fetch lines, I only have a table with 100 items and it is taking 2 seconds!!!!! How can it be this slow to fetch a few items out of a 100 item table and how can I spee...
Background:
I grew up on using Perl/Python/Ruby for sysadmin-type tasks and shell scripting. I always avoided Bash scripting whenever I needed anything programmer-ish, like functions, looping or control structures. Back then, I could pick my favorite tool for whatever the job.
Problem:
Now I am working in a situation where the preferr...
I am trying to install Jinja2 on a web server. I tried running the command "easy_install Jinja2" as they suggested and got an error:
[Errno 13] Permission denied: '/usr/lib/python2.5/site-packages/test-easy-install-15897.write-test'
I thought that since this was a permission problem, I tried the same thing with "sudo". I was asked ...
I have just joined a project with a rather large existing code base. We develop in linux and do not use and IDE. We run through the command line. I'm trying to figure out how to get python to search for the right path when I run project modules. For instance, when I run something like:
python 'someprojectfile.py'
I get
ImportError: no...
I've looked around a bit but I can't seem to solve this problem I have. I'd like to execute a python script within a view of my django app. I've placed the code I'd like to execute inside a django management command so it can be accessed via command line python manage.py command-name. I then tried to run this command using subprocess....
I am having the hardest time finding any resources that decently walk you through in terms of setting up a basic web service that can be accessed. Most of the stuff I am seeing is on the client side. The imports people talk about are all outdated and/or are buggy or rely heavily on established frameworks. I prefer SOAP so can anyone plea...
This question is about formatting ruby's strings.
In Python, built-in data structures have a built-in to-string method, and so when a variable is printed, the string is conveniently formatted to be reflective of the data structure used. For example:
>>>$ python
Python 2.6.4 (r264:75706, Dec 7 2009, 18:45:15)
[GCC 4.4.1] on linux2
Type...
I realize specific questions like this aren't great, but I've spent several days trying to puzzle this out. Hopefully someone here can help.
This python code using PyQt4 causes a segmentation fault:
data = """<?xml version="1.0" ?>
<svg height="1000" width="2000">
<text>blah</text>
</svg>"""
svg = QSv...
Hi all
Is there a way to accept only numbers in Python, say like using raw_input()?
I know I can always get the input and catch a ValueError exception, but I was interested in knowing whether there was someway I could force the prompt to accept only numbers and freeze on any other input.
...
Hi
I would like to know that how much time a particular function has spent during the duration of the program which involves recursion, what is the best way of doing it?
Thank you
...
I'm using ElementTree to generate some HTML, but I've run into the problem that ElementTree doesn't store text as a Node, but as the text and tail properties of Element. This is a problem if I want to generate something that would require multiple text nodes, for example:
<a>text1 <b>text2</b> text3 <b>text4</b> text5</a>
As far as I ...
I'm having trouble printing a string in lines chat contains 60 characters.
my code is below:
s = 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrtsucwxyz'
for i in range(0, len(s), 60):
for k in s[i:i+60]:
print k
...