Commit 9d339516 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_accounting: Make Pylint Happy

parent a0509207
......@@ -2,7 +2,7 @@ from zExceptions import Unauthorized
if REQUEST is not None:
raise Unauthorized
from erp5.component.module.DateUtils import addToDate, getClosestDate
from erp5.component.module.DateUtils import getClosestDate
hosting_subscription = context
portal = context.getPortalObject()
......
......@@ -7,7 +7,7 @@ from erp5.component.module.DateUtils import addToDate, getClosestDate
hosting_subscription = context
portal = context.getPortalObject()
start_date = context.HostingSubscription_calculateSubscriptionStartDate()
#start_date = context.HostingSubscription_calculateSubscriptionStartDate()
workflow_item_list = portal.portal_workflow.getInfoFor(
ob=hosting_subscription,
......
from erp5.component.module.DateUtils import addToDate, getClosestDate
from erp5.component.module.DateUtils import addToDate
from DateTime import DateTime
portal = context.getPortalObject()
......
from zExceptions import Unauthorized
if REQUEST is not None:
raise Unauthorized("Unauthorized call script from URL")
......
from zExceptions import Unauthorized
if REQUEST is not None:
raise Unauthorized("Unauthorized call script from URL")
......@@ -10,25 +11,25 @@ def consumption_model_shuttle_ds61_i7(load):
""" Expected consumed watts for the computer load
"""
if load <= 25:
return 21.5 + 1.06*load
return 21.5 + 1.06*load
else:
return 48 + 0.29*load
return 48 + 0.29*load
def consumption_model_shuttle_nuc_i7(load):
""" Expected consumed watts for the computer load
"""
if load <= 25:
return 8.5 + 0.46*load
return 8.5 + 0.46*load
else:
return 20 + 0.08*load
return 20 + 0.08*load
def consumption_model_rikomagic_mk802iv(load):
""" Expected consumed watts for the computer load
"""
if load <= 25:
return 2.2 + 0.04*load
return 2.2 + 0.04*load
else:
return 3.2 + 0.008*load
return 3.2 + 0.008*load
def no_model(load):
return 0
......
from zExceptions import Unauthorized
if REQUEST is not None:
raise Unauthorized("Unauthorized call script from URL")
......
from DateTime import DateTime
from Products.ZSQLCatalog.SQLCatalog import Query
from Products.ERP5Type.Document import newTempDocument
from Products.ERP5Type.Document import newTempBase
portal = context.getPortalObject()
......@@ -136,7 +135,7 @@ for date in sorted(consumption_dict, reverse=True):
hosting_title, instance_dict, hs_url = consumption_dict[date][hosting_key]
for instance_value_list in instance_dict.values():
instance_title, values, instance_url, computer_title = instance_value_list
line = newTempDocument(portal, instance_url, uid="%s_%s" % (context.getUid(), i))
line = newTempBase(portal, instance_url, uid="%s_%s" % (context.getUid(), i))
line.edit(
title=hosting_title,
start_date=date,
......
from Products.ZSQLCatalog.SQLCatalog import Query
portal = context.getPortalObject()
query_kw.update(query_kw['selection'].getParams())
......
......@@ -32,4 +32,4 @@ for movement in movement_list:
if line is not None:
deliveries_keys[line.getExplanationValue()] = 1
return filter(lambda x : x is not None, deliveries_keys.keys())
return [x for x in deliveries_keys if x is not None]
......@@ -170,7 +170,7 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin):
def test_OpenSaleOrder_reindexIfIndexedBeforeLine_line_indexed_before(self):
portal = self.portal
order = self.createOpenSaleOrder()
line = order.newContent(portal_type="Open Sale Order Line")
order.newContent(portal_type="Open Sale Order Line")
self.tic()
order.activate().immediateReindexObject()
# XXX One more kitten killed
......
......@@ -45,9 +45,7 @@
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple>
<string>W:173, 4: Unused variable \'line\' (unused-variable)</string>
</tuple>
<tuple/>
</value>
</item>
<item>
......
......@@ -5,7 +5,6 @@
#
##############################################################################
import transaction
from erp5.component.test.SlapOSTestCaseMixin import \
SlapOSTestCaseMixinWithAbort, SlapOSTestCaseMixin, simulate
from zExceptions import Unauthorized
......@@ -267,7 +266,6 @@ class TestSlapOSComputerConsumptionTioXMLFile_solveInvoicingGeneration(
def createAllocatedComputer(self):
# Create person
password = self.generateNewId()
reference = 'test_%s' % self.generateNewId()
person = self.portal.person_module.newContent(portal_type='Person',
title=reference,
......@@ -275,7 +273,6 @@ class TestSlapOSComputerConsumptionTioXMLFile_solveInvoicingGeneration(
person.newContent(portal_type='Assignment', role='member').open()
# Create second person
password = self.generateNewId()
reference = 'test_%s' % self.generateNewId()
second_person = self.portal.person_module.newContent(portal_type='Person',
title=reference,
......
......@@ -45,10 +45,7 @@
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple>
<string>W:270, 4: Unused variable \'password\' (unused-variable)</string>
<string>W: 8, 0: Unused import transaction (unused-import)</string>
</tuple>
<tuple/>
</value>
</item>
<item>
......
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