[Zope-dev] __init__.py does not work
Victor Zhai
Victor.Zhai@ogilvy.com
Mon, 27 Sep 1999 18:15:05 +0800
When I creat a instance of Class Person.
Zope says:
Zope Error
Zope has encountered an error while publishing this resource.
Resource not found
Sorry, the requested Zope resource does not exist.
Check the URL and try again.
Troubleshooting Suggestions
The URL may be incorrect.
The parameters passed to this resource may be incorrect.
A resource that this resource relies on may be encountering an error.
For more detailed information about the error, please refer to the HTML source for this page.
If the error persists please contact the site maintainer. Thank you for your patience.
My Person.py file like this:
-----------------------------------------------------------------
__version__='$Revision: 1.13 $'[11:-2]
import Persistence
import ZODB
manage_addUserDbForm = HTMLFile('addUserDb',globals())
def manage_addUserDb(self, name, age, REQUEST=None):
"""Add a Person instance to Zope """
self._setObject(name,Person(name,age))
if REQUEST is not None:
#Display the Folder that contain the new Person
return self.manage_main(self,REQUEST)
class Person(Persistence.Persistent):
"""A Persistent Person
"""
def __init__(self, name, age):
self.name = name
self.age = age
-------------------------------------------------------------------
My __init__.py like this:
--------------------------------------------------------------------
__doc__="""Person product
$Id: __init__.py,v 1.3 1998/07/16 13:26:54 brian Exp $"""
__version__='$Revision: 1.3 $'[11:-2]
import Person
from ImageFile import ImageFile
meta_types= ?'name':'Person',
'action':'manage_addPersonDbForm'
?,
methods=?
'manage_addUserDbForm': Person.manage_addUserDbForm,
'manage_addUserDb': Person.manage_addUserDb,
?
misc_=?'UserDb_icon': ImageFile('UserDb_icon.gif', globals()),
'User_icon': ImageFile('User_icon.gif', globals()),
?
__ac_permissions__=(
('Add Person Dbs',('manage_addUserDbForm','manage_addUserDb')),
('Change PersonDbs',()),
)
--------------------------------------------------------------------------
addUserdb.dtml file like this
<HTML>
<HEAD>
<TITLE>Add Person Db</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" LINK="#000099" VLINK="#555555" ALINK="#77003B">
<h2>Add User Db</h2>
<FORM ACTION="manage_addUserDb" METHOD="POST">
<TABLE CELLSPACING="2">
<TR>
<TD ALIGN="LEFT" VALIGN="TOP">
<STRONG>
Authentication Type
</STRONG>
</TD>
<TD ALIGN="LEFT" VALIGN="TOP">
Username is:
<INPUT TYPE="TEXT" NAME="name" VALUE="Victor.zhai">
<BR>
Age is:
<INPUT TYPE="TEXT" NAME="age:int" VALUE="26">
</TD>
</TR>
<TR>
<TD></TD>
<TD><BR><INPUT TYPE="SUBMIT" VALUE="Add"></TD>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>
==================================================================================
"WorldSecure Server <ogilvy.com>" made the following
annotations on 09/27/99 06:21:21
------------------------------------------------------------------------------
Privileged/Confidential Information may be contained in this message. If you are not the addressee indicated in this message (or responsible for delivery of the message to such person), you may not copy or deliver this message to anyone. In such case, you should destroy this message and kindly notify the sender by reply email. Please advise immediately if you or your employer does not consent to email for messages of this kind. Opinions, conclusions and other information in this message that do not relate to the official business of the Ogilvy Group shall be understood as neither given nor endorsed by it.
==============================================================================