psphere: how to make thread safe

2012-08-22 Thread sajuptpm
Hi, psphere: Python interface for the VMware vSphere Web Services SDK I already developed an app using https://bitbucket.org/jkinred/psphere. But getting lot of errors since psphere is not thread safe (I think). So i wrote couple of scripts to test it (See attached files) and found that caching

Unpaking Tuple

2012-10-06 Thread sajuptpm
Hi, I am using python 2.6. I need a way to make following code working without any ValueError . >>> a, b, c, d = (1,2,3,4) >>> a, b, c, d = (1,2,3). Note: Number of values in the tuple will change dynamically. I know in python 3, you can do `a, b, c, *d = (1, 2, 3)` and then d will contain an

I am facing an issue while decoding json string using json.loads

2012-12-25 Thread sajuptpm
I am facing an issue while decoding json string using json.loads(jstring). Its working, if i do json.dumps(eval(jstring)) before json.loads(jstring). I could not figure out the issue. I want to avoide use of "eval" here. ## Failing without json.dumps(eval(jstring)) def

Re: I am facing an issue while decoding json string using json.loads

2012-12-27 Thread sajuptpm
Hi, Fixed: = urllib.unquote is messing up the JSON. Reverse the order of unquote, and loads, i.e., do a json.loads on the original string, and then urllib.unquote the components that need unquote. Thanks, -- http://mail.python.org/mailman/listinfo/python-list

python: HTTP connections through a proxy server requiring authentication

2013-01-26 Thread sajuptpm
Hi, I followed http://dabase.com/blog/Minimal_squid3_proxy_configuration/ to setup proxy server. I tested my proxy server with firefox with IP:127.0.0.1 and Port:3128 and it working (asking for proxy username and password). But, i could not make http connection through proxy server requiring a

Re: python: HTTP connections through a proxy server requiring authentication

2013-01-26 Thread sajuptpm
Hi, /etc/squid3/squid.conf --- saju@saju-Inspiron-N5010:~$ cat squid.conf | grep ^[^#] auth_param digest program /usr/lib/squid3/digest_pw_auth -c /etc/squid3/passwords auth_param digest realm saju-Inspiron-N5010 acl manager proto cache_object acl localhost src 12

Re: Guide to: Learning Python Decorators

2012-02-09 Thread sajuptpm
Hi, Thanks for replay, I am looking for PDF version of same book. Please share if you can. http://www.amazon.com/gp/product/B006ZHJSIM/ref=as_li_tf_tl?ie=UTF8&tag=8012-20&linkCode=as2&camp=1789&creative=9325&creativeASIN=B006ZHJSIM -- http://mail.python.org/mailman/listinfo/python-list

log and figure out what bits are slow and optimize them.

2012-02-10 Thread sajuptpm
Hi, I want to log time taken to complete database requests inside a method/ function using decorator . is it possible I think, i have to inject log code inside the method/fuctions or modify it. I wrote a decorator to log taken by a method/function to complete it execution and its working wel

Re: log and figure out what bits are slow and optimize them.

2012-02-10 Thread sajuptpm
Hi, Yes i saw profile module, I think i have to do function call via cProfile.run('foo()') I know, we can debug this way. But, i need a fixed logging system and want to use it in production. I think, we can't permanently include profile's debugging code in source code, will cause any

ldap proxy user bind

2012-02-10 Thread sajuptpm
I have developed a LDAP auth system using python-ldap module. Using that i can validate username and password, fetch user and groups info from LDAP directory. Now i want to implement ldap proxy user bind to the ldap server. I googled and find this http://ldapwiki.willeke.com/wiki/LDAPProxyUser But

Re: log and figure out what bits are slow and optimize them.

2012-02-10 Thread sajuptpm
I decided to create a decorator like. import cProfile def debug_time(method): def timed(*args, **kw): prof = cProfile.Profile() prof.enable(subcalls=False, builtins=False) result = prof.runcall(method, *args, **kw) #prof.print_stats() msg = "\n\n\n\n###

Re: ldap proxy user bind

2012-02-11 Thread sajuptpm
Hi Michael Torrie, Thanks to reply Why we need Twisted here, i did not get it. My understanding is that if ldap_proxy_user = ldap_proxy ldap_proxy_pwd = secret ( set more privileges to this user at ldap server side, for get other users infos) are configured at server side, then allow clients to l

RuntimeWarning: Unable to load template engine entry point

2012-04-26 Thread sajuptpm
Hi, I am using Ubuntu 12.04 precise Python 2.7 turbogears 2.0.3 Getting following errors when doing turbogears setup. Have any way to fix this without upgrade to turbogears 2.0.4. Using /home/saju/cmt-enterprise/tg2env/lib/python2.7/site-packages/ BytecodeAssembler-0.3-py2.7.egg Searching for

Re: RuntimeWarning: Unable to load template engine entry point

2012-04-27 Thread sajuptpm
Issue get solved by updating following packages $ easy_install -U DecoratorTools $ easy_install -U turbojson -- http://mail.python.org/mailman/listinfo/python-list

LDAP: How get all users belongs to a group.

2011-06-23 Thread sajuptpm
Hi, How get all users belongs to a group using python ldap module. -- http://mail.python.org/mailman/listinfo/python-list

Re: LDAP: How get all users belongs to a group.

2011-06-24 Thread sajuptpm
Hi, Thanks for reply. dn: cn=My-Group-1, ou=Groups, o=CUST equivalentToMe: cn=TDS7034,ou=Internal PCA,o=CUST objectClass: groupOfNames < objectClass: top objectClass: swarePointers ACL: 2#entry#[Root]#member cn: My-Group-1 member: cn=AJP2203,ou=Internal PCA,o=CUST member: cn=AZE9632,o

Re: LDAP: How get all users belongs to a group.

2011-06-24 Thread sajuptpm
I am using Openldap (openldap 2.3.43-12.el5_5.2 and openldap.i386 0:2.3.43_2.2.29-12.el5_6.7) -- http://mail.python.org/mailman/listinfo/python-list

Re: LDAP: How get all users belongs to a group.

2011-06-24 Thread sajuptpm
--- User cn=AJP2203,ou=Internal PCA,o=CUST has group memberships to the following Groups: groupMembership: cn=My-Group-1,ou=Groups,o=CUST groupMembership: cn=My-Group-2,u=Groups,o=CUST groupMembership: cn=My-Group-3,ou=Groups,o=CUST

Re: LDAP: How get all users belongs to a group.

2011-06-25 Thread sajuptpm
results = ldapClient.search_s("cn=My-Group-1,ou=Groups,o=CUST", ldap.SCOPE_BASE) Is this method work for all types of groups (groupOfNames, posixGroup) ??? have to implement user search/fetch separately for each groups ??? -- http://mail.python.org/mailman/listinfo/python-list

Change Location in the google search page

2011-09-15 Thread sajuptpm
Hi, I want to open Google search page and Change the Location link in the left hand nav of Google) from the users current location to a different location, then return the results of the updated search. I tried to change google search location through http://www.google.co.in/preferences?hl=en#loc

selenium pyvirtualdisplay script on remote server

2011-10-05 Thread sajuptpm
Hi Friends, Here the isuue is i can't find the "li" element. that is because that element is out of display, so i adjust scroll bar or do focus around that area to get that element via find_element_by_id("loc_opt") I already tested with scroll bar and focus and its working fine in my laptop. But

Documentation using Sphinx

2011-12-08 Thread sajuptpm
Hi, I am trying source code documentation using Sphinx. Here i have to copy paste all modules in to *.rst file, that is painful. Have any way to create documentation (doc for all modules, classes and methods in the project directory) from project folder quickly. I also plannig to add a code browsin

Secure LDAP Configuration

2010-08-12 Thread sajuptpm
I want to create an LDAP database for my company with following settings. Only the ldap user belongs to my company can search and view ldap entries I want to protect ldap user belongs to my company One ldap user can't search and view others details Only allow ldap u

list of tuples with dynamic change in position

2010-09-06 Thread sajuptpm
I have a list of tuples l = [(('s','a'),(5,9)), (('u','w'),(9,2)), (('y','x'),(3,0))] some functions using this list and fetch data using index l[0][1], l[1] [1] I need to change position of each values in the list and that dont affect fuctions which are using this list. I must have to use list of

Re: list of tuples with dynamic change in position

2010-09-06 Thread sajuptpm
I have a list of tuples l = [(('s','a'),(5,9)), (('u','w'),(9,2)), (('y','x'),(3,0))] and postion of values in the tuple change dynamicaly. I need a way to access correct value even if change in position. -- http://mail.python.org/mailman/listinfo/python-list

Re: list of tuples with dynamic change in position

2010-09-06 Thread sajuptpm
More details I have a list of tuples l = [((cpu_util,mem_util),(disk_util)), ((cpu_util,mem_util),(disk_util))] ie, l = [((30,50),(70)), ((50,20),(20))] l.sort(key=lambda x:(-x[0][0], x[1][0])) # sorting cpu_util asc and disk_util desc suppose i changed order that is l = [((mem_util,cpu_util), (d

Re: list of tuples with dynamic change in position

2010-09-07 Thread sajuptpm
On Sep 7, 1:16 pm, Ulrich Eckhardt wrote: > sajuptpm wrote: > > I have a list of tuples l = [((cpu_util,mem_util),(disk_util)), > > ((cpu_util,mem_util),(disk_util))] > > ie, l = [((30,50),(70)), ((50,20),(20))] > > > l.sort(key=lambda x:(-x[0][0], x[1][0]))

another way to sort like l.sort(key=lambda x:(x[0][0], -x[1][0]))

2010-09-07 Thread sajuptpm
I have a list of tuples. l = [((30,50),(70)), ((50,20),(20))] for i in range(10): k = ((i+30,i+50),(i+70))#suppose creating new tuple in each iteration using some random value and in sert it into list. flag=True for i, v in enumerate(l): if v >= k:

Re: another way to sort like l.sort(key=lambda x:(x[0][0], -x[1][0]))

2010-09-07 Thread sajuptpm
On Sep 7, 7:03 pm, Peter Otten <__pete...@web.de> wrote: > sajuptpm wrote: > > i need to implement  l.sort(key=lambda x:(x[0][0], -x[1][0])) in > > another way .I want to know what the modification needed in the 'if' > > check to sort this list of t

Re: another way to sort like l.sort(key=lambda x:(x[0][0], -x[1][0]))

2010-09-07 Thread sajuptpm
Detailed Description - l1 = [] l2 = [ ((3,8),(1,2)), ((1,3),(1,7)), ((7,0),(1,8)), ((4,2),(1,2)), ((2,9),(9,1)) ] I need to take each item from l2 and insert into l1 with first element(column)(3,1,7,4,2) sorted in ascending order and second element(column)(8,3,0,2,9) so