Commit 74188108 authored by Hanno Schlichting's avatar Hanno Schlichting

Removed unused rPickly module

parent 360d8872
##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
##############################################################################
"""Restricted unpickler
"""
import pickle
reg={}
class Unpickler(pickle.Unpickler):
def find_class(self, module, name):
try: return reg[(module,name)]
except: raise SystemError, 'Class not registered'
def load_string(self):
raise pickle.UnpicklingError, 'Bad pickle: Non binstring'
# Public interface
from cStringIO import StringIO
def loads(s):
"""Unpickle a string"""
return Unpickler(StringIO(s)).load()
def register(mod, cls, obj):
"""Register a class"""
reg[(mod,cls)]=obj
def unregister(mod, cls):
"""Unregister a class"""
del reg[(mod,cls)]
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment