Bengt Richter wrote:
> On Mon, 02 May 2005 20:24:02 -0400, vegetax <[EMAIL PROTECTED]> wrote:
>
>>Irmen de Jong wrote:
>>
>>> vegetax wrote:
>>>> How can i use cgi'like print statement in a multitreaded web framework?
>>>> each thr
vegetax wrote:
> Jeff Epler wrote:
>
>> You could write something like
>> class ThreadSpecificFile:
>> def set_stdout(f):
>> self.files[thread_id] = f
>> def write(data):
>> self.files[thread_id].write(da
Jeff Epler wrote:
> You could write something like
> class ThreadSpecificFile:
> def set_stdout(f):
> self.files[thread_id] = f
> def write(data):
> self.files[thread_id].write(data)
> sys.stdout = ThreadSpecificFile()
> where you'll have to fill out
Irmen de Jong wrote:
> vegetax wrote:
>> How can i use cgi'like print statement in a multitreaded web framework?
>> each thread has its own Servlet instance with request/response objects,
>> sys.stdout = self.response(which is a file like object) wont work because
>&g
How can i use cgi'like print statement in a multitreaded web framework?
each thread has its own Servlet instance with request/response objects,
sys.stdout = self.response(which is a file like object) wont work because
all threads will set the same file object and it will be a concurrence
mess.
I
Class Req:
def __init__(s,headers):
s.headers = headers
referer =\
property(lambda s:s.headers['Connection'],
lambda s,v:s.headers.__setitem__('referer',v))
each thread has its own instance of class Req, Req instances are not shared
between threads
--
http://
Peter Hansen wrote:
> vegetax wrote:
>> in python it is common to see naming
>> inconsistencies ,methods,modules,packages,classes with names in every
>> posible style:
>> thisisalongmethod
>> ThisIsALongMethod
>> thisIsALongMethod
>> this_is_a_long_me
in python it is common to see naming
inconsistencies ,methods,modules,packages,classes with names in every
posible style:
thisisalongmethod
ThisIsALongMethod
thisIsALongMethod
this_is_a_long_method
and even This_Is_A_Long_Method
All over the place,even within one module!
classic static languages d
I was messing around in google looking for the available python form
validation modules when i found this:
http://www.jorendorff.com/articles/python/path/, and i realized that is very
similar to my python fileutils module,which encapsulate,path
operations,file operations,etc.
And those thoughts co
Fuzzyman wrote:
> Of course - sorry. Thanks for the fix. Out of interest - why are you
> using this... just for curiosity, or is it helpful ?
because is fun to surf on the google cache, =)
--
http://mail.python.org/mailman/listinfo/python-list
Fuzzyman wrote:
> Add the follwoing two lines to the start of the code :
>
> import urllib2
> txheaders = { 'User-agent' : 'Mozilla/4.0 (compatible; MSIE 6.0;
> Windows NT 5.1; SV1; .NET CLR 1.1.4322)' }
>
> Then change the start of the send_head method to this :
>
> def send_head(self):
>
it works on opera and firefox on linux, but you cant search in the cached
google! it would be more usefull if you could somehow search "only" in the
cache instead of putting the straight link. maybe you could put a magic url
to search in the cache, like search:"search terms"
[EMAIL PROTECTED] wrot
[EMAIL PROTECTED] wrote:
lol ,cool hack!! make a slashdot article about it!!
> I've hacked together a 'GoogleCacheServer'. It is based on
> SimpleHTTPServer. Run the following script (hopefully google groups
> won't mangle the indentation) and set your browser proxy settings to
> 'localhost:8000'
if i have a dictionary:
d = {'a':2,'b':3 }
l = (1,2)
how can i pass it to a generic function that takes variable keywords as
arguments? same thing with variable arguments, i need to pass a list of
arguments to the function
def asd(**kw): print kw
def efg(*arg): print arg
asd(d)
doesnt work
asd
Bengt Richter wrote:
> On Sat, 12 Mar 2005 18:19:36 -0400, vegetax <[EMAIL PROTECTED]> wrote:
>
>>Steven Bethard wrote:
>>
>>> vegetax wrote:
>>>> I i need a decorator that adds a local variable in the function it
>>>> decorates, probabl
thanks , i guess the best option is a callable class which builds the
functions with the common code. Once again,we REALLY need a patterns book
for python. =/
--
http://mail.python.org/mailman/listinfo/python-list
Steven Bethard wrote:
> vegetax wrote:
>> I i need a decorator that adds a local variable in the function it
>> decorates, probably related with nested scopes, for example:
>>
>> def dec(func):
>> def wrapper(obj = None):
>> if not
I i need a decorator that adds a local variable in the function it
decorates, probably related with nested scopes, for example:
def dec(func):
def wrapper(obj = None):
if not obj : obj = Obj()
return func()
return wrapper()
@dec()
def fun(b):
obj.desc = 'marked'
obj.
How can i use a counter inside the recursive function?
This code gives me the error 'local variable 'c' referenced before
assignment'
#!/usr/bin/python
from os import listdir
from os.path import isdir,join,basename
import HTMLgen
dirpath = '/devel/python/html/test'
COUNTER = 0
def rec(
Alexander Zatvornitskiy wrote:
> ?? vegetax!
>
> 03 ? 2005 ? 13:54, vegetax ? ? ?? ? All ?:
>
> v> I need this in order to print a directory tree with htmlgen library
> v> which uses nested lists to represent trees.
> As you see from output o
I am trying to make convert a directory "tree" in a list of list, but cant
find the algoritm =( ,for example a directory tree like :
+root
+doc
ele1
ele2
+doc3
ele3
+doc2
ele4
ele5
should convert into:
root[
doc,
[ele1,ele2,doc3,[ele3]],
doc2,
[ele4],
I am trying to make convert a directory "tree" in a list of list, but cant
find the algoritm =( ,for example a directory tree like :
+root
+doc
ele1
ele2
+doc3
ele3
+doc2
ele4
ele5
should convert into:
root[
doc,
[ele1,ele2,doc3,[ele3]],
doc2,
[ele4],
Steven Bethard wrote:
> vegetax wrote:
>> How can i make my custom class an element of a set?
>>
>> class Cfile:
>> def __init__(s,path): s.path = path
>>
>> def __eq__(s,other):
>>print 'inside equals'
>>return not os
Delaney, Timothy C (Timothy) wrote:
> vegetax wrote:
>
>> def __hashcode__(s): return s.path.__hashcode__()
>
> Try __hash__ ...
>
> Tim Delaney
sorry about the typo, it is indead __hash__() that i tried
--
http://mail.python.org/mailman/listinfo/python-list
How can i make my custom class an element of a set?
class Cfile:
def __init__(s,path): s.path = path
def __eq__(s,other):
print 'inside equals'
return not os.popen('cmp %s %s' % (s.path,other.path)).read()
def __hashcode__(s): return s.path.__hashcode__()
the idea is that it accepts
Hi i made a wrapper class for handling file and dir operations and i wonder,
whats the performance penalty for making such wrapper classes? is it ok to
make a lot of these wrappers? here it is:
#
import os
class File(object):
#access modes
F_OK = os.F_OK,
W_OK = os.
Hi i made a wrapper class for handling file and dir operations and i wonder,
whats the performance penalty for making such wrapper classes? here it is:
##
import os
class File(object):
#access modes
F_OK = os.F_OK,
W_OK = os.W_OK,
R_OK = os.R_OK,
I was a java developer one year ago ,before i moved to python i realy liked
it at the beggining, but i got very disapointed lately since my
previus two python proyects where relatively big,and python didnt feel
well suited for the task.
The reasons are mainly due to the standard library,the lan
28 matches
Mail list logo