[IMP]:Added new function called get_environment which will return the current environment of the System on which user is using OpenERP

bzr revid: nch@tinyerp.com-20090611112756-1r0t9202nqvj4oa6
This commit is contained in:
Naresh Choksy 2009-06-11 16:57:56 +05:30
parent 48a08c9923
commit ec71d4a68d
1 changed files with 33 additions and 12 deletions

View File

@ -352,6 +352,7 @@ class common(netsvc.Service):
self.exportMethod(self.timezone_get)
self.exportMethod(self.get_available_updates)
self.exportMethod(self.get_migration_scripts)
self.exportMethod(self.get_environment)
def ir_set(self, db, uid, password, keys, args, name, value, replace=True, isobject=False):
security.check(db, uid, password)
@ -504,6 +505,26 @@ GNU Public Licence.
l.notifyChannel('migration', netsvc.LOG_ERROR, tb_s)
raise
def get_environment(self,lang=False):
try:
if '.bzr' in os.listdir((os.getcwd()[0:-3])):
fp = open(os.path.join(os.getcwd()[0:-3],'.bzr/branch/last-revision'))
rev_no = fp.read()
else:
rev_no = 'Bazaar Not Installed !'
except:
rev_no = 'Bazaar Not Installed !'
if not lang:
lang = os.environ.get('LANG', '').split('.')[0]
environment = 'Environment_Information : \n' \
'Operating System : %s\n' \
'PlatForm : %s\n' \
'Operating System Version : %s\n' \
'Python Version : %s\n'\
'OpenERP-Server Version : %s\n'\
'OpenERP-Server Last Revision ID : %s'\
'Locale : %s'%(os.name,sys.platform,str(sys.version.split('\n')[1]),str(sys.version[0:5]),release.version,rev_no,lang)
return environment
common()
class objects_proxy(netsvc.Service):