fix bugs on schema field display
git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@2948 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
c9f34cd025
commit
8c9326149e
3 changed files with 11 additions and 6 deletions
|
@ -154,7 +154,7 @@ class FieldInstance(object):
|
|||
#return toStr(value)
|
||||
|
||||
def display(self, value):
|
||||
return value
|
||||
return value or u''
|
||||
#return toStr(value)
|
||||
|
||||
def unmarshall(self, value):
|
||||
|
|
|
@ -55,7 +55,10 @@ class Instance(BaseInstance):
|
|||
fi = f.getFieldInstance(self)
|
||||
name = f.name
|
||||
value = getattr(self.context, name) or fi.default
|
||||
value = (mode == 'view' and fi.display(value)) or fi.marshall(value)
|
||||
if mode == 'view':
|
||||
value = fi.display(value)
|
||||
else:
|
||||
value = fi.marshall(value)
|
||||
result[name] = value
|
||||
return result
|
||||
|
||||
|
|
|
@ -18,10 +18,12 @@ dataDir = os.path.join(os.path.dirname(media.__file__), 'testdata')
|
|||
def clearDataDir():
|
||||
for fn in os.listdir(dataDir):
|
||||
path = os.path.join(dataDir, fn)
|
||||
if os.path.isdir(path):
|
||||
for subfn in os.listdir(path):
|
||||
os.unlink(os.path.join(path, subfn))
|
||||
os.rmdir(path)
|
||||
if not fn.startswith('.'):
|
||||
if os.path.isdir(path):
|
||||
for subfn in os.listdir(path):
|
||||
if not subfn.startswith('.'):
|
||||
os.unlink(os.path.join(path, subfn))
|
||||
os.rmdir(path)
|
||||
|
||||
|
||||
class Test(unittest.TestCase):
|
||||
|
|
Loading…
Add table
Reference in a new issue