Skip to content

Commit

Permalink
Added a __getstate__ that follows the _v_ rule, since document
Browse files Browse the repository at this point in the history
templates are sometimes pickled without subclassing
Persistence.Persistent.
  • Loading branch information
Jim Fulton committed Jul 12, 1999
1 parent 2e04c33 commit 6335f63
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion DT_String.py
Expand Up @@ -82,7 +82,7 @@
# attributions are listed in the accompanying credits file.
#
##############################################################################
"$Id: DT_String.py,v 1.29 1999/06/30 13:59:38 jim Exp $"
"$Id: DT_String.py,v 1.30 1999/07/12 17:24:53 jim Exp $"

from string import split, strip
import regex, ts_regex
Expand Down Expand Up @@ -510,6 +510,14 @@ def __call__(self,client=None,mapping={},**kw):
def __str__(self):
return self.read()

def __getstate__(self, _special=('_v_', '_p_')):
# Waaa, we need _v_ behavior but we may not subclass Persistent
d={}
for k, v in self.__dict__.items():
if k[:3] in _special: continue
d[k]=v
return d

class FileMixin:
# Mix-in class to abstract certain file-related attributes
edited_source=''
Expand Down

0 comments on commit 6335f63

Please sign in to comment.