diff options
author | Jesús Leganés Combarro "Piranna" <piranna@gmail.com> | 2012-02-03 14:32:06 +0100 |
---|---|---|
committer | Jesús Leganés Combarro "Piranna" <piranna@gmail.com> | 2012-02-03 14:32:06 +0100 |
commit | eec7cd398cf404de874980518ccf46b0f7db00e8 (patch) | |
tree | dd71e464766dfc2e52b97913f586176ed8a9636e /sqlparse/sql.py | |
parent | a911e95665b303a898d6e2de44a1327c0c271c8f (diff) | |
download | sqlparse-eec7cd398cf404de874980518ccf46b0f7db00e8.tar.gz |
Change all internal use of to_unicode() to __unicode__() and marked former one as deprecated.
Diffstat (limited to 'sqlparse/sql.py')
-rw-r--r-- | sqlparse/sql.py | 11 |
1 files changed, 7 insertions, 4 deletions
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): |