Greetings, I have worked through the prototype in "The Zope Bible" and have run into trouble while creating my first "real" application. I am working on a web based product to aid volunteer fire departments manage their administrative work. I have based my class "Departments" on the "Entry" Classi n the AddressBook prototype and can add and delete departments as expected (getting them to list to the screen). My problem is that when I "click" a department, instead of getting the expected departmentDetails screen, I get an error saying the Departmetns has an empty or missing Doc string. Here is my "Department" Class, with many fields deleted for brevity... -- Begin Code -- from Globals import Persistent, DTMLFile from Acquisition import Implicit from OFS.SimpleItem import Item class Department(Item, Persistent, Implicit): "Arfs Department Entry" meta_type="Arfs Department" def __init__(self, fdid, department_name=''): "Init Method" self.editDepartment(fdid, department_name) def editDepartment(self, fdid = '', # FDID department_name = '', # Name ... fields deleted for brevity... REQUEST = None): "A Method for Editing Arfs Department Entried" self.fdid = fdid self.department_name = department_name ... fields deleted for brevity ... if REQUEST is not None: return self.editDepartmentForm(self, REQUEST) # Web Presentation Methods editEntryForm = DTMLFile("dtml/editDepartmentForm", globals()) index_html = DTMLFile("dtml/departmentDetails", globals()) --- End Code --- Here is 'dtml/departmentDetails'... --- Start Code --- <dtml-var standard_arfs_header> <form action="./editEntryForm" method="post"> <input type=submit value='Edit Department'> </form> <h1><dtml-var department_name></h1> <table border=0 cellspacing=0 cellpadding=5> <dtml-if fdid> <tr> <th>FDID:</th> <td><dtml-var fdid</td> </tr><tr> <th>Department Name:</th> <td><dtml-var department_name></td> </tr> </dtml-if> </table> <dtml-var standard_arfs_footer> --- End Code --- I think the problem may me in the way I am adding the departments to the application. In the prototype, we set a variable in the constructor of the AddressBook Class, but since all fire departments (in the US) have a uniquie Fire Department Id (fdid), I am using it for the index of the department. I place the department in a dictionary named "Departments" as follows (code deleted for brevity): --- Begin Code --- class Arfs(SimpleItem): "An Arfs Object" meta_type="Arfs" def __init__(self, id, title): self.id = id self.title = title self.Departments = {} def __getitem__(self, fdid): return self.Departments[str(fdid)].__of__(self) def addDepartment(self, fdid, department_name = '', REQUEST = None): "Method to Add a Department to Arfs" new_department = Department(fdid, department_name) self.Departments[str(fdid)] = new_department self.__changed__(1) if REQUEST is not None: return self.index_html(self, REQUEST) --- End Code --- I expect to be able to go to http://localhost/Arfs/23005 to get the departmentDetails for Vilonia Fire & Rescue (my department), but I get the "Departments has an empty or missing Doc String" error. I know this is a long post (thanks for sticking with it this long!)...but do you see what I've missed? I've spent 2 days looking for it, but can't find it. Any help would be appreciated.
Also...I've been reading up on the CMF, and wonder if it would be applicable to an application where multiple users would be managing their departments. This would entail lots of forms and a database interface. Most, if not all of the CMF examples I have seen so far are sites to post articles; would I be well advised to look into CMF for my application? Thanks for your time, and Merry Christmas (or Happy Holidays :-) to all; Captian Greg Lindstrom Vilonia Fire & Rescue Vilonia, Arkansas (USA)
"" wrote at 2002-12-24 13:23 -0600:
I have worked through the prototype in "The Zope Bible" and have run into trouble while creating my first "real" application. I am working on a web based product to aid volunteer fire departments manage their administrative work. I have based my class "Departments" on the "Entry" Classi n the AddressBook prototype and can add and delete departments as expected (getting them to list to the screen). My problem is that when I "click" a department, instead of getting the expected departmentDetails screen, I get an error saying the Departmetns has an empty or missing Doc string. All methods accessed directly via the Web must have a so called "Doc string".
This is a string as first expression inside the function definition. The methods your showed us have had doc strings but they are not relevant for the described problem. Find the method that lacks the doc string and add it. Dieter
participants (2)
-
Dieter Maurer -
yuba@cyberback.com