Hi, I'm doing a POST request to a rest service made with django and piston uploading a file, but when I do the request i get this (strange?) error:
[Sun Jul 04 16:12:38 2010] [error] [client 79.39.191.166] ModSecurity: Output filter: Failed to read bucket (rc 104): Connection reset by peer [hostname "url"] [uri "/api/odl/"] [unique_id "...
I think I finally figured out they need to use this DeclarativeFieldsMetaclass (to turn the class fields into instance variables and maintain their order with an ordered/sorted dict). However, I'm still not quite sure why they opted to use a BaseForm rather than implementing everything directly within the Form class?
They left a comment...
How do I make a DLL (.NET) written in python code (IronPython)?
...
Hello, I'm working on a small project and I've run into a small problem. The script I have needs to fetch a website and find a specific value in the source HTML file. The value is like this:
id='elementID'>
<fieldset>
<input type='hidden' name='hash' value='e46c945fe32a3' />
</fieldset>
Now I'm been trying to use the Elemen...
I'm trying to decide on which architecture to choose for developing Django 1.0.x through Django 1.2.1. I've managed to get MySQL, MySQLdb, PIL, and Python 2.65 installed on Snow Leopard using x86 64-bit builds, but I'm curious as to whether or not there is a definitive answer to this question at the moment, and if so, why?
Thank you!
Mi...
I'm expecting a string NOT to match a regular expression, but it is!
>>> re.compile('^P|([LA]E?)$').match('PE').group()
'P'
This seems like a bug, because I see no way for the $ to match. On the other hand, it seems unlikely that Python's re lib would not be able to handle this simple case. Am I missing something here?
btw, Python pr...
Hi,
I'm creating a simple CMS in django, with multiple "modules" (each as a django app). I've set up the following models:
class FooObject(models.Model):
id = models.SlugField(primary_key=True)
name = models.CharField(max_length=255)
creator = models.ForeignKey(auth.models.User, editable=False, related_name="createdby")
cl...
# max_list = [83, 1350, 1, 100]
for i in range(len(max_list)):
new_value = 1
while new_value < max_list[i]:
new_value *= 10
max_list = new_value
What I'm doing is rounding numbers up to the closest, uhm, zero filled value? I'm not sure what it would be called. But basically, I want 83 -> 100, 1 -> 1, 1350 -> 10...
Hello,
I am developing an application with PyQT4 which will POST some data to a web service to send SMS. The application works perfectly on Ubuntu 10.04. But when I deploy it on Windows, I get the BadStatusLine Error. I am running Python 2.6.4 on Windows 7.
The Error Message and the source codes follow. I didn't put the gui.py since it...
What would be the optimal way of clustering nodes after cutting a MST with a maximum edge-length? My output from MST edge-length cut is a 2xN array where each element is an integer. The integers are the node identifiers that describe the edges. An example of the output would is given below:
>>> print array[0:3]
[[ 0 1]
[ 0 2]
[...
I find learning new topics comes best with an easy implementation to code to get the idea. This is how I learned genetic algorithms and genetic programming. What would be some good introductory programs to write to get started with machine learning?
Preferably, let any referenced resources be accessible online so the community can ben...
I have tried unsuccessfully several times to get programs to remember settings after they've been destroyed. A large reason for that is because I don't have an example code to work off of. Below I have a simple program I wrote. I'd like it so that it both remembers the position of the scale, and the contents of the text widget upon resta...
Several laptops on the market have problems with Linux for brightness controls. However, recently I found out that you can use CompizConfig settings to dim at least a particular window. Many people, however, want to dim all windows. I know Compiz can do this in the API somewhere because look what happens when you do Super + Tab in Compiz...
So I am running python 2.6 on a macbook pro and trying to write the code in python to display an image from a file in a label on a tkinter gui. The image is called image.png. The program runs without errors when I use this code
i = Image.open("image.png")
but when I do this code (I add one line):
i = Image.open("image.png")
photo = ...
Right now I'm working on a script that needs to extract the artist, album, and title from all these audio files. At the moment, I first try to extract them with regular expressions, and if the files aren't named nicely I go the slow route and try to get the information with id3 tags. The files then just get ignored if neither works.
I...
Hi all -
I'm looking for C or Python code to implement either of the two pseudocode functions:
function 1:
list1 = [0,1,2] #any list of single-integer elements
list2 = [0,3,4]
list3 = [0,2,4]
function1(list1, list2, list3)
>>> (0,3,2),(0,3,4),(0,4,2),(1,0,2),(1,0,4),(1,3,0),(1,3,2),(1,3,4),
(1,4,0),(1,4,2),(2,0,4),(2,3,0),(2,3,4...
I want to convert generator or iterator to list recursively.
I wrote a code in below, but it looks naive and ugly, and may be dropped case in doctest.
Q1. Help me good version.
Q2. How to specify object is immutable or not?
import itertools
def isiterable(datum):
return hasattr(datum, '__iter__')
def issubscriptable(datum):
...
Hi,
I have a Django project for managing a list of journal articles. The main model is Article. This has various fields to store things like title of the article, publication date, subject, as well as list of companies mentioned in the article. (company is it's own model).
I want a template that prints out a list of the articles, sorte...
How can I add something to my "Pythonpath".
Where exactly are the files located, I have to change to add to my pythonpath?
What exactly do I add to my Pythonpath?
If Python calls:
/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/
But I want it to call
/Library/Frameworks/Python.framework/Versions/2.6/...
I am working on a custom Django form field and accompanying widget. While rendering the template, i would like to inspect the form.field as a python object.
How do I do that, because anything in a Django template outside of template tags and filters is rendered as text.
...