[Zope] Greatly Simplifiied Script writing to session: Is there anything wrong with this?
Redding, Matthew
Matthew.Redding@dpi.qld.gov.au
Tue, 14 Jan 2003 12:31:05 +1000
Hi All,
I was wondering if anyone could tell me why this python script (passed
no parameters)
creates session values for N_prod, N_shed, N_screen, N_pond, N_land,
N_soil that
are all the same.
What am I doing wrong? Is this a vaguery of the script system, and
should I use
an external method instead? I am running this on a Redhat 7.3 system,
updated
to the latest patch.
_______________________________________________________________
import math
session=context.REQUEST.SESSION
#Define loss values:
N_shed_loss=10;N_screen_loss=8;N_sludge_loss=24;N_pond_loss=40;N_irrigat
ion_loss=25;N_soil_loss=25
#Calculate Components at each step, and assign to the session.
#_Manure Production
session['N_prod']=round(session['num_spu']*0.081814, 1)
#_exiting the shed
session['N_shed']=round(session['N_prod']*(1-(N_shed_loss/100)),1)
#_exiting the screens
session['N_screen']=round(session['N_shed']*(1-(N_screen_loss/100)), 1)
#_retained in sludge
session['N_sludge']=round(session['N_screen']*(N_sludge_loss/100), 1)
#_retained in the ponds
session['N_pond']=round((session['N_screen']-session['N_sludge'])*(1-(N_
pond_loss/100)), 1)
#_reaching the soil
session['N_lands']=round(session['N_pond']*(1-(N_irrigation_loss/100)),
1)
#_retained in the soil
session['N_soil']=round(session['N_lands']*(1-(N_soil_loss/100)), 1)
return
-------------------------------------------------------
THanks,
Matt Redding
********************************DISCLAIMER****************************
The information contained in the above e-mail message or messages
(which includes any attachments) is confidential and may be legally
privileged. It is intended only for the use of the person or entity
to which it is addressed. If you are not the addressee any form of
disclosure, copying, modification, distribution or any action taken
or omitted in reliance on the information is unauthorised. Opinions
contained in the message(s) do not necessarily reflect the opinions
of the Queensland Government and its authorities. If you received
this communication in error, please notify the sender immediately and
delete it from your computer system network.