[Zope] Cant seem to get this to work.... RE: Import Questions

Bill Hewitt wphewitt at comcast.net
Tue Sep 14 03:12:36 EDT 2004


Hi, sorry to keep sounding so stupid....But I cant get this to work - I
get an error:


An error was encountered while publishing this resource. 

exceptions.AttributeError

Sorry, a site error occurred.

Traceback (innermost last):

      * Module ZPublisher.Publish, line 150, in publish_module
      * Module ZPublisher.Publish, line 114, in publish
      * Module ZPublisher.Publish, line 98, in publish
      * Module ZPublisher.mapply, line 88, in mapply
      * Module ZPublisher.Publish, line 39, in call_object
      * Module Products.Campus.Campus, line 184, in manage_addCampus
AttributeError: manage_addBuilding

I have the following module that is supposed to create a "Campus"
instance and then a "building instance inside the campus instance.....
But neither the "manage_addBuilding" nor the "manage_addBuildingForm"
are found when I try to run it.... Note that these methods exist in
another product module (Products.Virtual_site.Building)...

It works fine if the Building Module is in the same Product directory as
this Module... 

How do I get this module to find these and  other
Products/modules/methods?

TIA

WPH

---------------------------------------------

from OFS.Folder import Folder
from Globals import HTMLFile
from Globals import Persistent
from Acquisition import Implicit
from DateTime import DateTime
from Products.Virtual_Site.Building import Building
from Products.Virtual_Site.TransDrawer import TransDrawer

class Campus (Folder, 
              Persistent,
	      Building,
	      Implicit):

    _is_transparent = 1
    # Once the transparency patch is in place,
    # the above attribute is all we need to make something transparent.

    meta_type = 'Campus'

    def all_meta_types(self):

       return (
               {
                'name' : 'Building',
                'action': 'manage_addBuildingForm',
                'permission': 'Add Building',
               },
              )	 
    
          
def manage_addCampus(self, 
                     id='', 
		     title='',
		     createPublic=0, 
		     createUserF=0,
                     REQUEST=None):
		      
    """Add a new Campus object with id *Campus*.
 
    If the 'createPublic' and 'createUserF' parameters are set to any   
true
    value, an 'index_html' and a 'UserFolder' objects are created
respectively
    in the new Campus.
    """
    ob=Campus()

    id='CAMPUS'

    ob.id=id    
    ob.title=REQUEST['acronym'] + ' ' + 'Campus'
    self._setObject(id, ob)
    ob.manage_addProperty('entity', 'campus', 'string')
    ob.manage_addProperty('entitystring', 'Campus', 'string')
    ob.manage_addProperty('exposure', 'Public', 'string')
    ob.manage_addProperty('securitycondition', 'Low', 'string')
    ob.manage_addProperty('submissiondate', DateTime(), 'string')
    ob.manage_addProperty('submitter', REQUEST['AUTHENTICATED_USER'],
'string')
    ob.manage_addProperty('campus' + 'title', REQUEST['title'],
'string')
    ob.manage_addProperty('campus' + 'acronym', REQUEST['acronym'],
'string')


    # Add an Office Building inside the Campus...
    
    id=REQUEST['acronym']
    title=REQUEST['title']
    acronym=REQUEST['acronym']
    entity='building'
    entitystring='Building'
    exposure='Public'
    submitter=REQUEST['AUTHENTICATED_USER']
    
    building = ob.manage_addBuilding(acronym,
                                     title,
				     entity,
				     entitystring,
				     exposure, 
				     submitter)
    
    if REQUEST is not None:
        return self.manage_main(self, REQUEST, update_menu=1)

manage_addCampusForm = HTMLFile('campus_dtml/CampusAddForm', globals())




More information about the Zope mailing list