Is it possible to create a decorator which can be __init__'d with a set of arguments, then later have methods called with other arguments?
For instance:
from foo import MyDecorator
bar = MyDecorator(debug=True)
@bar.myfunc(a=100)
def spam():
pass
@bar.myotherfunc(x=False)
def eggs():
pass
If this is possible, can you provi...
i have the following script that i am using to get the log messages from svn
import pysvn
class svncheck():
def __init__(self, svn_root="http://10.11.25.3/svn/Moodle/modules", svn_user=None, svn_password=None):
self.user = svn_user
self.password = svn_password
self.root = svn_root
def diffrence(self):...
Hi All,
I have to include a dynamic page content into my template, Say I have a left panel which gets the data dynamically through a view. Now, I have to include this left panel into all my pages but I do not want to duplicate the code for all the pages. Is there any way, I can write a single script and include it in all my templates to...
I would like to know what are the certificates available for programming, like
Zend for PHP
SUN Certification for java
what are the others?
Javascript ?
C++ ?
Python ?
etc...
Please give me some suggestion for other available certifications.
...
Hi,
I’ve a bash script I’ve been using for a Linux environment but now I have to use it on a Windows platform and want to convert the bash script to a python script which I can run.
The bash script is rather simple (I think) and I’ve tried to convert it by google by way around but can’t convert it successfully.
The bash script looks l...
I can look inside setup.py I suppose to see if it's a distutils package. But in the process of familiarizing myself with python package management I have noticed that there seems to be more than one way to do it. So:
How can I check an unzipped packages directory or setup.py to see how to build it?
EDIT: When I say 'build' I mean is ...
Hi all, long-time lurker here, finally emerging from the woodwork.
Essentially, what I'm trying to do is have my logger write data like this to the logfile:
Connecting to database . . . Done.
I'd like the 'Connecting to database . . . ' to be written when the function is called, and the 'Done' written after the function has successfu...
Hi,
I am writing a python script on Linux for twitter post using API, Is it possible to pass symbols like "(" ")" etc in clear text without apostrophes....
% ./twitterupdate this is me #works fine
% ./twitterupdate this is bad :(( #this leaves a error on bash.
Is the only alternative is to enclose the text into --> "" ?? like..
% ...
A value which is a PyUnicodeObject need to be passed to PyObject variable.
Is there any conversion method for that?
thanks
karnol
...
Hi !
I'm working with web2py and for some reason web2py seems to fail to notice when code has changed in certain cases. I can't really narrow it down, but from time to time changes in the code are not reflected, web2py obviously has the old version cached somewhere.
The only thing that helps is quitting web2py and restarting it (i'm u...
I'm trying to develop an app using Django 1.1 on Webfaction. I'd like to get the IP address of the incoming request, but when I use request.META['REMOTE_ADDR'] it returns 127.0.0.1. There seems to be a number of different ways of getting the address, such as using
HTTP_X_FORWARDED_FOR or plugging in some middleware called SetRemoteAddrF...
I have the following django test case that is giving me errors:
class MyTesting(unittest.TestCase):
def setUp(self):
self.u1 = User.objects.create(username='user1')
self.up1 = UserProfile.objects.create(user=self.u1)
def testA(self):
...
def testB(self):
...
When I run my tests, testA will...
I am new to python and I am super excited to learn. I am building my first app on app engin and I am not totally understanding why my yaml file is not resolving to the url that I set up.
here is the code
handlers:
- url: .*
script: main.py
- url: /letmein/.*
script: letmein.py
so if I go to http://localhost:8080/letmein/ I get ...
I'm trying to write a C module to lexically analyse Python code. How can I do it?
...
Hello,
I was hoping to get some help on a question. I have an infinite loop that I need run and I need to update a set of variables (x in this case) at random times from the command-line. Is there any way to do this?
For example:
x = 0
while True:
x = x + 1
if x < 30:
do something
and I need to update x's value from the comma...
I know Ruby right now, however I want to learn a new language. I am running Ubuntu 10.04 right now but I am going to get a Mac later this summer. Anyways I want something more for GUI development. I was wondering if I should learn C on Ubuntu right now, and then learn Objective-C when I get an iMac? Will learning C give me an edge? Or sh...
Hi,
How can i print only certain words from a string in python ?
lets say i want to print only the 3rd word (which is a number) and the 10th one
while the text length may be different each time
mystring = "You have 15 new messages and the size is 32000"
thanks.
...
I am looking for a way to define properties in Python similar to C#, with nested get/set definitions.
This is how far I got:
#### definition ####
def Prop(fcn):
f = fcn()
return property(f['get'], f['set'])
#### test ####
class Example(object):
@Prop
def myattr():
def get(self):
return self....
I'm a newb to Python so apologies in advance if my question looks trivial.
From a psycopg2 query i have a result in the form of a list of tuples looking like:
[(1, 0), (1, 0), (1, 1), (2, 1), (2, 2), (2, 2), (2, 2)]
Each tuple represents id of a location where event happened and hour of the day when event took place.
I'd like to res...
Hi,
I am planning to write a generic python module for installing a package. This script should retrieve the module from a remote machine or locally and install it on a given host and user. However, there needs to be changes made to the package files based on the host, user and given environment.
My approach is to use XML to describe ...