Commit 2eaa22f9 authored by Jérome Perrin's avatar Jérome Perrin

core: remove unused scripts

These scripts are not used and does not respect naming conventions or
have pylint errors.
parent 268a0884
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>list=[]</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_convertDateListToChartList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
# This scripts allows to update a list so that it
# converts variation on a quantity to the quantity itself
# ie, if list=[[DateTime('09/10/2003'),+4],[DateTime('09/19/2003'),-8]],
# and initial_quantity = [3]
# result: [[DateTime('2003/09/10'), 7], [DateTime('2003/09/19'), -1]]
# The list given have to be of the forme:
# list = [[Datetime(),value (,value)*],([Datetime(),value (,value)*])*]
# The initial_quantity have to be like this :
# initial_quantity = [value (,value)*]
list.sort()
quantity_list = []
#if type(initial_quantity) is type(1):
# initial_quantity = [initial_quantity]
if len(list) >= 1 and (len(list[0])-1)==len(initial_quantity):
quantity_list.append([list[0][0]])
for i in range(1,len(list[0])):
if list[0][i]==None:
list[0][i]=0
quantity_list[0].append(initial_quantity[i-1] + list[0][i])
for value in range(1,len(list)):
quantity_list.append([list[value][0]])
for i in range(1,len(list[0])):
if list[value][i]==None:
list[value][i]=0
quantity_list[value].append(quantity_list[value-1][i] + list[value][i])
return quantity_list
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>list=[],initial_quantity=[]</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_convertVariationListToQuantityList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
from Products.Formulator.Errors import ValidationError, FormValidationError
from ZTUtils import make_query
request=context.REQUEST
if isinstance(list_form_id,tuple):
list_form_id = list_form_id[0]
# The type list is not working with isinstance, I have do do this bad hack
if hasattr(list_form_id,'sort'):
list_form_id = list_form_id[0]
module_name = context.getId()
try:
# Validate the form
form = getattr(context,dialog_id)
form.validate_all_to_request(request)
kw = {}
for f in form.get_fields():
k = f.id
# XXX Remove your_ parameters...
k = k[5:]
v = getattr(request,k,None)
if v is not None and k != 'list_form_id' :
kw[k] = v
if list_method_id is not None and list_method_id != '' :
kw['list_method_id'] = list_method_id
url_params_string = make_query(kw)
# raise str(kw), url_params_string
except FormValidationError, validation_errors:
# Pack errors into the request
field_errors = form.ErrorFields(validation_errors)
request.set('field_errors', field_errors)
return form(request)
if url_params_string != '':
redirect_url = '%s/%s?%s' % ( context.absolute_url()
, list_form_id
, url_params_string
)
else:
redirect_url = '%s/%s' % ( context.absolute_url()
, list_form_id
)
return request.RESPONSE.redirect( redirect_url )
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>form_id,dialog_id,list_form_id,list_method_id=\'\'</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_searchHandler</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
"""
XXX temporary function to recover statistics when needed
=> will be put in an external script.
recover a list with temporary objects we want to apply stats on.
(can be object itself, list of direct sons, list of all sons using
recursive method, etc.)
Then take this special list of objects and return a list of special
temp_objects to display as blocks 'as they are'
"""
from Products.ERP5Type.Log import log
from Products.ERP5Type.Document import newTempMovement as newTempBase
from string import zfill
# first recovering methods to apply on tasks
start_property_id = field.get_value('x_start_bloc')
stop_property_id= field.get_value('x_stop_bloc')
size_property_id = field.get_value('y_size_block')
###########################################################
########### CREATING LIST OF TEMP STAT OBJECTS ############
###########################################################
# find a way to get all related objects with their sub-objects
# this list of objects must be stored in a list
# for now considering applying statistics on object_list
# XXX bug : can not apply getExceptionUidList() method on object_tree_line.
# <<unauthorized access>>
#selection.edit(exception_uid_list= object_tree_line.getExceptionUidList())
input_object_list = selection(method = list_method,context= selection_context,
REQUEST=REQUEST)
temp_object_list = []
temp_object_id = 0
# now applying statictic rule.
# for now statistic rules are static
for input_object in input_object_list:
# recovering input_object attributes
block_begin = input_object.getObject().getProperty(start_property_id,None)
block_end = input_object.getObject().getProperty(stop_property_id,None)
block_size = input_object.getObject().getProperty(size_property_id,None)
if block_begin != None and block_end != None:
# do not create stat on non completed objects.
# prevent bug while size property is not defined on the object
if block_size == None: block_size = block_end - block_begin
#updating block_size value
block_size = float(block_size) / (block_end - block_begin)
# creating new object
temp_object = newTempBase(context.getPortalObject(),id=str(temp_object_id), uid ='new_%s' % zfill(temp_object_id, 4) )
# editing object with new values
log("%s" % (",".join([start_property_id, str(block_begin),stop_property_id, str(block_end),size_property_id, str(block_size)])))
temp_object.setProperty(start_property_id, block_begin)
temp_object.setProperty(stop_property_id, block_end)
temp_object.setProperty(size_property_id, block_size)
# adding new object to list
temp_object_list.append(temp_object)
temp_object_id += 1
###########################################################
################ BUILDING STATS ACTIVITES #################
###########################################################
# building a special list structure.
prop_list = []
for temp_stat in temp_object_list:
block_begin = temp_stat.getProperty(start_property_id)
block_end = temp_stat.getProperty(stop_property_id)
block_size = temp_stat.getProperty(size_property_id)
prop_list.append([block_begin, float(block_size)])
prop_list.append([block_end ,-(float(block_size))])
# now sorting list to put start & stop in the right order
prop_list.sort()
# now building new list of temp object with updated properties
size = 0
temp_stat_object_list = []
for index in range(len(prop_list) - 1):
# iterating all prop_list elements except the last one
current_prop = prop_list[index]
size += current_prop[1] # new size is relative to the previous size
start = current_prop[0] # current start
stop = prop_list[index+1][0] # current stop is the begining of the next block
temp_stat_object_id = 0
if size > 0:
# size is not null
# building new tempObject
temp_stat_object_id += 1
temp_stat_object = newTempBase(context.getPortalObject(),str(temp_stat_object_id), uid ='new_%s' % zfill(temp_stat_object_id, 4))
# editing object with new values
temp_stat_object.setProperty(start_property_id, start)
temp_stat_object.setProperty(stop_property_id, stop)
temp_stat_object.setProperty(size_property_id, size)
# adding new object to list
temp_stat_object_list.append(temp_stat_object)
temp_stat_object_id +=1
return temp_stat_object_list
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>selection=None,list_method=None, selection_context=None, report_tree_list = None, object_tree_line=None, REQUEST=None, field=None</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Planning_commonStats</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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