Commit 97ba45fb authored by Arnaud Fontaine's avatar Arnaud Fontaine

Rename version_priority ERP5Site property to version_priority_list.

parent 854bc009
...@@ -444,28 +444,29 @@ class ERP5Site(FolderMixIn, CMFSite, CacheCookieMixin): ...@@ -444,28 +444,29 @@ class ERP5Site(FolderMixIn, CMFSite, CacheCookieMixin):
return self.title return self.title
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getVersionPriority') 'getVersionPriorityList')
def getVersionPriority(self): def getVersionPriorityList(self):
# Whatever happens, a version must always be returned otherwise it may # Whatever happens, a version must always be returned otherwise it may
# render the site unusable when all Products will have been migrated # render the site unusable when all Products will have been migrated
if not self._version_priority: if not self._version_priority_list:
return ('erp5',) return ('erp5',)
return self._version_priority return self._version_priority_list
security.declareProtected(Permissions.ModifyPortalContent, security.declareProtected(Permissions.ModifyPortalContent,
'setVersionPriority' ) 'setVersionPriorityList' )
def setVersionPriority(self, value): def setVersionPriorityList(self, value):
""" """
XXX-arnau: must be written through an interaction workflow when ERP5Site XXX-arnau: must be written through an interaction workflow when ERP5Site
will become a real ERP5 object... will become a real ERP5 object...
""" """
self._version_priority = value self._version_priority_list = value
if not getattr(self, '_v_bootstrapping', False): if not getattr(self, '_v_bootstrapping', False):
self.portal_components.resetOnceAtTransactionBoundary() self.portal_components.resetOnceAtTransactionBoundary()
version_priority = property(getVersionPriority, setVersionPriority) version_priority_list = property(getVersionPriorityList,
setVersionPriorityList)
security.declareProtected(Permissions.AccessContentsInformation, 'getUid') security.declareProtected(Permissions.AccessContentsInformation, 'getUid')
def getUid(self): def getUid(self):
...@@ -1695,7 +1696,7 @@ class ERP5Generator(PortalGenerator): ...@@ -1695,7 +1696,7 @@ class ERP5Generator(PortalGenerator):
# Return the fully wrapped object. # Return the fully wrapped object.
p = parent.this()._getOb(id) p = parent.this()._getOb(id)
p._setProperty('version_priority', ('erp5',), 'lines') p._setProperty('version_priority_list', ('erp5',), 'lines')
erp5_sql_deferred_connection_string = erp5_sql_connection_string erp5_sql_deferred_connection_string = erp5_sql_connection_string
p._setProperty('erp5_catalog_storage', p._setProperty('erp5_catalog_storage',
......
...@@ -123,7 +123,7 @@ ...@@ -123,7 +123,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python: [(v, v) for v in here.getPortalObject().getVersionPriority()]</string> </value> <value> <string>python: [(v, v) for v in here.getPortalObject().getVersionPriorityList()]</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -108,7 +108,7 @@ ...@@ -108,7 +108,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python: here.getPortalObject().getVersionPriority()</string> </value> <value> <string>python: here.getPortalObject().getVersionPriorityList()</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
2012-02-28 arnaud.fontaine
* Rename version_priority ERP5Site property to version_priority_list.
2012-02-28 arnaud.fontaine 2012-02-28 arnaud.fontaine
* Use a ListField for version and proxify error messages field in Component view. * Use a ListField for version and proxify error messages field in Component view.
......
41014 41015
\ No newline at end of file \ No newline at end of file
...@@ -103,7 +103,7 @@ class ComponentDynamicPackage(ModuleType): ...@@ -103,7 +103,7 @@ class ComponentDynamicPackage(ModuleType):
except AttributeError: except AttributeError:
return {} return {}
version_priority_set = set(portal.getVersionPriority()) version_priority_set = set(portal.getVersionPriorityList())
# contentValues should not be used for a large number of objects, but # contentValues should not be used for a large number of objects, but
# this is only done at startup or upon reset, moreover using the Catalog # this is only done at startup or upon reset, moreover using the Catalog
...@@ -155,7 +155,7 @@ class ComponentDynamicPackage(ModuleType): ...@@ -155,7 +155,7 @@ class ComponentDynamicPackage(ModuleType):
# wrongly considered as importable and thus the actual filesystem class # wrongly considered as importable and thus the actual filesystem class
# ignored # ignored
elif (name not in self._registry_dict and elif (name not in self._registry_dict and
name.replace('_version', '') not in site.getVersionPriority()): name.replace('_version', '') not in site.getVersionPriorityList()):
return None return None
return self return self
...@@ -182,7 +182,7 @@ class ComponentDynamicPackage(ModuleType): ...@@ -182,7 +182,7 @@ class ComponentDynamicPackage(ModuleType):
component_name = fullname.replace(self._namespace_prefix, '') component_name = fullname.replace(self._namespace_prefix, '')
if component_name.endswith('_version'): if component_name.endswith('_version'):
version = component_name.replace('_version', '') version = component_name.replace('_version', '')
return (version in site.getVersionPriority() and return (version in site.getVersionPriorityList() and
self._getVersionPackage(version) or None) self._getVersionPackage(version) or None)
component_id_alias = None component_id_alias = None
...@@ -211,7 +211,7 @@ class ComponentDynamicPackage(ModuleType): ...@@ -211,7 +211,7 @@ class ComponentDynamicPackage(ModuleType):
return None return None
for version in site.getVersionPriority(): for version in site.getVersionPriorityList():
component = component_version_dict.get(version, None) component = component_version_dict.get(version, None)
if component is not None: if component is not None:
break break
......
...@@ -1589,9 +1589,9 @@ def bar(*args, **kwargs): ...@@ -1589,9 +1589,9 @@ def bar(*args, **kwargs):
from Products.ERP5.ERP5Site import getSite from Products.ERP5.ERP5Site import getSite
site = getSite() site = getSite()
ComponentTool.reset = assertResetCalled ComponentTool.reset = assertResetCalled
priority_tuple = site.getVersionPriority() priority_tuple = site.getVersionPriorityList()
try: try:
site.setVersionPriority(('foo',) + priority_tuple) site.setVersionPriorityList(('foo',) + priority_tuple)
transaction.commit() transaction.commit()
self.tic() self.tic()
...@@ -1607,7 +1607,7 @@ def bar(*args, **kwargs): ...@@ -1607,7 +1607,7 @@ def bar(*args, **kwargs):
finally: finally:
ComponentTool.reset = ComponentTool._original_reset ComponentTool.reset = ComponentTool._original_reset
site.setVersionPriority(priority_tuple) site.setVersionPriorityList(priority_tuple)
transaction.commit() transaction.commit()
self.tic() self.tic()
......
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