• Remember Mailing List

install/migration problem

from "Michael A Rowley, MD" on Oct 21, 2006 07:59 AM
	From: 	  os2mac@...
	Subject: 	install/upgrade help
	Date: 	October 21, 2006 1:44:25 PM EDT
	To: 	  remember@...

Hello,

trying to move my project over to membrane/remember and having some  
problems with the migration.  the project was originally written for  
CMFMember,  I have 3 custom member types, and have converted them  
over to remember, and have the site isntalling ok, but when I try to  
add a member who is not of a default member type, I get an error:

Using Plone 2.4.3,
	Zope 2.9.5 final
	Plone 2.5.1
	membrane cvs-0.3-unreleased, checked out about the 14th of October
	remember cvs on the 14th also

I managed to get the isntall working,  which was a bit of a challenge  
until i found the stuff in remember about the properies problem...  
had to do that manually...

my Provider type is:


> class Provider(BrowserDefaultMixin, BaseMember,  
> atapi.BaseBTreeFolder):
>     """
>     TORCH member subclass for Providers on the site.
>     """
>     security = ClassSecurityInfo()
>     base_archetype = atapi.BaseBTreeFolder
>     archetype_name = portal_type = meta_type = 'Provider'
>     schema = provider_schema + metadata_schema
>     global_allow=0
>     _at_rename_after_creation = True
>     default_roles = ('Member','Provider','Staff',)
>     # messages?
>     left_slots = ('here/portlet_ehrList/macros/portlet',)
>     # workflow lists
>     right_slots = ()
>
>     actions = (
>         {'id':'view',
>          'name':'View',
>          'action':'string:${object_url}/provider_view',
>          'permissions':(torchpermissions.VIEW_PROVIDER_PERMISSION,)},
>         {'id':'edit',
>          'name':'Edit',
>          #'action':'string:${object_url}/provider_edit',
>          'action':'string:${object_url}/provider_edit',
>          'permissions':(torchpermissions.EDIT_PROVIDER_PERMISSION,)},
>         )
>
>     factory_type_information = {
>         'immediate_view':'provider_view',
>         }
>
>     ##################
>     ## METHODS
>     ##################
>
>     def __call__(self, *args, **kwargs):
>         return self.getId()
>
>     def generateNewId(self):
>         """
>         This is used by Archetypes ProcessForm to rename the object  
> after it is created.
>         We will use it to set our uid to a nice default.
>
>         We should let the user select a uid, and let validation  
> check for correct
>         content, and that it is a viable userid.  If left blank,  
> then make a default.
>
>         Default ID for providers: Lastname[Degree id MD, DO, ARNP,  
> PA][dob as yymmdd]
>         """
>         sep = '_'
>         fn = self.getFirstname()
>         mn = self.getMiddlename() or sep
>         ln = self.getLastname()
>         degree = self.getDegree()
>         id = '%s%s%s%s' % (fn[:1], mn[:1], ln, degree)
>         iteration = 1
>         mdt = getToolByName(self, 'portal_memberdata')
>         while mdt.has_key(id):
>             # add a number to the lname...
>             id = '%s%s%s%s%s' % (fn[:1], mn[:1], ln, degree,  
> iteration)
>             iteration += 1
>         return id
>
>     ########################
>     ## Schema Methods
>     ########################
>
>     security.declareProtected 
> (torchpermissions.EDIT_PROVIDER_PERMISSION, 'setHonorarium')
>     def setHonorarium(self, honorarium):
>         self.getField('honorarium').set(self, string.capitalize 
> (honorarium))
>
>     security.declareProtected 
> (torchpermissions.EDIT_PROVIDER_PERMISSION, 'setFirstname')
>     def setFirstname(self, firstname):
>         self.getField('firstname').set(self, string.capitalize 
> (firstname))
>
>     security.declareProtected 
> (torchpermissions.EDIT_PROVIDER_PERMISSION, 'setMiddlename')
>     def setMiddlename(self, middlename):
>         self.getField('middlename').set(self, string.capitalize 
> (middlename))
>
>     security.declareProtected 
> (torchpermissions.EDIT_PROVIDER_PERMISSION, 'setLastname')
>     def setLastname(self, lastname):
>         self.getField('lastname').set(self, string.capitalize 
> (lastname))
>
>     def calcFullname(self):
>         """
>         set the fullname, and add the name to the alias list.
>         """
>
>         namelist = []
>         #hn = self.getHonorarium()
>         fn = self.getFirstname()
>         if fn:
>             namelist.append(fn)
>         mn = self.getMiddlename()
>         if mn:
>             namelist.append(mn)
>         ln = self.getLastname()
>         if ln:
>             namelist.append(ln)
>         sf = self.getSuffix()
>         if sf:
>             namelist.append(sf)
>         dg = self.getDegree()
>         if dg:
>             namelist.append(dg)
>
>         fullname = ' '.join(namelist)
>
>         return fullname
>
>     ##################
>     ## User Interface
>     ##################
>
>     security.declareProtected 
> (torchpermissions.VIEW_PROVIDER_PERMISSION, 'provider_identifier')
>     def provider_identifier(self):
>         """ returns a user friendly identifier of the member,  
> fullname by
>         default.  can be overridden in subclasses to support different
>         filing policies.  used by the Title field.
>         """
>         fn = self.getFullname()
>         degree = self.getDegree()
>         specialty = self.getSpecialty()
>         return '%s %s %s' % (fn, degree, specialty)
>
>     security.declareProtected 
> (torchpermissions.VIEW_PROVIDER_PERMISSION, 'fileAs')
>     def fileAs(self):
>         """ returns a user friendly identifier of the member,  
> fullname by
>         default.  can be overridden in subclasses to support different
>         filing policies.  used by the Title field.
>         """
>         fn = self.getFullname()
>         dg = self.getDegree()
>
>         return '%s %s' % (fn, dg)
>
> atapi.registerType(Provider)
> InitializeClass(Provider)
>


In testing, I try to add a member like so:


>     def addProvider(self):
>         md = self.mdata
>         newId = self.portal.generateUniqueId('Provider')
>         md.invokeFactory(type_name='Provider', id=newId)
>         provider = md._getOb(newId)
>         transaction.get().commit(True)
>         provider.processForm(values=testProviderData)
>         self.testProvId = provider.getId()
>         self.provider = provider
>

and get the following Error.


> Error in test testPtDataContainerInstall  
> (Products.TORCH2.tests.testInstall.testInstall)
> Traceback (most recent call last):
>   File "/Applications/Plone-2.5.1/lib/python/Testing/ZopeTestCase/ 
> profiler.py", line 86, in __call__
>     self.setUp()
>   File "/Applications/Plone-2.5.1/lib/python/Testing/ZopeTestCase/ 
> PortalTestCase.py", line 62, in setUp
>     self.afterSetUp()
>   File "/Applications/Plone-2.5.1/Instance/Products/TORCH2/tests/ 
> torchTestCase.py", line 64, in afterSetUp
>     self.addProvider()
>   File "/Applications/Plone-2.5.1/Instance/Products/TORCH2/tests/ 
> torchTestCase.py", line 79, in addProvider
>     md.invokeFactory(type_name='Provider', id=newId)
>   File "/Applications/Plone-2.5.1/Instance/Products/CMFCore/ 
> PortalFolder.py", line 408, in invokeFactory
>     return pt.constructContent(type_name, self, id, RESPONSE,  
> *args, **kw)
>   File "/Applications/Plone-2.5.1/Instance/Products/CMFCore/ 
> TypesTool.py", line 934, in constructContent
>     ob = info.constructInstance(container, id, *args, **kw)
>   File "/Applications/Plone-2.5.1/Instance/Products/CMFCore/ 
> TypesTool.py", line 341, in constructInstance
>     raise AccessControl_Unauthorized('Cannot create %s' % self.getId 
> ())
> Unauthorized: Cannot create Provider
>

I updated the portal_memberdata portal_types properties to allow a  
Provider object, but still getting this error.


when I try to do this through the web logged in as admin, I get the  
following:


> Traceback (innermost last):
>
>     * Module ZPublisher.Publish, line 115, in publish
>     * Module ZPublisher.mapply, line 88, in mapply
>     * Module ZPublisher.Publish, line 41, in call_object
>     * Module Products.CMFFormController.FSControllerPageTemplate,  
> line 96, in __call__
>     * Module Products.CMFFormController.BaseControllerPageTemplate,  
> line 39, in _call
>     * Module Products.CMFFormController.ControllerBase, line 245,  
> in getNext
>       __traceback_info__: ['id = provider_edit', 'status =  
> success', 'button=None', 'errors={}', 'context=<Provider at  
> provider.2006-10-21.1494294206>', "kwargs={'portal_status_message':  
> 'Your changes have been saved.'}", 'next_action=None', '']
>     * Module Products.CMFFormController.Actions.TraverseTo, line  
> 36, in __call__
>     * Module ZPublisher.mapply, line 88, in mapply
>     * Module ZPublisher.Publish, line 41, in call_object
>     * Module Products.CMFFormController.FSControllerPythonScript,  
> line 108, in __call__
>     * Module Products.CMFFormController.Script, line 141, in __call__
>     * Module Products.CMFCore.FSPythonScript, line 108, in __call__
>     * Module Shared.DC.Scripts.Bindings, line 311, in __call__
>     * Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec
>     * Module Products.CMFCore.FSPythonScript, line 164, in _exec
>     * Module None, line 1, in content_edit
>       <FSControllerPythonScript at /torch/content_edit used for / 
> torch/portal_memberdata/provider.2006-10-21.1494294206>
>       Line 1
>     * Module Products.CMFCore.FSPythonScript, line 108, in __call__
>     * Module Shared.DC.Scripts.Bindings, line 311, in __call__
>     * Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec
>     * Module Products.CMFCore.FSPythonScript, line 164, in _exec
>     * Module None, line 11, in content_edit_impl
>       <FSPythonScript at /torch/content_edit_impl used for /torch/ 
> portal_memberdata/provider.2006-10-21.1494294206>
>       Line 11
>     * Module Products.Archetypes.BaseObject, line 645, in processForm
>     * Module Products.Archetypes.BaseObject, line 634, in _processForm
>       __traceback_info__: (<Provider at /torch/portal_memberdata/ 
> provider.2006-10-21.1494294206>, <Field id(string:rw)>, <bound  
> method Provider.setId of <Provider at /torch/portal_memberdata/ 
> provider.2006-10-21.1494294206>>)
>     * Module Products.Archetypes.utils, line 161, in mapply
>     * Module Products.remember.content.member, line 92, in setId
>
> AttributeError: 'NoneType' object has no attribute 'setId'
>




can anyone help me with this, or perhaps there is some working code I  
can look at?  I have only intermittant access to the web right now,  
so may be a couple of days before I can get back... Sorry for the  
delay, but it is the life I lead right now. ;)Such as life is without  
the internet.

and anyway, sometimes asking the question seems to be cathartic, and  
I can find an answer after I ask.

Much appreciated.

Michael





Return to date view: threaded or flat