summaryrefslogtreecommitdiff
path: root/jsonrpclib/config.py
diff options
context:
space:
mode:
authorcatchjosh <catchjosh@ae587032-bbab-11de-869a-473eb4776397>2009-11-02 05:02:32 +0000
committercatchjosh <catchjosh@ae587032-bbab-11de-869a-473eb4776397>2009-11-02 05:02:32 +0000
commit669c1369c82b5dec6fd7952dce27a41ac1690b11 (patch)
treec3b6e61f3b1dd3482a8e5058a1e2d4a7f4118ad0 /jsonrpclib/config.py
parentccb16ea1a5f000b5014f562467056e788ff7eed4 (diff)
downloadjsonrpclib-669c1369c82b5dec6fd7952dce27a41ac1690b11.tar.gz
Oops -- NOW adding the new jsonrpclib/ files (jsonclass, config, history, __init__)
git-svn-id: http://jsonrpclib.googlecode.com/svn/trunk@13 ae587032-bbab-11de-869a-473eb4776397
Diffstat (limited to 'jsonrpclib/config.py')
-rw-r--r--jsonrpclib/config.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/jsonrpclib/config.py b/jsonrpclib/config.py
new file mode 100644
index 0000000..1f9d7d8
--- /dev/null
+++ b/jsonrpclib/config.py
@@ -0,0 +1,33 @@
+import sys
+
+class LocalClasses(dict):
+ def add(self, cls):
+ self[cls.__name__] = cls
+
+class Config(object):
+ """
+ This is pretty much used exclusively for the 'jsonclass'
+ functionality... set use_jsonclass to False to turn it off.
+ You can change serialize_method and ignore_attribute, or use
+ the local_classes.add(class) to include "local" classes.
+ """
+ use_jsonclass = True
+ # Change to False to keep __jsonclass__ entries raw.
+ serialize_method = '_serialize'
+ # The serialize_method should be a string that references the
+ # method on a custom class object which is responsible for
+ # returning a tuple of the constructor arguments and a dict of
+ # attributes.
+ ignore_attribute = '_ignore'
+ # The ignore attribute should be a string that references the
+ # attribute on a custom class object which holds strings and / or
+ # references of the attributes the class translator should ignore.
+ classes = LocalClasses()
+ # The list of classes to use for jsonclass translation.
+ version = 2.0
+ # Version of the JSON-RPC spec to support
+ user_agent = 'jsonrpclib/0.1 (Python %s)' % \
+ '.'.join([str(ver) for ver in sys.version_info[0:3]])
+ # User agent to use for calls.
+
+config = Config