[kforge-dev] Error in kforge trunk related to creation of trac service via web user interface
John Bywater
john.bywater at appropriatesoftwarefoundation.org
Fri Aug 25 20:22:31 UTC 2006
Rufus Pollock wrote:
> When I try to create a trac service via the web interfact I get the
> following error:
>
Woops!
>> There's been an error:
>>
Sorry!
>> File
>> "/home/kforge/test.kforgeproject.com/system/lib/python/kforge/django/apps/kui/views/service.py",
>>
>> line 131, in getManipulatedObjectRegister return
>> service.plugin.getExtnRegister()
>>
>> AttributeError: 'NoneType' object has no attribute 'plugin'
>
>
> Relevant method is:
>
> def getManipulatedObjectRegister(self):
> service = self.getAssociationObject()
> return service.plugin.getExtnRegister()
Yes, something is broken.
>
> getAssociatedObject
getAssociat-ION-Object :-) I think you looked at the right code though....
> is defined in dm.view.base.AbstractHasManyView where it is set to None
> in the __init__ method. I can't see it being set anywhere else. John,
> I know you wrote this section of the code so I wondered if you knew
> what was going on here and what should be fixed (would be useful to
> know what an associationObject was or was supposed to do -- some
> documentation on that class might be useful ...).
Some more tests would also be useful. That method is in the
ServiceExtnView, which I'll come back to. Firstly...
## Associate, Aquaintance, Associations ##
In OO terminology, an object can have be associated with another. The
association is sometimes an object.
In KForge a Person can have an association with a Project. The
association is called Member. The Project is then an associated object
or an aquaintance of the Person.
Likewise, a Service is an association between a Project and a Plugin.
## AbstractHasManyView ##
The abstract HasMany view is the base class for CRUDing the register of
objects held by a domain object within a HasMany attribute.
The getAssociationObject() method is used to retrieve the object keyed
by the hasManyKey (a string) in the domain object's HasMany attribute
register.
## ServiceView ##
For Service views, you get a Service domain object by calling the
getAssociationObject method. This happens a lot in the Service views.
## ServiceExtnView ##
The ServiceExtnView extends the Service view, and supportings CRUDing of
service extentions, which is the mechanism to plugin the particular
objects of plugin service instance into the domain model (such as the
TracProject object which is needed to support associating a Trac Service
with a Subversion Service).
As such, this view always expects that the Service object is available.
It isn't available. The service variable has a ref to None.
## Diagnosis ##
There is a problem with the trac Service object being located. Does it
exist? Was it created with the previous page? Ie if you click back to
the Project read view and refresh, does the object appear? It so, there
is something wrong with finding a new trac Service in that ServiceExtn view.
An exception reporting the non-existence of the Service object would be
sufficient documentation for this error. Perhaps this could usefully be
in a getService() method on the ServiceExtnView.
I'll try to replicate the problem. Will let you know what happens.
In the meantime, can you write a test to reveal this problem?
Regards,
John.
More information about the kforge-dev
mailing list