more Python3 fixes: remove basestring, unicode
This commit is contained in:
parent
8d7cda5ec0
commit
14ea59a307
7 changed files with 12 additions and 46 deletions
|
@ -166,7 +166,7 @@ class ObjectForm(NodeView):
|
||||||
if field:
|
if field:
|
||||||
fi = field.getFieldInstance(self.instance)
|
fi = field.getFieldInstance(self.instance)
|
||||||
input = form[k]
|
input = form[k]
|
||||||
if isinstance(input, basestring):
|
if isinstance(input, str):
|
||||||
input = unquote_plus(input)
|
input = unquote_plus(input)
|
||||||
data[k] = fi.marshall(fi.unmarshall(input))
|
data[k] = fi.marshall(fi.unmarshall(input))
|
||||||
#data[k] = toUnicode(form[k])
|
#data[k] = toUnicode(form[k])
|
||||||
|
|
|
@ -100,7 +100,7 @@ class ResultsView(NodeView):
|
||||||
def parseLimitsParam(self, value):
|
def parseLimitsParam(self, value):
|
||||||
if not value:
|
if not value:
|
||||||
return None
|
return None
|
||||||
if isinstance(value, basestring):
|
if isinstance(value, str):
|
||||||
limits = value.split(',')
|
limits = value.split(',')
|
||||||
else:
|
else:
|
||||||
limits = value
|
limits = value
|
||||||
|
|
|
@ -1,23 +1,6 @@
|
||||||
#
|
# loops.expert.field
|
||||||
# Copyright (c) 2015 Helmut Merz helmutm@cy55.de
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
#
|
|
||||||
|
|
||||||
"""
|
""" Field definitions for reports.
|
||||||
Field definitions for reports.
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from zope.app.form.browser.interfaces import ITerms
|
from zope.app.form.browser.interfaces import ITerms
|
||||||
|
@ -210,7 +193,7 @@ class VocabularyField(Field):
|
||||||
if request is None:
|
if request is None:
|
||||||
request = row.parent.context.view.request
|
request = row.parent.context.view.request
|
||||||
voc = self.vocabulary
|
voc = self.vocabulary
|
||||||
if isinstance(voc, basestring):
|
if isinstance(voc, str):
|
||||||
terms = self.getVocabularyTerms(voc, context, request)
|
terms = self.getVocabularyTerms(voc, context, request)
|
||||||
if terms is not None:
|
if terms is not None:
|
||||||
return terms
|
return terms
|
||||||
|
|
|
@ -290,7 +290,7 @@ class SurveyView(InstitutionMixin, ConceptView):
|
||||||
result['average'] = int(round(average))
|
result['average'] = int(round(average))
|
||||||
result['stddev'] = int(round(stddev))
|
result['stddev'] = int(round(stddev))
|
||||||
texts = [r.texts.get(question) for r in self.teamData]
|
texts = [r.texts.get(question) for r in self.teamData]
|
||||||
result['texts'] = '<br />'.join([unicode(t) for t in texts if t])
|
result['texts'] = '<br />'.join([t for t in texts if t])
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def prefsResults(self, respManager, form, action):
|
def prefsResults(self, respManager, form, action):
|
||||||
|
|
|
@ -1,23 +1,6 @@
|
||||||
#
|
# loops.organize.tracking.browser
|
||||||
# Copyright (c) 2014 Helmut Merz helmutm@cy55.de
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
#
|
|
||||||
|
|
||||||
"""
|
""" View classes for tracks.
|
||||||
View classes for tracks.
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from zope import component
|
from zope import component
|
||||||
|
@ -82,7 +65,7 @@ class BaseTrackView(TrackView):
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
def userTitle(self):
|
def userTitle(self):
|
||||||
if isinstance(self.user, basestring):
|
if isinstance(self.user, str):
|
||||||
uid = self.user
|
uid = self.user
|
||||||
try:
|
try:
|
||||||
return self.authentication.getPrincipal(uid).title or uid
|
return self.authentication.getPrincipal(uid).title or uid
|
||||||
|
@ -93,7 +76,7 @@ class BaseTrackView(TrackView):
|
||||||
@Lazy
|
@Lazy
|
||||||
def userUrl(self):
|
def userUrl(self):
|
||||||
user = self.user
|
user = self.user
|
||||||
if user is not None and not isinstance(user, basestring):
|
if user is not None and not isinstance(user, str):
|
||||||
return '%s/@@introspector.html' % absoluteURL(user, self.request)
|
return '%s/@@introspector.html' % absoluteURL(user, self.request)
|
||||||
|
|
||||||
def getMetadataTarget(self, key):
|
def getMetadataTarget(self, key):
|
||||||
|
|
|
@ -141,7 +141,7 @@ def move(source, target, name):
|
||||||
commit()
|
commit()
|
||||||
|
|
||||||
def get(container, obj):
|
def get(container, obj):
|
||||||
if isinstance(obj, basestring):
|
if isinstance(obj, str):
|
||||||
name = obj
|
name = obj
|
||||||
obj = container.get(name)
|
obj = container.get(name)
|
||||||
if obj is None:
|
if obj is None:
|
||||||
|
|
|
@ -131,7 +131,7 @@ def getRowValue(k, v):
|
||||||
return v[0]
|
return v[0]
|
||||||
|
|
||||||
def getRowValueWithKey(k, v):
|
def getRowValueWithKey(k, v):
|
||||||
return u' '.join((unicode(k), v[0]))
|
return ' '.join((k, v[0]))
|
||||||
|
|
||||||
|
|
||||||
@implementer(IIterableSource)
|
@implementer(IIterableSource)
|
||||||
|
|
Loading…
Add table
Reference in a new issue