I'm writing a blog app with Django. I want to enable comment writers to use some tags (like <strong>, a, et cetera) but disable all others.
In addition, I want to let them put code in <code> tags, and have pygments parse them.
For example, someone might write this comment:
I like this article, but the third code example <em>could have...
I read the document
http://code.google.com/appengine/docs/python/tools/webapp/requesthandlerclass.html
but I cant find any information of the args parameters
...
I have a function named OpenAccount() which takes in the details from the User and appends it to my database dictionary.
I have a database file(module) which is imported in my function file.
I have a function called AppendRecord(key,**dictvalues) which appends values to my database file.
However I am not able to call the function and ...
I am inserting a set of records on Google App Engine. I insert them in batch to avoid deadline exceptions.
When there is a large number of records (for example 1k) I always receive an unexpected:
Transaction collision for entity group
with key
datastore_types.Key.from_path(u'GroupModel',
u'root', _app=u'streamtomail').
R...
I have written two scripts Write.py and Read.py.
Write.py opens friends.txt in append mode and takes input for name, email ,phone no and then dumps the dictionary into the file using pickle.dump() method and every thing works fine in this script.
Read.py opens friends.txt in read mode and then loads the contents into dictionary using p...
Do all Mac OS X versions (above 10.4) have python preinstalled?
...
Yes, that's what I need to achieve, don't ask why:)
So, since this is mainly OS dependent stuff I will be using Windows or Linux (whatever is simpler)
Every second my program will:
1. do a screenshot, analyze the board and other stuff (this I can do)
2. then move the mouse to some XY and do a left-click
that's all
My main concern is: is...
Hi, I've got a python list like
a = [
[[1,2,(3,4)],[1,2,(5)],[-3,3,(3)],[8,-2,(5)]],
[[1,2,(3,4,5)],[-1,222,(3,4,5)],[99,2,(3)],[8,-2,(4,5)]]
]
The tuple in each list element is total useless, please ignore that but delete them
I want to get the max min value from each list element in each position
The exepected output struc...
How do I do this in mako:
<%! import cherrypy %>
...
<link rel="stylesheet" href="${cherrypy.url('/media/layout.css')}" type="text/css" />
AttributeError: 'Undefined' object has no attribute 'url'
edit
Solved
...
my python version is 2.4.3.
Now I am developing a CLI with cmd module from python for a CD player. I have some classes like CDContainer (with method like addCD, removeCD, etc), CD (with method like play, stop, pause). Now, I want to add some options for the commands and also if the options inputs are not correct, the CLI could return pr...
I've got a list of 400 numbers, and i want to but them in a 20x20 grid using Python.
I've made a "2d array" (not really because Python doesn't support them, I've had to use a list of lists.)
When i try to loop through and assign each subsequnt item to the next box in the grid, it fails. i end up assinging the last item in the list to ...
Hi.
I have a Python application that backs up to an afp server. I also need to get some information from an ftp server. When I just run my Python script from Terminal, it works just fine. But then if I compile it into an application using py2app, it gives me an error. py2app doesn't really say what the error is. If I comment out the lin...
Hi all, I am a newbie of glade/pygtk.
I am doing with some radio menu items.
I created a signal handler on the signals tab,
handler: on_group_menu_change
user data: 7
what I expected is pass the int(or str) value 7 as user param to the handler. However, at startup, I found such warning:
Could not lookup object 0 on signal
gro...
i am using django ratings application
into this fields.py module,i added new function to RatingManager class which is get_bayesian see below
http://github.com/dcramer/django-ratings/blob/master/djangoratings/fields.py
def get_real_rating(self):
"""get_rating()
Returns the unmodified average rating."""
if not (self.votes a...
I construct the following FormRequest according to httpFox(Firefox addon)'s content. However, web server alway returns "500 Internal Server Error".
Could someone help me on this?
The original url is:
http://www.intel.com/jobs/jobsearch/index_ne.htm?Location=200000008
Here is my spider's skeleton:
class IntelSpider(BaseSpider):
...
How to define a function is_member() that takes a value (i.e. a number, string, etc) x and a list of values a, and returns True if x is a member of a, False otherwise. (Note that this is exactly what the in operator does, but for the sake of the exercise I should pretend Python did not have this operator.
This is what I've come up with,...
I want set another cookie when user login, I use google.appenine.api.users.create_loginurl() to create the login url, it's /_ah/login, how can I extend this handler and add another cookie. The same as logout.
...
Pretty straight forward question. I'm quite happy with my simple text editor but sometimes it'd be nice to run something like PyFlakes on my code before running to check for any obvious errors like undeclared variables or syntax errors.
...
I should define a function pad_with_n_chars(s, n, c) that takes a
string 's', an integer 'n', and a character 'c' and returns
a string consisting of 's' padded with 'c' to create a
string with a centered 's' of length 'n'. For example,
pad_with_n_chars(”dog”, 5, ”x”) should return the
string "xdogx".
...
Hi all,
I have a regular QListWidget with couple of signals and slots hookedup. Everything works as I expect. I can update, retrieve, clear etc.
But the UI wont support multiple selections.
How do I 'enable' multiple selections for QListWidget? My limited experience with PyQt tells me I need to create a custom QListWidget by subclassi...