Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix help() and repr()

  • Loading branch information...
commit 0fc758a2a77f543f7a72a8f3c2a28cc647b38a69 1 parent ff80e78
@florentx florentx authored
Showing with 11 additions and 4 deletions.
  1. +6 −0 CHANGES.rst
  2. +5 −4 erppeek.py
View
6 CHANGES.rst
@@ -2,6 +2,12 @@ Changelog
---------
+0.8 (UNRELEASED)
+~~~~~~~~~~~~~~~~
+
+* Fix help(client) and repr(...).
+
+
0.7 (2012-04-04)
~~~~~~~~~~~~~~~~
View
9 erppeek.py
@@ -223,13 +223,11 @@ def __getattr__(self, name):
if name in self._methods:
wrapper = lambda s, *args: s._ServerProxy__request(name, args)
wrapper.__name__ = name
- return wrapper.__get__(self)
+ return wrapper.__get__(self, type(self))
raise AttributeError("'Service' object has no attribute %r" % name)
class Client(object):
-
- _execute = None
_config_file = os.path.join(os.path.curdir, CONF_FILE)
def __init__(self, server, db, user, password=None):
@@ -238,6 +236,7 @@ def __init__(self, server, db, user, password=None):
self._environment = None
self.user = None
major_version = None
+ self._execute = None
def get_proxy(name):
if major_version in ('5.0', None):
@@ -536,13 +535,15 @@ def access(self, obj, mode='read'):
return False
def __getattr__(self, method):
+ if method.startswith('__'):
+ raise AttributeError("'Client' object has no attribute %r" % method)
# miscellaneous object methods
def wrapper(self, obj, *params, **kwargs):
"""Wrapper for client.execute(obj, %r, *params, **kwargs)."""
return self.execute(obj, method, *params, **kwargs)
wrapper.__name__ = method
wrapper.__doc__ %= method
- return wrapper.__get__(self)
+ return wrapper.__get__(self, type(self))
def _interact(use_pprint=True, usage=USAGE):
Please sign in to comment.
Something went wrong with that request. Please try again.