[Zope] Fwd: Help with Prototype and CMF

yuba@cyberback.com yuba@cyberback.com
Tue, 24 Dec 2002 13:23:23 -0600


Greetings,
=20
I have worked through the prototype in "The Zope Bible" and have run into trouble while creating my first "real" application=2E  I am working on a web based product to aid volunteer fire departments manage their administrative work=2E  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)=2E  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=
=2E

Here is my "Department" Class, with many fields deleted for brevity=2E=2E=2E

-- Begin Code --
from Globals        import Persistent, DTMLFile
from Acquisition    import Implicit
from OFS=2ESimpleItem import Item

class Department(Item, Persistent, Implicit):
    "Arfs Department Entry"
    meta_type=3D"Arfs Department"
    def __init__(self, fdid, department_name=3D''):
=09"Init Method"
=09self=2EeditDepartment(fdid, department_name)

    def editDepartment(self,
                       fdid            =3D '',  # FDID
=09=09       department_name =3D '',  # Name
              =2E=2E=2E fields deleted for brevity=2E=2E=2E
=09=09       REQUEST         =3D None):
        "A Method for Editing Arfs Department Entried"
=09self=2Efdid            =3D fdid
        self=2Edepartment_name =3D department_name
 =2E=2E=2E fields deleted for brevity =2E=2E=2E
=09if REQUEST is not None:
=09    return self=2EeditDepartmentForm(self, REQUEST)

    # Web Presentation Methods
    editEntryForm =3D DTMLFile("dtml/editDepartmentForm", globals())
    index_html    =3D DTMLFile("dtml/departmentDetails",  globals())

--- End Code ---

Here is 'dtml/departmentDetails'=2E=2E=2E

--- Start Code ---

<dtml-var standard_arfs_header>

<form action=3D"=2E/editEntryForm" method=3D"post">
<input type=3Dsubmit value=3D'Edit Department'>
</form>

<h1><dtml-var department_name></h1>
<table border=3D0 cellspacing=3D0 cellpadding=3D5>
  <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=2E  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=2E  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=3D"Arfs"
    def __init__(self, id, title):
        self=2Eid =3D id
=09self=2Etitle =3D title
=09self=2EDepartments =3D {}

    def __getitem__(self, fdid):
        return self=2EDepartments[str(fdid)]=2E__of__(self)

    def addDepartment(self, fdid,
                            department_name =3D '',
=09=09=09    REQUEST         =3D None):
        "Method to Add a Department to Arfs"
=09new_department =3D Department(fdid, department_name)
=09self=2EDepartments[str(fdid)] =3D new_department
=09self=2E__changed__(1)
=09if REQUEST is not None:
            return self=2Eindex_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=2E  I know this is a long post (thanks for sticking with it this long!)=2E=2E=2Ebut do you see what I've missed?  I've spent 2 days looking for it, but can't find it=2E  Any help would be appreciated=
=2E
>=20
Also=2E=2E=2EI'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=2E  This would entail lots of forms and a database interface=2E  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)