Example code for the repoze.bfg web framework performs post-response cleanup by adding a __del__ method to an object attached to the request's environ.
Is there a better way to clean up database connections, etc. after the response has been completely sent to the client?
...
What do I need to implement to add a new templating language to repoze.bfg? Will the framework send my plugin absolute paths or package relative paths, or both depending?
...
Hi ,
I have an XML file which contains some data as given.
<?xml version="1.0" encoding="UTF-8" ?>
- <ParameterData>
<CreationInfo date="10/28/2009 03:05:14 PM" user="manoj" />
- <ParameterList count="85">
- <Parameter name="Spec 2 Included" type="boolean" mode="both">
<Value>n/a</Value>
<Result>n/a</Result>
</Parameter>
- ...
i have seen many web framework provide non-blocking web server, i just want to know what it mean.
...
Say I have a string representing some nested lists and I want to convert it into the real thing. I could do this, I think:
exec "myList = ['foo', ['cat', ['ant', 'bee'], 'dog'], 'bar', 'baz']"
But in an environment where users might be supplying the string to execute this could/would be a bad idea. Does anybody have any ideas for a ti...
Hello all,
I just started learning pyqt.. When i'm experimenting with the tabbar i encountered this.. As a minimal example i want to show a button in tab1 and a label in tab2.. Here's what i did
from PyQt4 import QtGui
class Ui_TabWidget(QtGui.QTabWidget):
def __init__(self,parent=None):
QtGui.QTabWidget.__init_...
I would like to run an asynchronous program on a remote linux server indefinitely. This script doesn't output anything to the server itself(other than occasionally writing information to a mysql database). So far the only option I have been able to find is the nohup command:
nohup script_name &
From what I understand, nohup allows the...
This is in reference to a question I posted yesterday http://stackoverflow.com/questions/1925284/searching-a-file-in-3-different-ways
I just require help now on two things, searching a file and and printing the line a search result is found on and all the lines after it to the end of the file.
Lastly i need help on coding were i search...
Hello,
I am trying to write this script to my linux terminal and I am recieving the following error message: "OSError: [Errno 2] No such file or directory". Can anyone help, Thanks
#!/home/build/test/Python-2.6.4
import os, subprocess
# Create a long command line
cmd =[\
"si createsandbox --yes --hostname=be", \
" --port=70", \
...
Hello,
I am having trouble trying to get this script to work. When I debug this code it will not read into the class or functions. The code will not execute properly. Has anyone know the problem here, Thanks
#!/home/build/test/Python-2.6.4
import os, subprocess
class mks_function:
sandbox="new_sandbox"
def mks_create_sandbox(): ...
Hello,
I have a scrollbar widget that ALWAYS hides the last 15 px under the resize button, is there an option to stop this happening on mac or a padding "under" the widget option?\
thanks!
...
Greetings pyc-sires and py-ladies,
I would like to inquire if there is an elegant pythonic way of executing some function on the first loop iteration.
The only possibility I can think of is:
first = True
for member in something.get():
if first:
root.copy(member)
first = False
else:
somewhereElse.copy(memb...
Trying to solve a problem of preventing duplicate images to be uploaded.
I have two JPGs. Looking at them I can see that they are in fact identical. But for some reason they have different file size (one is pulled from a backup, the other is another upload) and so they have a different md5 checksum.
How can I efficiently and confident...
I would like my code to look beautiful
Thanks in advance..
...
In django when updating a global dictionary data structure I want to lock access to it by different request. I am planning to have a wrapper funtion to update and access and synchronize it. Coming from java background! Any pointers?
...
I have both, django and mysql set to work with UTF-8.
My base.html set utf-8 in head.
row on my db :
+----+--------+------------------------------------------------------------------+-----------------------------+-----------------------------+---------------------+
| id | psn_id | name ...
Hi,
I'm using Django/Python , I need to ask the user for permission to let me put feeds ( ideally oneliners which was not working so I thought to use full streams) into the user profile.
Would you like to receive email from our application?
This is giving me a hyper link which I click and it shows me the permission box. What is need...
I am trying to return (execute) a function from another file in an if statement.
I have read that the return statement will not work, I was hoping someone would know what statement would allow me to call an outside function.
The function creates a sandbox but if one exists I want to pass the if statement.
This is a small snippet of cod...
class Class1(object):
...
class Class2(object):
...
class Class3(object):
...
class A(object):
def _methA(parm1, parm2)
...
def _methB(parm1, parm2)
...
def _methC(parm1, parm2)
...
def manager(parm1, method, params)
...
if parm1.__class__.__name__==Class1.__name__...
I have written a python script that uses subprocess to call robocopy to sync log files from a remote host.
Like so:
program = 'Robocopy'
options = ['/S']
args.append(program)
args.append(options)
args.append('\\\\%s\%s' % (hostname, source_path))
args.append(local_path)
proc = subprocess.Popen(args=args, shell=True, stdout=cmd_log, st...