[Zope] Minimal product refresh ?
fowlertrainer at anonym.hu
fowlertrainer at anonym.hu
Mon Jan 19 04:07:55 EST 2004
Hello !
After zope zpt, and mod_python testing I want to test the zope's
product creation.
I've been used the minimal product to test it.
My product dir is:
c:\zope\website\lib\python\Products\minimal\
2004.01.19. 09:58 <DIR> .
2004.01.19. 09:58 <DIR> ..
2004.01.19. 09:54 1 948 minimal.py
2004.01.19. 09:36 2 refresh.txt
2004.01.19. 09:34 472 __init__.py
The product files are:
------------------------------------------------------------------
__init__.py:
import minimal
def initialize(context):
"""Initialize the minimal product.
This makes the object apear in the product list"""
context.registerClass(
minimal.minimal,
constructors = (
minimal.manage_addMinimalForm, # The first method is
# called when someone
# adds the product
minimal.manage_addMinimal
)
)
------------------------------------------------------------------
from OFS import SimpleItem
params=[]
class minimal(SimpleItem.SimpleItem):
"minimal object"
meta_type = 'minimal'
manage_options = (
{'label': 'View', 'action': 'index_html'},
)
def __init__(self, id):
"initialise a new instance of Minimal"
self.id = id
def index_html(self):
"used to view content of the object"
params.append(len(params))
s='The array is: '+str(params)
s='<html><body>Hello World<br>%s</body></html>'%s
return s
def counter(self):
"Shows the numbers from 1 to 10"
result = '<html><body>Counts from from 0 to 10<br>\n'
for i in range(10):
result = result + str(i) + '<br>\n'
result = result + '</body></html>\n'
return result
def squareForm(self):
"User input form for the suare method"
return """<html>
<body>
Please type the number you want squared:<br>
<form name="form" action="square"><br>
<input type="text" name="value:int"><br>
<input type="submit" value="Square">
</form>
</body>
</html>"""
def square(self, value=0):
"Returns the input value squared"
return """<html><body><b>The result of %s squared is:</b>
%s</body></html>""" % (str(value), str(value*value))
# Administrative pages
def manage_addMinimal(self, id, RESPONSE=None):
"Add a Minimal to a folder."
self._setObject(id, minimal(id))
RESPONSE.redirect('index_html')
def manage_addMinimalForm(self):
"The form used to get the instance' id from the user."
return """<html>
<body>
Please type the id of the minimal instance:<br>
<form name="form" action="manage_addMinimal"><br>
<input type="text" name="id"><br>
<input type="submit" value="add">
</form>
</body>
</html>"""
------------------------------------------------------------------
The questions are:
1.)
How to I use this product in my site ?
I try with this:
a.) I've been create an object of the product minimal in the zope's
root.
b.) I've been create an index_html:
<p tal:replace="structure python: here.minimal.index_html()"/>
But I think, it is not the normal way of the usage... :-(
2.)
Why the product don't refreshing ?
I write some things to file (minimal.py), and I fast reload the page
with many F5, but it is not refreshed. Why ???
The Zope version is 2.6, in winxp platform.
Thanx for any advance.
--
Best regards,
fowlertrainer mailto:fowlertrainer at anonym.hu
Ps:
Please write to my personal email address, if possible, because I'm
in digest mode.
T H A N X !!!!
More information about the Zope
mailing list