StyledTextTag.ranges is rather initialized as [] than None

in case it is not specifically set.


svn: r10444
This commit is contained in:
Zsolt Foldvari 2008-04-01 16:55:14 +00:00
parent f90bcd5b87
commit 42e91346ed

View File

@ -37,7 +37,9 @@ from gen.lib.styledtexttagtype import StyledTextTagType
class StyledTextTag(): class StyledTextTag():
"""Hold formatting information for StyledText. """Hold formatting information for StyledText.
@ivar name: Type or name of the tag instance. E.g. bold, etc. StyledTextTag is a container class, it's attributes are directly accessed.
@ivar name: Type (or name) of the tag instance. E.g. 'bold', etc.
@type name: L{gen.lib.StyledTextTagType} instace @type name: L{gen.lib.StyledTextTagType} instace
@ivar value: Value of the tag. E.g. color hex string for font color, etc. @ivar value: Value of the tag. E.g. color hex string for font color, etc.
@type value: str or None @type value: str or None
@ -49,7 +51,10 @@ class StyledTextTag():
"""Setup initial instance variable values.""" """Setup initial instance variable values."""
self.name = StyledTextTagType(name) self.name = StyledTextTagType(name)
self.value = value self.value = value
self.ranges = ranges if ranges is None:
self.ranges = []
else:
self.ranges = ranges
def serialize(self): def serialize(self):
"""Convert the object to a serialized tuple of data. """Convert the object to a serialized tuple of data.