From: Martin A. <opt...@us...> - 2005-02-07 17:40:10
|
Update of /cvsroot/collective/PloneHelpCenter/types In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5485/types Modified Files: PHCContent.py schemata.py Log Message: Fix of importance vocab, to ensure default value works properly. Index: schemata.py =================================================================== RCS file: /cvsroot/collective/PloneHelpCenter/types/schemata.py,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- schemata.py 7 Feb 2005 17:22:06 -0000 1.23 +++ schemata.py 7 Feb 2005 17:39:58 -0000 1.24 @@ -17,7 +17,7 @@ ImportanceSchema = Schema(( StringField('importance', required=1, - default='getImportanceDefault', + default_method="getDefaultImportance", index='KeywordIndex:schema', vocabulary='getImportanceVocab', widget=SelectionWidget( @@ -273,6 +273,7 @@ StringField('defaultImportance', required=1, + enforceVocabulary=1, default=IMPORTANCE_DEFAULT, vocabulary='getImportance_vocab', widget=SelectionWidget( Index: PHCContent.py =================================================================== RCS file: /cvsroot/collective/PloneHelpCenter/types/PHCContent.py,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- PHCContent.py 7 Feb 2005 17:22:06 -0000 1.9 +++ PHCContent.py 7 Feb 2005 17:39:57 -0000 1.10 @@ -100,3 +100,13 @@ return objs else: return None + + def getDefaultImportance(self): + """Get the default importance level, set on the root PHC object""" + if hasattr (self.aq_parent, 'getDefaultImportance'): + return self.aq_parent.getDefaultImportance () + else: + # XXX: This is here to fall back gracefully if we are in a + # PloneSoftwareCenter project where we don't have a dynamic + # importance vocab. + return IMPORTANCE_DEFAULT \ No newline at end of file |