diff --git a/product/ERP5/Document/BusinessTemplate.py b/product/ERP5/Document/BusinessTemplate.py index 2500bbe4a8429cd283f7a8e09c1aa0d5e46a9091..3b7479b69fc5baf040a6b27947a5410037a031d0 100644 --- a/product/ERP5/Document/BusinessTemplate.py +++ b/product/ERP5/Document/BusinessTemplate.py @@ -1763,6 +1763,116 @@ class RegisteredSkinSelectionTemplateItem(BaseTemplateItem): skin_selection_dict[skin_folder_id] = selection_list self._objects = skin_selection_dict +class RegisteredVersionPrioritySelectionTemplateItem(BaseTemplateItem): + def _fillObjectDictFromArchive(self): + for version_priority in self._archive: + try: + version, priority = version_priority.split('|') + priority = float(priority) + except ValueError: + version = version_priority + priority = 0. + + self._objects[version.strip()] = priority + + def build(self, context, **kw): + self._fillObjectDictFromArchive() + + def install(self, context, trashbin, **kw): + if not self._objects: + return + + portal = context.getPortalObject() + registered_tuple_list = [] + for value in portal.getVersionPriorityList(): + try: + version, priority = value.split('|') + priority = float(priority) + except ValueError: + version = value + priority = 0. + + registered_tuple_list.append((version.strip(), priority)) + + update_dict = kw.get('object_to_update') + force = kw.get('force') + registered_name_list = set(portal.getVersionPriorityNameList()) + for new_version, new_priority in self._objects.iteritems(): + action = update_dict.get(new_version) + if (not action or action == 'nothing') and not force: + continue + + # Merge version and priority defined on this bt and already registered + # version and priority + inserted = False + index = 0 + for (version, priority) in registered_tuple_list: + if new_version == version: + if new_priority == priority: + inserted = True + break + else: + del registered_tuple_list[index] + continue + elif not inserted: + if new_priority > priority: + registered_tuple_list.insert(index, (new_version, new_priority)) + inserted = True + elif new_priority == priority and new_version >= version: + registered_tuple_list.insert(index, (new_version, new_priority)) + inserted = True + + index += 1 + + if not inserted: + registered_tuple_list.append((new_version, new_priority)) + + portal.setVersionPriorityList(('%s | %s' % (version, priority) + for version, priority in registered_tuple_list)) + + def preinstall(self, context, installed_item, **kw): + if context.getTemplateFormatVersion() != 1: + return {} + + modified_object_list = {} + class_name_prefix = self.__class__.__name__[:-12] + for path, new_object in self._objects.iteritems(): + old_object = installed_item._objects.get(path) + if old_object is not None: + # Compare object to see it there is any change + if new_object != old_object: + modified_object_list.update({path : ['Modified', class_name_prefix]}) + else: + modified_object_list.update({path : ['New', class_name_prefix]}) + + # Get removed objects + for path in installed_item._objects: + if path not in self._objects: + modified_object_list.update({path : ['Removed', class_name_prefix]}) + + return modified_object_list + + def importFile(self, bta, **kw): + super(RegisteredVersionPrioritySelectionTemplateItem, + self).importFile(bta, **kw) + + self._objects.clear() + self._fillObjectDictFromArchive() + + def uninstall(self, context, **kw): + object_path = kw.get('object_path') + object_list = object_path and (object_path,) or self._objects + + portal = context.getPortalObject() + registered_list = list(portal.getVersionPriorityList()) + index = 0 + for version in portal.getVersionPriorityNameList(): + if version in object_list: + del registered_list[index] + else: + index += 1 + + portal.setVersionPriorityList(registered_list) class WorkflowTemplateItem(ObjectTemplateItem): @@ -4565,6 +4675,7 @@ Business Template is a set of definitions, such as skins, portal types and categ # path and use it with SQLMethods in a skin. # ( and more ) _item_name_list = [ + '_registered_version_priority_selection_item', '_product_item', '_document_item', '_property_sheet_item', @@ -4674,6 +4785,9 @@ Business Template is a set of definitions, such as skins, portal types and categ self._registered_skin_selection_item = \ RegisteredSkinSelectionTemplateItem( self.getTemplateRegisteredSkinSelectionList()) + self._registered_version_priority_selection_item = \ + RegisteredVersionPrioritySelectionTemplateItem( + self.getTemplateRegisteredVersionPrioritySelectionList()) self._category_item = \ CategoryTemplateItem(self.getTemplateBaseCategoryList()) self._catalog_method_item = \ @@ -5224,6 +5338,13 @@ Business Template is a set of definitions, such as skins, portal types and categ """ return self._getOrderedList('template_registered_skin_selection') + def getTemplateRegisteredVersionPrioritySelectionList(self): + """ + We have to set this method because we want an + ordered list + """ + return self._getOrderedList('template_registered_version_priority_selection') + def getTemplateModuleIdList(self): """ We have to set this method because we want an diff --git a/product/ERP5/ERP5Site.py b/product/ERP5/ERP5Site.py index 66c656f74643862cb123d03454abc2c493f355a7..0dd0c83e877151881a15ad45169a789ae9e0d618 100644 --- a/product/ERP5/ERP5Site.py +++ b/product/ERP5/ERP5Site.py @@ -451,7 +451,7 @@ class ERP5Site(FolderMixIn, CMFSite, CacheCookieMixin): """ # Whatever happens, a version must always be returned otherwise it may # render the site unusable when all Products will have been migrated - return self._version_priority_list or ('erp5',) + return self._version_priority_list or ('erp5 | 0.0',) security.declareProtected(Permissions.ModifyPortalContent, 'setVersionPriorityList' ) @@ -460,6 +460,9 @@ class ERP5Site(FolderMixIn, CMFSite, CacheCookieMixin): XXX-arnau: must be written through an interaction workflow when ERP5Site will become a real ERP5 object... """ + if not isinstance(value, tuple): + value = tuple(value) + self._version_priority_list = value if not getattr(self, '_v_bootstrapping', False): @@ -468,6 +471,12 @@ class ERP5Site(FolderMixIn, CMFSite, CacheCookieMixin): version_priority_list = property(getVersionPriorityList, setVersionPriorityList) + security.declarePrivate('getVersionPriorityNameList') + def getVersionPriorityNameList(self): + # XXX-arnau: should be cached? + return [name.split('|')[0].strip() + for name in self.getVersionPriorityList()] + security.declareProtected(Permissions.AccessContentsInformation, 'getUid') def getUid(self): """ @@ -1696,7 +1705,7 @@ class ERP5Generator(PortalGenerator): # Return the fully wrapped object. p = parent.this()._getOb(id) - p._setProperty('version_priority_list', ('erp5',), 'lines') + p._setProperty('version_priority_list', ('erp5 | 0.0',), 'lines') erp5_sql_deferred_connection_string = erp5_sql_connection_string p._setProperty('erp5_catalog_storage', diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_view.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_view.xml index 2e998894b7fb024f55aec47fb574f84d767c5814..1d4b69b39414cbd83a796769fa0cf30a9244e7d1 100644 --- a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_view.xml +++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_view.xml @@ -87,6 +87,7 @@ <list> <string>my_template_module_id_list</string> <string>my_template_base_category_list</string> + <string>my_template_registered_version_priority_selection_list</string> </list> </value> </item> diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_view/my_template_registered_version_priority_selection_list.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_view/my_template_registered_version_priority_selection_list.xml new file mode 100644 index 0000000000000000000000000000000000000000..b2b795dd27405334b8c03076f76267e47f2c92e7 --- /dev/null +++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_view/my_template_registered_version_priority_selection_list.xml @@ -0,0 +1,298 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="LinesField" module="Products.Formulator.StandardFields"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>id</string> </key> + <value> <string>my_template_registered_version_priority_selection_list</string> </value> + </item> + <item> + <key> <string>message_values</string> </key> + <value> + <dictionary> + <item> + <key> <string>external_validator_failed</string> </key> + <value> <string>The input failed the external validator.</string> </value> + </item> + <item> + <key> <string>line_too_long</string> </key> + <value> <string>A line was too long.</string> </value> + </item> + <item> + <key> <string>required_not_found</string> </key> + <value> <string>Input is required but no input given.</string> </value> + </item> + <item> + <key> <string>too_long</string> </key> + <value> <string>You entered too many characters.</string> </value> + </item> + <item> + <key> <string>too_many_lines</string> </key> + <value> <string>You entered too many lines.</string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>overrides</string> </key> + <value> + <dictionary> + <item> + <key> <string>alternate_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>css_class</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>default</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>editable</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>enabled</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>external_validator</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>extra</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>height</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>hidden</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_length</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_linelength</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_lines</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>required</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>unicode</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>view_separator</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>whitespace_preserve</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>width</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>tales</string> </key> + <value> + <dictionary> + <item> + <key> <string>alternate_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>css_class</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>default</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>editable</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>enabled</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>external_validator</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>extra</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>height</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>hidden</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_length</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_linelength</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_lines</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>required</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>unicode</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>view_separator</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>whitespace_preserve</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>width</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>values</string> </key> + <value> + <dictionary> + <item> + <key> <string>alternate_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>css_class</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>default</string> </key> + <value> + <list/> + </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>editable</string> </key> + <value> <int>1</int> </value> + </item> + <item> + <key> <string>enabled</string> </key> + <value> <int>1</int> </value> + </item> + <item> + <key> <string>external_validator</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>extra</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>height</string> </key> + <value> <int>5</int> </value> + </item> + <item> + <key> <string>hidden</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>max_length</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_linelength</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_lines</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>required</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>Registered Version Priority Selection</string> </value> + </item> + <item> + <key> <string>unicode</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>view_separator</string> </key> + <value> <string encoding="cdata"><![CDATA[ + +<br /> + +]]></string> </value> + </item> + <item> + <key> <string>whitespace_preserve</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>width</string> </key> + <value> <int>40</int> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_viewMigrateSourceCodeFromFilesystemDialog/my_version_priority.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_viewMigrateSourceCodeFromFilesystemDialog/my_version_priority.xml index bd53508ea9251fa4d35e533cd52915b842dc2859..715b9d60c6f9a7611df1f5bd43a2079343a04e37 100644 --- a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_viewMigrateSourceCodeFromFilesystemDialog/my_version_priority.xml +++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_viewMigrateSourceCodeFromFilesystemDialog/my_version_priority.xml @@ -123,7 +123,7 @@ <dictionary> <item> <key> <string>_text</string> </key> - <value> <string>python: [(v, v) for v in here.getPortalObject().getVersionPriorityList()]</string> </value> + <value> <string>python: [(v, v) for v in here.getPortalObject().getVersionPriorityNameList()]</string> </value> </item> </dictionary> </pickle> diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Component_view/my_version.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Component_view/my_version.xml index f66015f4567831adc448aaea1d95f867312fe897..ad559b0d07a8c72682e7a5acfc8890bf6c856ba5 100644 --- a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Component_view/my_version.xml +++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Component_view/my_version.xml @@ -108,7 +108,7 @@ <dictionary> <item> <key> <string>_text</string> </key> - <value> <string>python: here.getPortalObject().getVersionPriorityList()</string> </value> + <value> <string>python: here.getPortalObject().getVersionPriorityNameList()</string> </value> </item> </dictionary> </pickle> diff --git a/product/ERP5/bootstrap/erp5_core/bt/change_log b/product/ERP5/bootstrap/erp5_core/bt/change_log index d331ef68e51c7d329150e233056debd71b526576..4f5545e248aeb31493601877e8ca8cbb4cdb3b75 100644 --- a/product/ERP5/bootstrap/erp5_core/bt/change_log +++ b/product/ERP5/bootstrap/erp5_core/bt/change_log @@ -1,3 +1,6 @@ +2012-03-06 arnaud.fontaine +* Add registered version priority selection on BusinessTemplate_view for registering version priority of ZODB Components only for now. + 2012-03-05 arnaud.fontaine * Allow to run ZODB Test Component tests from Component Tool, likewise Class Tool. diff --git a/product/ERP5/bootstrap/erp5_core/bt/revision b/product/ERP5/bootstrap/erp5_core/bt/revision index 5c0808f8251192f40ccf68a344b296d0c6f925c3..54e9761c32c1046406e09a69aa080fb742cb071f 100644 --- a/product/ERP5/bootstrap/erp5_core/bt/revision +++ b/product/ERP5/bootstrap/erp5_core/bt/revision @@ -1 +1 @@ -41026 \ No newline at end of file +41027 \ No newline at end of file diff --git a/product/ERP5/bootstrap/erp5_property_sheets/PropertySheetTemplateItem/portal_property_sheets/BusinessTemplate/template_registered_version_priority_selection_property.xml b/product/ERP5/bootstrap/erp5_property_sheets/PropertySheetTemplateItem/portal_property_sheets/BusinessTemplate/template_registered_version_priority_selection_property.xml new file mode 100644 index 0000000000000000000000000000000000000000..e13c86e3e979ebd1d391cb5e68c01aa09de943e7 --- /dev/null +++ b/product/ERP5/bootstrap/erp5_property_sheets/PropertySheetTemplateItem/portal_property_sheets/BusinessTemplate/template_registered_version_priority_selection_property.xml @@ -0,0 +1,36 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="Standard Property" module="erp5.portal_type"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>categories</string> </key> + <value> + <tuple> + <string>elementary_type/lines</string> + </tuple> + </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string>A list of registered version priority used by this template</string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>template_registered_version_priority_selection_property</string> </value> + </item> + <item> + <key> <string>portal_type</string> </key> + <value> <string>Standard Property</string> </value> + </item> + <item> + <key> <string>property_default</string> </key> + <value> <string>python: ()</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/product/ERP5/bootstrap/erp5_property_sheets/bt/change_log b/product/ERP5/bootstrap/erp5_property_sheets/bt/change_log index b71e7779bcec9cc2c4eb424ddcc9274a85fd74ad..072d0ee8f582cf76e2624311f78b2af8790be0c6 100644 --- a/product/ERP5/bootstrap/erp5_property_sheets/bt/change_log +++ b/product/ERP5/bootstrap/erp5_property_sheets/bt/change_log @@ -1,3 +1,6 @@ +2012-03-06 arnaud.fontaine +* Add template_registered_version_priority_selection property to BusinessTemplate to define version and their priorities for ZODB Component only for now. + 2011-12-15 yusei * Fix ProductionOrderLine.resource_category_existence. Any resource type document is ok to be used as resource on production order line. diff --git a/product/ERP5/bootstrap/erp5_property_sheets/bt/revision b/product/ERP5/bootstrap/erp5_property_sheets/bt/revision index abc4eff6ac83026669840d289fce80cc9a42baaa..801f1801027f3350b08ad85c984db805cd32e736 100644 --- a/product/ERP5/bootstrap/erp5_property_sheets/bt/revision +++ b/product/ERP5/bootstrap/erp5_property_sheets/bt/revision @@ -1 +1 @@ -46 \ No newline at end of file +47 \ No newline at end of file diff --git a/product/ERP5/tests/testBusinessTemplate.py b/product/ERP5/tests/testBusinessTemplate.py index 76782a10cbe8d38aa97bd259de7006fa25833a29..0c2dc0bbd23ac65dbc34c2bda0eb68a67ecc7414 100644 --- a/product/ERP5/tests/testBusinessTemplate.py +++ b/product/ERP5/tests/testBusinessTemplate.py @@ -6565,6 +6565,99 @@ class TestBusinessTemplate(BusinessTemplateMixin): sequence_list.addSequenceString(sequence_string) sequence_list.play(self) + def stepSetVersionPriorityRegisteredSelection(self, sequence=None, **kw): + bt = sequence.get('current_bt') + self.failIf(bt is None) + + version_priority_list = ('abc| 1.0', + 'def |99.0', + 'erp4') + + bt.edit(template_registered_version_priority_selection_list=version_priority_list) + + sequence.edit(expected_version_priority_list=('def | 99.0', + 'abc | 1.0', + 'erp5 | 0.0', + 'erp4 | 0.0'), + current_bt_version_priority_list=tuple(sorted(version_priority_list))) + + def stepUpdateVersionPriorityRegisteredSelection(self, sequence=None, **kw): + bt = sequence.get('current_bt') + self.failIf(bt is None) + + version_priority_list = ('erp4', + 'abc | 1.0', + 'foo | 2.0', + 'bar | 100.0') + + bt.edit(template_registered_version_priority_selection_list=version_priority_list) + + sequence.edit(expected_version_priority_list=('bar | 100.0', + 'foo | 2.0', + 'abc | 1.0', + 'erp5 | 0.0', + 'erp4 | 0.0'), + current_bt_version_priority_list=tuple(sorted(version_priority_list))) + + def stepCheckVersionPriorityRegisteredSelection(self, sequence=None, **kw): + bt = sequence.get('current_bt') + self.assertEqual(tuple(bt.getTemplateRegisteredVersionPrioritySelectionList()), + sequence['current_bt_version_priority_list']) + + def stepRemoveVersionPriorityRegisteredSelectionBeforeImport(self, + sequence=None, + **kw): + bt = sequence.get('current_bt') + bt.edit(template_registered_version_priority_selection_list=()) + + def stepCheckVersionPrioritySetOnSite(self, sequence=None, **kw): + bt = sequence.get('current_bt') + self.assertEqual(self.getPortalObject().getVersionPriorityList(), + sequence['expected_version_priority_list']) + + def stepCheckVersionPriorityRemovedFromSite(self, sequence=None, **kw): + bt = sequence.get('current_bt') + self.assertEqual(self.getPortalObject().getVersionPriorityList(), + ('erp5 | 0.0',)) + + def stepRemoveVersionPriorityRegisteredSelection(self, sequence=None, **kw): + bt = sequence.get('current_bt') + bt.edit(template_registered_version_priority_selection=()) + sequence.edit(expected_version_priority_list=('erp5 | 0.0'), + current_bt_version_priority_list=()) + + def test_BusinessTemplateWithVersionPrioritySelection(self): + sequence_list = SequenceList() + sequence_string = 'CreateNewBusinessTemplate \ + UseExportBusinessTemplate \ + SetVersionPriorityRegisteredSelection \ + BuildBusinessTemplate \ + SaveBusinessTemplate \ + RemoveVersionPriorityRegisteredSelectionBeforeImport \ + ImportBusinessTemplate \ + UseImportBusinessTemplate \ + CheckVersionPriorityRegisteredSelection \ + InstallWithoutForceBusinessTemplate \ + Tic \ + CheckVersionPrioritySetOnSite \ + UninstallBusinessTemplate \ + Tic \ + CheckVersionPriorityRemovedFromSite \ + \ + UpdateVersionPriorityRegisteredSelection \ + BuildBusinessTemplate \ + CheckVersionPriorityRegisteredSelection \ + InstallWithoutForceBusinessTemplate \ + Tic \ + CheckVersionPrioritySetOnSite \ + UninstallBusinessTemplate \ + Tic \ + CheckVersionPriorityRemovedFromSite \ + ' + + sequence_list.addSequenceString(sequence_string) + sequence_list.play(self) + from Products.ERP5Type.Core.DocumentComponent import DocumentComponent class TestDocumentTemplateItem(BusinessTemplateMixin): diff --git a/product/ERP5Type/dynamic/component_package.py b/product/ERP5Type/dynamic/component_package.py index 642868a971775d5a7df388732f1b373901140797..0569e8a41dbd69342fd32e628e31d973289bee77 100644 --- a/product/ERP5Type/dynamic/component_package.py +++ b/product/ERP5Type/dynamic/component_package.py @@ -104,7 +104,7 @@ class ComponentDynamicPackage(ModuleType): except AttributeError: return {} - version_priority_set = set(portal.getVersionPriorityList()) + version_priority_set = set(portal.getVersionPriorityNameList()) # objectValues should not be used for a large number of objects, but # this is only done at startup or upon reset, moreover using the Catalog @@ -154,7 +154,7 @@ class ComponentDynamicPackage(ModuleType): # wrongly considered as importable and thus the actual filesystem class # ignored elif (name not in self._registry_dict and - name[:-self.__version_suffix_len] not in site.getVersionPriorityList()): + name[:-self.__version_suffix_len] not in site.getVersionPriorityNameList()): return None return self @@ -181,7 +181,7 @@ class ComponentDynamicPackage(ModuleType): component_name = fullname[len(self._namespace_prefix):] if component_name.endswith('_version'): version = component_name[:-self.__version_suffix_len] - return (version in site.getVersionPriorityList() and + return (version in site.getVersionPriorityNameList() and self._getVersionPackage(version) or None) component_id_alias = None @@ -207,7 +207,7 @@ class ComponentDynamicPackage(ModuleType): raise ImportError("%s: Component %s could not be found" % (fullname, component_name)) - for version in site.getVersionPriorityList(): + for version in site.getVersionPriorityNameList(): component = component_version_dict.get(version) if component is not None: break diff --git a/product/ERP5Type/tests/testDynamicClassGeneration.py b/product/ERP5Type/tests/testDynamicClassGeneration.py index 3126fcaa95f9af4c36107084f79ce7443e6c199b..aacaf218f5c09f752c3bd498cfb8c3be756adc0f 100644 --- a/product/ERP5Type/tests/testDynamicClassGeneration.py +++ b/product/ERP5Type/tests/testDynamicClassGeneration.py @@ -1596,7 +1596,7 @@ def bar(*args, **kwargs): ComponentTool.reset = assertResetCalled priority_tuple = site.getVersionPriorityList() try: - site.setVersionPriorityList(('foo',) + priority_tuple) + site.setVersionPriorityList(('foo | 99.0',) + priority_tuple) transaction.commit() self.tic()