Mercurial > p > roundup > code
changeset 5438:e2382945d302
Python 3 preparation: avoid basestring.
| author | Joseph Myers <jsm@polyomino.org.uk> |
|---|---|
| date | Wed, 25 Jul 2018 11:42:51 +0000 |
| parents | a1971da1c5da |
| children | b00cd44fea16 |
| files | roundup/cgi/templating.py roundup/date.py |
| diffstat | 2 files changed, 5 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/roundup/cgi/templating.py Wed Jul 25 11:42:02 2018 +0000 +++ b/roundup/cgi/templating.py Wed Jul 25 11:42:51 2018 +0000 @@ -1859,7 +1859,7 @@ ret = date.Date('.', translator=self._client) - if isinstance(str_interval, basestring): + if is_us(str_interval): sign = 1 if str_interval[0] == '-': sign = -1 @@ -1896,7 +1896,7 @@ if default is None: raw_value = None else: - if isinstance(default, basestring): + if is_us(default): raw_value = date.Date(default, translator=self._client) elif isinstance(default, date.Date): raw_value = default @@ -2874,7 +2874,7 @@ """ q = urllib_.quote sc = self.special_char - l = ['%s=%s'%(k,isinstance(v, basestring) and q(v) or v) + l = ['%s=%s'%(k,is_us(v) and q(v) or v) for k,v in args.items() if v != None ] # pull out the special values (prefixed by @ or :) specials = {}
--- a/roundup/date.py Wed Jul 25 11:42:02 2018 +0000 +++ b/roundup/date.py Wed Jul 25 11:42:51 2018 +0000 @@ -38,6 +38,7 @@ return (a > b) - (a < b) from roundup import i18n +from roundup.anypy.strings import is_us # no, I don't know why we must anchor the date RE when we only ever use it # in a match() @@ -765,7 +766,7 @@ arith_types = (int, float) if isinstance(spec, arith_types): self.from_seconds(spec) - elif isinstance(spec, basestring): + elif is_us(spec): self.set(spec, allowdate=allowdate, add_granularity=add_granularity) elif isinstance(spec, Interval): (self.sign, self.year, self.month, self.day, self.hour,
