Commit 8227cf75 authored by Łukasz Nowak's avatar Łukasz Nowak

Simplify.

parent 856b185c
from Products.ERP5Type.Base import WorkflowMethod
def Instance_migrateUrlString(obj):
def Instance_migrateUrlString(self):
@WorkflowMethod.disable
def real(obj):
def real(self):
property_id = 'root_software_release_url'
if obj.getPortalType() not in ('Hosting Subscription', 'Software Instance', 'Slave Instance'):
raise TypeError(obj.getPortalType())
if self.getPortalType() not in ('Hosting Subscription', 'Software Instance', 'Slave Instance'):
raise TypeError(self.getPortalType())
old_url = getattr(obj.aq_base, property_id, None)
new_url = obj.getUrlString()
old_url = getattr(self.aq_base, property_id, None)
new_url = self.getUrlString()
if not old_url and not new_url:
raise ValueError('%s has no url defined at all' % obj.getPath())
raise ValueError('%s has no url defined at all' % self.getPath())
if old_url:
obj.setUrlString(old_url)
assert(obj.getUrlString() == old_url)
delattr(obj.aq_base, property_id)
if type(obj) == type([]):
for o in obj:
self.setUrlString(old_url)
assert(self.getUrlString() == old_url)
delattr(self.aq_base, property_id)
if type(self) == type([]):
for o in self:
real(o[0])
else:
real(obj)
real(self)
......@@ -62,12 +62,7 @@ for module in (\n
max_depth=1,\n
min_depth=1,\n
max_retry=0,\n
activity_count=50,\n
activate_kw={\n
\'tag\': script.id,\n
\'group_method_id\': method_id,\n
\'group_method_cost\': 1./50, # fire up 50 activities in same transaction\n
}\n
activate_kw={\'tag\': script.id}\n
)\n
\n
return \'Done.\'\n
......
7
\ No newline at end of file
8
\ 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