[gen] Binary files stored in fields appy.fields.File are now stored outside the ZODB, on the filesystem; Ref fields can now also be rendered as dropdown menus: every menu represents a coherent group of link

ed objects. The main menu entry can be textual or an icon; computed fields are by default rendered in view and cell layouts.
This commit is contained in:
Gaetan Delannay 2014-02-26 10:40:27 +01:00
parent b9dcc94bdb
commit be145be254
12 changed files with 522 additions and 313 deletions

View file

@ -36,7 +36,7 @@ class UnmarshalledFile:
def __init__(self):
self.name = '' # The name of the file on disk
self.mimeType = None # The MIME type of the file
self.content = '' # The binary content of the file of a file object
self.content = '' # The binary content of the file or a file object
self.size = 0 # The length of the file in bytes.
class UnicodeBuffer:

View file

@ -23,6 +23,7 @@ sequenceTypes = (list, tuple)
# ------------------------------------------------------------------------------
class FolderDeleter:
@staticmethod
def delete(dirName):
'''Recursively deletes p_dirName.'''
dirName = os.path.abspath(dirName)
@ -32,7 +33,19 @@ class FolderDeleter:
for name in dirs:
os.rmdir(os.path.join(root, name))
os.rmdir(dirName)
delete = staticmethod(delete)
@staticmethod
def deleteEmpty(dirName):
'''Deletes p_dirName and its parent dirs if they are empty.'''
while True:
try:
if not os.listdir(dirName):
os.rmdir(dirName)
dirName = os.path.dirname(dirName)
else:
break
except OSError, oe:
break
# ------------------------------------------------------------------------------
extsToClean = ('.pyc', '.pyo', '.fsz', '.deltafsz', '.dat', '.log')