Can ay one help me on pysvn , i want to capture the log and status of checkout call .....

2013-10-09 Thread bab mis

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Can ay one help me on pysvn , i want to capture the log and status of checkout call .....

2013-10-09 Thread bab mis
On Wednesday, October 9, 2013 11:39:04 AM UTC+5:30, bab mis wrote:
 

Here  is the code i am trying:



  2 from pysvn import wc_status_kind
  3 import pysvn
  4
import os, os.path
  6 import re
  7
  8 def createSVNClient():
  9 Create a pysvn client, and setup some callback and options.
 10 
 11
 12 def login(*args):
 13 return True, 'root', 'pass', False
 16
 17 client = pysvn.Client()
 18 client.set_interactive(True)
 19 client.callback_get_login = login
 20 return client
 21
 22 client = createSVNClient()

 23 link = http://demo.com/svn/trunk;
 24 path = '/tmp/ux'
 25 client.exception_style = 1
 26
 27 try:
 28 revision = client.checkout(link, path, recurse=True)





primary intention is

revision = client.checkout(link, path, recurse=True)

After this how can i check the exit code and capture the specific log that 
would have generated during this transaction of svn co command internally.
-- 
https://mail.python.org/mailman/listinfo/python-list


xml parsing as YML parser does does

2013-09-24 Thread bab mis
Hi ,
Here is an example how i do yml parsing and a proper pythonic object returns , 
is it possible in XML, tried lxml,dom, but there is no straight forward 
solution:

[root@linux-source pyrun]# cat x.yml
#Section for specifying test process information

Test: 

commoninfo: 
buildhome   : /root/linuxbuilds

 
Project:
default:

test_parameters:
svnuser: vmbuild
suite  : sanity
username   : root


Commands :
-   name   : generalcheck of destination
action : generalcheck

-   name   : retrieve source from svn
action : retsource
params : src=x,src1=y
[root@linux-source pyrun]



[root@linux-source pyrun]# cat a.py 
import yaml
fd = open(x.yml)
data = fd.read()
fd.close()
ydata = yaml.safe_load(data)
import pprint
pprint.pprint( ydata )

===


[root@linux-source pyrun]# python a.py 
{'Test': {'Project': {'default': {'Commands': [{'action': 'generalcheck',
'name': 'generalcheck of 
destination'},
   {'action': 'retsource',
'name': 'retrieve source from 
svn',
'params': 'src=x,src1=y'}],
  'test_parameters': {
  'suite': 'sanity',
  'svnuser': 'vmbuild',
  'username': 'root'}}},
  'commoninfo': {'buildhome': '/root/linuxbuilds'}}}
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: I want to print entry and exit message for functions , i have bunch of such function . How can i do it in decorator.

2013-09-22 Thread bab mis
On Friday, September 20, 2013 6:29:55 PM UTC+5:30, bab mis wrote:
 def fun:
 
 print entry
 
 .
 
 .
 
 print 


On Friday, September 20, 2013 6:29:55 PM UTC+5:30, bab mis wrote:
 def fun:
 
 print entry
 
 .
 
 .
 
 print exit



On Friday, September 20, 2013 6:29:55 PM UTC+5:30, bab mis wrote:
 def fun:
 
 print entry
 
 .
 
 .
 
 print exit




Peter couple of queries with following code :

def funlog(f):
def g(*args,**kw):
print enter, f.__name__
try:
return f(*args, **kw)
finally:
print exit, f.__name__
return g 

class Action:
def __init__(self):
pass

@funlog
def sret(self):
pass

@funlog
def ping(self):
pass
def verifyerun(self):
pass


1) funlog is called for the last function as well.
2) Is it a proper way to define decorator out of class and use it .
-- 
https://mail.python.org/mailman/listinfo/python-list


I want to print entry and exit message for functions , i have bunch of such function . How can i do it in decorator.

2013-09-20 Thread bab mis
def fun:
print entry
.
.
print exit
-- 
https://mail.python.org/mailman/listinfo/python-list


dynamic function parameters for **kwargs

2013-09-20 Thread bab mis
Hi ,
I have a function as below:

def func(**kwargs):
...
...




args=a='b',c='d'

i want to call func(args) so that my function call will take a var as an 
parameter.

it fails with an error typeError: fun() takes exactly 0 arguments (1 given) 

. Is there any other way to get the same.
-- 
https://mail.python.org/mailman/listinfo/python-list