From 3c5dfb683d0818d11c3b8d5d07f3ad0e05bb8e62 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Fri, 22 Jun 2018 00:27:54 +0000 Subject: [PATCH 65/67] Python 3 preparation: avoid basestring. --- roundup/cgi/templating.py | 6 +++--- roundup/date.py | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/roundup/cgi/templating.py b/roundup/cgi/templating.py index b8b54c3..6216826 100644 --- a/roundup/cgi/templating.py +++ b/roundup/cgi/templating.py @@ -1857,7 +1857,7 @@ class DateHTMLProperty(HTMLProperty): ret = date.Date('.', translator=self._client) - if isinstance(str_interval, basestring): + if is_us(str_interval): sign = 1 if str_interval[0] == '-': sign = -1 @@ -1894,7 +1894,7 @@ class DateHTMLProperty(HTMLProperty): 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 @@ -2872,7 +2872,7 @@ env: %(env)s """ 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 = {} diff --git a/roundup/date.py b/roundup/date.py index 48a5390..79ed257 100644 --- a/roundup/date.py +++ b/roundup/date.py @@ -38,6 +38,7 @@ except NameError: 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 @@ class Interval: 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, -- 2.7.4