Merge branch 'master' of git@github.com:rmehta/wnframework

This commit is contained in:
nabinhait 2011-07-04 17:26:31 +05:30
commit 691e22e046
3 changed files with 17 additions and 9 deletions

0
cgi-bin/getjsfile.cgi Normal file → Executable file
View file

View file

@ -236,9 +236,6 @@ class Document:
# ---------------------------------------------------------------------------
def _makenew(self, autoname, istable, case='', make_autoname=1):
# set owner
if not self.owner: self.owner = webnotes.session['user']
# set name
if make_autoname:
self._set_name(autoname, istable)
@ -247,7 +244,10 @@ class Document:
self._validate_name(case)
# insert!
webnotes.conn.sql("""insert into `tab%s` (name, owner, creation, modified, modified_by) values ('%s', '%s', '%s', '%s', '%s')""" % (self.doctype, self.name, webnotes.session['user'], now(), now(), webnotes.session['user']))
self.owner = self.modified_by = webnotes.session['user']
self.creation = self.modified = now()
webnotes.conn.sql("""insert into `tab%(doctype)s` (name, owner, creation, modified, modified_by)
values ('%(name)s', '%(owner)s', '%(creation)s', '%(modified)s', '%(modified_by)s')""" % self.fields)
# Update Values

View file

@ -41,8 +41,8 @@ class FrameworkServer:
webnotes.msgprint(ret)
raise Exception, e
if ret.get('message') and ret.get('message')!='Logged In':
raise Exception, ret.get('message')
if 'message' in ret and ret['message']!='Logged In':
webnotes.msgprint(ret.get('server_messages'), raise_exception=1)
if ret.get('exc'):
raise Exception, ret.get('exc')
@ -90,13 +90,14 @@ class FrameworkServer:
"""
Returns the response of a remote method called on a system object specified by `doctype` and `docname`
"""
import json
res = self.http_get_response('runserverobj', args = {
'doctype':doctype
,'docname':docname
,'method':method
,'arg':arg
})
ret = eval(res.read())
ret = json.loads(res.read())
if ret.get('exc'):
raise Exception, ret.get('exc')
return ret
@ -104,8 +105,15 @@ class FrameworkServer:
# -----------------------------------------------------------------------------------------
def run_method(self, method, args={}):
res = self.http_get_response(method, args)
ret = eval(res.read())
"""
Run a method on the remote server
"""
res = self.http_get_response(method, args).read()
import json
try:
ret = json.loads(res)
except Exception, e:
webnotes.msgprint('Bad Response: ' + res, raise_exception=1)
if ret.get('exc'):
raise Exception, ret.get('exc')
return ret