Commit ea9a752a authored by Alain Takoudjou's avatar Alain Takoudjou Committed by Rafael Monnerat

Now use Publication date on Software Releases for sorting

parent 3d4bcf71
...@@ -52,6 +52,8 @@ ...@@ -52,6 +52,8 @@
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
from DateTime import DateTime\n
\n
portal = context.getPortalObject()\n portal = context.getPortalObject()\n
\n \n
if software_product_reference is None:\n if software_product_reference is None:\n
...@@ -81,12 +83,20 @@ if len(product_list) > 1:\n ...@@ -81,12 +83,20 @@ if len(product_list) > 1:\n
raise NotImplementedError(\'Several Software Product with the same title.\')\n raise NotImplementedError(\'Several Software Product with the same title.\')\n
\n \n
software_release_list = product_list[0].getAggregateRelatedValueList()\n software_release_list = product_list[0].getAggregateRelatedValueList()\n
\n
def sortkey(software_release):\n
publication_date = software_release.getEffectiveDate()\n
if publication_date:\n
if (publication_date - DateTime()) > 0:\n
return DateTime(\'1900/05/02\')\n
return publication_date\n
return software_release.getCreationDate()\n
\n
software_release_list = sorted(\n software_release_list = sorted(\n
software_release_list,\n software_release_list,\n
key=lambda software_release: software_release.getCreationDate(),\n key=sortkey, reverse=True,\n
reverse=True,\n
)\n )\n
\n \n
return [software_release for software_release in software_release_list\n return [software_release for software_release in software_release_list\n
if software_release.getValidationState() in\n if software_release.getValidationState() in\n
["published"]\n ["published"]\n
......
...@@ -115,6 +115,7 @@ ...@@ -115,6 +115,7 @@
<string>my_crawling_scope</string> <string>my_crawling_scope</string>
<string>my_crawling_depth</string> <string>my_crawling_depth</string>
<string>my_update_frequency</string> <string>my_update_frequency</string>
<string>my_effective_date</string>
</list> </list>
</value> </value>
</item> </item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>default_now</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_effective_date</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>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>default_now</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_effective_date</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Document_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -15,8 +15,10 @@ ...@@ -15,8 +15,10 @@
<string>hide_rows_on_no_search_criterion</string> <string>hide_rows_on_no_search_criterion</string>
<string>list_method</string> <string>list_method</string>
<string>portal_types</string> <string>portal_types</string>
<string>search</string>
<string>search_columns</string> <string>search_columns</string>
<string>select</string> <string>select</string>
<string>sort_columns</string>
<string>title</string> <string>title</string>
</list> </list>
</value> </value>
...@@ -130,6 +132,10 @@ ...@@ -130,6 +132,10 @@
</list> </list>
</value> </value>
</item> </item>
<item>
<key> <string>search</string> </key>
<value> <int>0</int> </value>
</item>
<item> <item>
<key> <string>search_columns</string> </key> <key> <string>search_columns</string> </key>
<value> <value>
...@@ -145,6 +151,12 @@ ...@@ -145,6 +151,12 @@
<key> <string>select</string> </key> <key> <string>select</string> </key>
<value> <int>0</int> </value> <value> <int>0</int> </value>
</item> </item>
<item>
<key> <string>sort_columns</string> </key>
<value>
<list/>
</value>
</item>
<item> <item>
<key> <string>target</string> </key> <key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value> <value> <string>Click to edit the target</string> </value>
......
...@@ -149,7 +149,8 @@ class TestSoftwareReleaseListFromSoftwareProduct(testSlapOSMixin): ...@@ -149,7 +149,8 @@ class TestSoftwareReleaseListFromSoftwareProduct(testSlapOSMixin):
software_release1 = self._makeSoftwareRelease(new_id) software_release1 = self._makeSoftwareRelease(new_id)
software_release1.edit( software_release1.edit(
aggregate_value=software_product.getRelativeUrl(), aggregate_value=software_product.getRelativeUrl(),
url_string='http://example.org/1-%s.cfg' % new_id url_string='http://example.org/1-%s.cfg' % new_id,
effective_date=(DateTime() + 5)
) )
software_release1.publish() software_release1.publish()
software_release2 = self._makeSoftwareRelease(self.generateNewId()) software_release2 = self._makeSoftwareRelease(self.generateNewId())
...@@ -185,14 +186,16 @@ class TestSoftwareReleaseListFromSoftwareProduct(testSlapOSMixin): ...@@ -185,14 +186,16 @@ class TestSoftwareReleaseListFromSoftwareProduct(testSlapOSMixin):
software_release2.publish() software_release2.publish()
software_release2.edit( software_release2.edit(
aggregate_value=software_product.getRelativeUrl(), aggregate_value=software_product.getRelativeUrl(),
url_string='http://example.org/2-%s.cfg' % new_id url_string='http://example.org/2-%s.cfg' % new_id,
effective_date=(DateTime() - 2)
) )
# Newest software release # Newest software release
software_release1 = self._makeSoftwareRelease(new_id) software_release1 = self._makeSoftwareRelease(new_id)
software_release1.publish() software_release1.publish()
software_release1.edit( software_release1.edit(
aggregate_value=software_product.getRelativeUrl(), aggregate_value=software_product.getRelativeUrl(),
url_string='http://example.org/1-%s.cfg' % new_id url_string='http://example.org/1-%s.cfg' % new_id,
effective_date=DateTime()
) )
self.tic() self.tic()
...@@ -280,6 +283,7 @@ class TestSlapOSUpgradeHostingSubscription(BaseTestSlapOSMixin): ...@@ -280,6 +283,7 @@ class TestSlapOSUpgradeHostingSubscription(BaseTestSlapOSMixin):
True) True)
self.portal.portal_workflow._jumpToStateFor(hosting_subscription, 'destroy_requested') self.portal.portal_workflow._jumpToStateFor(hosting_subscription, 'destroy_requested')
self.tic()
self.assertEqual(hosting_subscription.HostingSubscription_isUpgradable(), self.assertEqual(hosting_subscription.HostingSubscription_isUpgradable(),
False) False)
\ No newline at end of file
318 319
\ No newline at end of file \ No newline at end of file
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