I am studying Python language. I want to know about splitting HTTP request
GET /en/html/dummy.php?name=MyName&married=not+single &male=yes HTTP/1.1
Host: www.explainth.at
User-Agent: Mozilla/5.0 (Windows;en-GB; rv:1.8.0.11) Gecko/20070312 Firefox/1.5.0.11
Accept: text/xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Lang...
Hi folks,
I'm installing an environment where I had two Zope/Plone servers:
plone1 -> for web content & user authentication
plone2 -> for web applications
I want to implement SSO around both servers but I don't know how to do it. I try to modify login_next and setAuthCookie(..) to share the __ac cookie in the domain, but didn't work...
I need to store a Django template object in a Model property.
My solution so far has been to pickle the object before assigning it to a BlobProperty :
entity.template_blob = pickle.dumps(template)
entity.put()
And then after a fetch from the datastore, I do :
template = pickle.loads(entity.template_blob)
Am I doing this wrong ? I ...
Is there an officially updated recommendation indicating which versions of Python should be supported by released modules? Or perhaps a page giving a survey of production usage of various versions? It's difficult to know how much use to make of newish features like context managers, class decorators, etc. when writing a module.
Note t...
I'm new to python and open cv. I'm trying to find out how to load an image in opencv with python. Can any one provide an example (with code) explaining how to load the image and display it?
import sys
import cv
from opencv.cv import *
from opencv.highgui import *
ll="/home/pavan/Desktop/iff pics/out0291.tif"
img= cvLoadImage( ll );
cvNa...
What is the best way to implement web services in Python?
...
Hi,
I had read the docs for Appengine to know how to retrieve data from Models.
But i´m missing something..
My models are user and student, where student is a reference property from user.
Users login, fill form with some values and save the data with put().
If you login with [email protected] you get your data or if you login with an...
I want test whether a string is present within any of the list values in a defaultdict.
For instance:
from collections import defaultdict
animals = defaultdict(list)
animals['farm']=['cow', 'pig', 'chicken']
animals['house']=['cat', 'rat']
I want to know if 'cow' occurs in any of the lists within animals.
'cow' in animals.valu...
How do I add a space in reStructuredText's section-numbering directive, like such:
.. section-numbering:
:suffix:
This then is run through rst2epub. The result for html output is but in epub format, this gets eaten and the section number jams.
if I put just typed spaces, I get this in the epub:
System Message: ERROR/3 ( <...
Possible Duplicate:
How do you split a list into evenly sized chunks in Python?
I have list of tuples, each tuple has two items (the amount of tuples may vary).
[(a, b), (c, d)...)]
I want to convert the list to a nested list of tuples so that each nested list contains 4 tuples, if the original list of tuples has quantity n...
How to write regex for this paricular situation.
Here letters in [] is not fixed but letters without [] is fixed.
http://www.abc.com/fixed/[any small letters]/[anyletters]/fixed.html
...
Hello,
I'm using the following code to extract a tar file:
import tarfile
tar = tarfile.open("sample.tar.gz")
tar.extractall()
tar.close()
However, I'd like to keep tabs on the progress in the form of which files are being extracted at the moment. How can I do this?
EXTRA BONUS POINTS: is it possible to create a percentage of the ex...
>>> teststring = 'aõ'
>>> type(teststring)
<type 'str'>
>>> teststring
'a\xf5'
>>> print teststring
aõ
>>> teststring.decode("ascii", "ignore")
u'a'
>>> teststring.decode("ascii", "ignore").encode("ascii")
'a'
which is what i really wanted it to store internally as i remove non-ascii characters. Why did the decode("ascii give out a uni...
Hi.
I am trying to resize an image before it gets saved. I am using a custom save method on the model, but I've hit a snag.
This is the code I have now:
class UserImages(models.Model):
height = models.CharField(blank=True, max_length=100)
width = models.CharField(blank=True, max_length=100)
image = models.ImageField(upload_...
Hello, I have a method to save data in DB, and a decorator to manage the connection, but I can't figure out how to make it work.
method to save:
class DA_Row(DABase):
@DABase.connectAndDisconnect
def save(self):
"""
Guarda el spin en la base de datos
"""
self.__cursor.callproc('sp_insert_row', (...
Hi,
is it possible to import modules from .lib library to Python program (as simple as .dll)?
...
I am fetching current data from another company's web feed. It is a simple fetch of an XML file over HTTP. They haven't provided me with much documentation - just a URL.
Because I need to know as soon as possible when the data changes on their site, I need to poll frequently, which isn't a satisfactory solution for either side.
I was a...
I have an unsorted list of integers in a Python list. I want to sort the elements in a subset of the full list, not the full list itself. I also want to sort the list in-place so as to not create new lists (I'm doing this very frequently). I initially tried
p[i:j].sort()
but this didn't change the contents of p presumably because a ne...
Hi
I have a string like this
>>> x="Alpha_beta_Gamma"
>>> words = [y for y in x.split('_')]
>>> words
['Alpha', 'beta', 'Gamma']
I want output saying X is non conformant as the the second element of the list words starts with a lower case and if the string x = "Alpha_Beta_Gamma" then it should print string is conformant
...
Hello,
for my CGI application I'm writing a function to get the browser's preferred language (supplied in the HTTP_ACCEPT_LANGUAGE variable). I want to find all language tags in this variable with regular expressions (The general pattern of a language tag is defined in RFC1766). EBNF from RFC1766 ('1*8ALPHA' means one to eight ASCII cha...