Commit 8bd0a861 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_crm: newTempDocument don't exist anymore

    Those 2 scripts lack unit test
parent 0e68c46d
from Products.ERP5Type.Document import newTempDocument from Products.PythonScripts.standard import Object
portal = context.getPortalObject() portal = context.getPortalObject()
...@@ -35,8 +35,9 @@ for hosting_subscription in hosting_subscription_list: ...@@ -35,8 +35,9 @@ for hosting_subscription in hosting_subscription_list:
# bad or unknown url # bad or unknown url
continue continue
o = newTempDocument(portal, "uid_%s" % instance.getId()) monitor_instance_list.append(
o.edit(title=instance.getTitle(), monitor_url=url_string) Object(uid="uid_%s" % instance.getId(),
monitor_instance_list.append(o) title=instance.getTitle(),
monitor_url=url_string))
return monitor_instance_list return monitor_instance_list
from Products.ERP5Type.Document import newTempDocument from Products.PythonScripts.standard import Object
from DateTime import DateTime from DateTime import DateTime
...@@ -36,30 +36,30 @@ if aggregate_portal_type == "Hosting Subscription": ...@@ -36,30 +36,30 @@ if aggregate_portal_type == "Hosting Subscription":
m, create_at, since = instance.SoftwareInstance_hasReportedError(include_message=True, m, create_at, since = instance.SoftwareInstance_hasReportedError(include_message=True,
include_created_at=True, include_created_at=True,
include_since=True) include_since=True)
message_list.append(newTempDocument( message_list.append(Object(
document, instance.getRelativeUrl(), **{ pasth=instance.getRelativeUrl(),
"uid": instance.getUid(), uid=instance.getUid(),
"title": instance.getTitle(), title= instance.getTitle(),
"specialise_title": hosting_subscription.getTitle(), specialise_title= hosting_subscription.getTitle(),
"software_release": instance.getUrlString(), software_release= instance.getUrlString(),
"computer_reference": computer.getReference(), computer_reference= computer.getReference(),
"allocation_scope": computer.getAllocationScope(), allocation_scope= computer.getAllocationScope(),
"follow_up_title": context.getFollowUpTitle(), follow_up_title= context.getFollowUpTitle(),
"message" : m, message=m,
"created_at": create_at, created_at=create_at,
"since": since, since=since,
"age": "%s m ago" % (int((DateTime()-DateTime(since))*24*60))})) age="%s m ago" % (int((DateTime()-DateTime(since))*24*60))))
else: else:
message_list.append(newTempDocument( message_list.append(Object(
document, instance.getRelativeUrl(), **{ relative_url=instance.getRelativeUrl(),
"uid": instance.getUid(), uid=instance.getUid(),
"title": instance.getTitle(), title=instance.getTitle(),
"specialise_title": hosting_subscription.getTitle(), specialise_title=hosting_subscription.getTitle(),
"software_release": instance.getUrlString(), software_release=instance.getUrlString(),
"follow_up_title": context.getFollowUpTitle(), follow_up_title=context.getFollowUpTitle(),
"computer_reference": "", computer_reference="",
"allocation_scope": "", allocation_scope="",
"message" : "Instance isn't allocated"})) message="Instance isn't allocated"))
return message_list return message_list
return [] return []
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