From eec7cd398cf404de874980518ccf46b0f7db00e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Legan=C3=A9s=20Combarro=20=22Piranna=22?= Date: Fri, 3 Feb 2012 14:32:06 +0100 Subject: Change all internal use of to_unicode() to __unicode__() and marked former one as deprecated. --- sqlparse/sql.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'sqlparse/sql.py') diff --git a/sqlparse/sql.py b/sqlparse/sql.py index 244733b..d077c1d 100644 --- a/sqlparse/sql.py +++ b/sqlparse/sql.py @@ -31,10 +31,14 @@ class Token(object): short, id(self)) def __unicode__(self): + """Returns a unicode representation of this object.""" return self.value or '' def to_unicode(self): - """Returns a unicode representation of this object.""" + """Returns a unicode representation of this object. + + @deprecated: please use __unicode__() + """ return unicode(self) def _get_repr_name(self): @@ -333,8 +337,7 @@ class TokenList(Token): alias = next_ if isinstance(alias, Identifier): return alias.get_name() - else: - return alias.to_unicode() + return unicode(alias) def get_name(self): """Returns the name of this identifier. @@ -420,7 +423,7 @@ class Identifier(TokenList): next_ = self.token_next(self.token_index(marker), False) if next_ is None: return None - return next_.to_unicode() + return unicode(next_) class IdentifierList(TokenList): -- cgit v1.2.1