Commit 415b16b2 authored by Jérome Perrin's avatar Jérome Perrin

use a standard ERP5Type Property to manage preferences' priority



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@9221 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6e66ee69
......@@ -26,12 +26,18 @@
#
##############################################################################
class Preference :
class Preference:
"""
User Preference PropertySheet
"""
_properties = (
{ 'id' : 'priority',
'description' : 'Priority of the preference.',
'type' : 'int',
'default' : 3, # ( Priority.USER )
'mode' : 'w',
'write_permission': 'View management screens', },
{ 'id' : 'preferred_section_category',
'description' : 'The section category for documents; '\
'usually something like group/nexedi.',
......
......@@ -62,18 +62,3 @@ class Preference( Folder ):
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
def __init__(self, id) :
Folder.__init__(self, id)
self.priority = Priority.USER
security.declareProtected(Permissions.ViewManagementScreens, 'setPriority')
def setPriority(self, priority) :
""" Sets the priority of the preference"""
self.priority = priority
self.reindexObjectSecurity()
security.declareProtected(Permissions.View, 'getPriority')
def getPriority(self) :
""" Returns the priority of the preference """
return self.priority
......@@ -44,7 +44,7 @@ from Products.ERP5Form.Document.Preference import Priority
class TestPreferences(ERP5TypeTestCase):
quiet = 0
quiet = 1
run_all_tests = 1
def getTitle(self):
......@@ -60,12 +60,14 @@ class TestPreferences(ERP5TypeTestCase):
newSecurityManager(None, user)
self.createPreferences()
def beforeTearDown(self):
portal_preferences = self.getPreferenceTool()
portal_preferences.manage_delObjects(list(portal_preferences.objectIds()))
get_transaction().commit()
def createPreferences(self) :
""" create some preferences objects """
portal_preferences = self.getPreferenceTool()
if getattr(portal_preferences, 'person1', None) is not None :
portal_preferences.manage_delObjects([
'person1', 'person2', 'group', 'site'])
## create initial preferences
person1 = portal_preferences.newContent(
id='person1', portal_type='Preference')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment