summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c3705d8)
raw | patch | inline | side by side (parent: c3705d8)
| author | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
| Tue, 18 Feb 2003 01:57:39 +0000 (01:57 +0000) | ||
| committer | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
| Tue, 18 Feb 2003 01:57:39 +0000 (01:57 +0000) |
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1520 57a73879-2fb5-44c3-a270-3262357dd7e2
index 1971ccade4254cd4a81a29da76f441e07a960de6..ab7c06ac9cd0cbf39f7478e1e653b6bf1de103c1 100644 (file)
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-#$Id: back_anydbm.py,v 1.103 2003-02-14 00:31:44 richard Exp $
+#$Id: back_anydbm.py,v 1.104 2003-02-18 01:57:38 richard Exp $
'''
This module defines a backend that saves the hyperdatabase in a database
chosen by anydbm. It is guaranteed to always be available in python
for react in self.reactors[action]:
react(self.db, self, nodeid, oldvalues)
-class FileClass(Class):
+class FileClass(Class, hyperdb.FileClass):
'''This class defines a large chunk of data. To support this, it has a
mandatory String property "content" which is typically saved off
externally to the hyperdb.
index 9e5a8b88298de75f4c1f24be06e2db532e3a63d3..91a59343127189cc2ad17c778a286f3a5cccb4d0 100755 (executable)
hyperdb.Boolean : 'I',
hyperdb.Number : 'I',
}
-class FileClass(Class):
+class FileClass(Class, hyperdb.FileClass):
''' like Class but with a content property
'''
default_mime_type = 'text/plain'
index 1fa6cd85d2c3e0064cc04c67ed0e7f376800a138..e663a19207a942658210323826095888822f0f33 100644 (file)
-# $Id: rdbms_common.py,v 1.33 2003-02-14 00:31:45 richard Exp $
+# $Id: rdbms_common.py,v 1.34 2003-02-18 01:57:39 richard Exp $
''' Relational database (SQL) backend common code.
Basics:
for react in self.reactors[action]:
react(self.db, self, nodeid, oldvalues)
-class FileClass(Class):
+class FileClass(Class, hyperdb.FileClass):
'''This class defines a large chunk of data. To support this, it has a
mandatory String property "content" which is typically saved off
externally to the hyperdb.
diff --git a/roundup/cgi/client.py b/roundup/cgi/client.py
index 3559e75d2975c532ed27348ffb8aca2f651af6b9..b4c91b8573869f2d3b9a7dd23eb8339b0f6f55cf 100644 (file)
--- a/roundup/cgi/client.py
+++ b/roundup/cgi/client.py
-# $Id: client.py,v 1.89 2003-02-17 06:44:00 richard Exp $
+# $Id: client.py,v 1.90 2003-02-18 01:57:39 richard Exp $
__doc__ = """
WWW request handler (also used in the stand-alone server).
:file - create a file, attach to the current item and any
message created by :note. This is ALWAYS designated
"file-1".
+
+ We also check that FileClass items have a "content" property with
+ actual content, otherwise we remove them from all_props before
+ returning.
'''
# some very useful variables
db = self.db
if s:
raise ValueError, '\n'.join(s)
+ # check that FileClass entries have a "content" property with
+ # content, otherwise remove them
+ for (cn, id), props in all_props.items():
+ cl = self.db.classes[cn]
+ if not isinstance(cl, hyperdb.FileClass):
+ continue
+ if not props.get('content', ''):
+ del all_props((cn, id))
+
return all_props, all_links
def fixNewlines(text):
diff --git a/roundup/hyperdb.py b/roundup/hyperdb.py
index 56f7ab0cc06dfc590073e5b4942606151fb6e42a..52c9accf7659747e30f0608cb2f98aabf3a2d94c 100644 (file)
--- a/roundup/hyperdb.py
+++ b/roundup/hyperdb.py
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-# $Id: hyperdb.py,v 1.84 2002-10-07 00:52:51 richard Exp $
+# $Id: hyperdb.py,v 1.85 2003-02-18 01:57:38 richard Exp $
"""
Hyperdatabase implementation, especially field types.
'''
raise NotImplementedError
+class FileClass:
+ ''' A class that requires the "content" property and stores it on
+ disk.
+ '''
+ pass
+
class Node:
''' A convenience wrapper for the given node
'''