Merge "TraitText value restricted to max length 255"

This commit is contained in:
Jenkins 2015-06-03 13:47:17 +00:00 committed by Gerrit Code Review
commit 6405e63c2c
2 changed files with 4 additions and 3 deletions

View File

@ -121,6 +121,7 @@ class Trait(base.Model):
return float(value)
if trait_type is cls.DATETIME_TYPE:
return timeutils.normalize_time(timeutils.parse_isotime(value))
# Cropping the text value to match the TraitText value size
if isinstance(value, six.binary_type):
return value.decode('utf-8')
return six.text_type(value)
return value.decode('utf-8')[:255]
return six.text_type(value)[:255]

View File

@ -344,7 +344,7 @@ class TraitText(Base):
)
event_id = Column(Integer, ForeignKey('event.id'), primary_key=True)
key = Column(String(255), primary_key=True)
value = Column(Text)
value = Column(String(255))
class TraitInt(Base):