Commit 54740503 authored by Jim Fulton's avatar Jim Fulton

Simplified TransactionMetaData and added a deprecation warning for _extension

parent 14613505
......@@ -1289,31 +1289,17 @@ size.
class TransactionMetaData(object):
def __init__(self, user=u'', description=u'', extension=b''):
self.user = user
self.description = description
if not isinstance(extension, dict):
extension = _compat.loads(extension) if extension else {}
self.extension = extension
@property
def user(self):
return self.__user
@user.setter
def user(self, user):
if not isinstance(user, bytes):
user = user.encode('utf-8')
self.__user = user
@property
def description(self):
return self.__description
self.user = user
@description.setter
def description(self, description):
if not isinstance(description, bytes):
description = description.encode('utf-8')
self.__description = description
self.description = description
if not isinstance(extension, dict):
extension = _compat.loads(extension) if extension else {}
self.extension = extension
def note(self, text): # for tests
text = text.strip()
......@@ -1324,13 +1310,12 @@ class TransactionMetaData(object):
else:
self.description = text
@property
def extension(self):
return self.__extension
@extension.setter
def extension(self, v):
self.__extension = v
_extension = extension
def _extension(self):
warnings.warn("_extension is deprecated, use extension",
DeprecationWarning)
return self.extension
@_extension.setter
def _extension(self, v):
self.extension = v
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