I am developing an add-on for Plone. I want to know how to access data from another add-on.
what do you mean with "access other data"?
What is the other add-on? Usually add-ons store everything in an object in the site.
The add on is bika.health. I want to create an addon the can access data from the bika.health add on. Is there a way to create a new custom form that can access and update data from bika.health without creating a content type and add-on?
plone.api is the standard tool for interacting with Plone. Archetypes content provides setter and getter methods, Dexerity content is usually managed using attribute access.
You can create a browserview. This let's you write python code to access data in thr site and display it using a URL. You can use an action to make that URL clickable within thr site. Or using a static text portlet.
If using plone 5, rapido is a quicker way to do the same thing without creating a plugin.
I'm curious why you need to do this...I'd expect bika.health to provide all the forms and functionality needed to access and update the data it creates. Are you sure you can't just customize what bika.health already provides?
I am a total novice to development in Plone. Bika.Health seems to be complete. However, We want to integrate a custom form for used for Integrated Disease Surveillance and Response Alert. We will also need custom reporting format that are generated automatically per disease. Some of the fields can be map directly to some of the variables of Bika.health / Bika.Lims.
@austinsdoe If you are completely new to plone and you have a complex form like that, then my suggestion would be to use Plomino. This will allow you to construct the form visually without having to learn the complexities of plones various form libraries, html, css etc. Then you can write a small online to say how you want it to insert the data into bika, or even pre-populate the form from bika.
If you want to distribute your custom form for others to use as a plone plugin, this might not be the best way to go however.
We want whatever form that is created to be a Plone Plugin. The place I am stuck is accessing the Bika.Health Data. That is read or writing. If My instance of Plone was built over a traditional relationship database it would have been much easier. Just do not know how to access the zoDB.
@austinsdoe first understand the ZODB and that iteracting with it is like interacting with normal python objects in memory. There are other tutorials but here is one - http://www.zodb.org/en/latest/documentation/tutorial.html
Bika I'm guess most likely uses Archetypes as an additional layer on its base objects. In which case, look through - http://docs.plone.org/4/en/old-reference-manuals/archetypes/
Once you have your context object it should be just a matter of using either .update or .setX to modify data.
Austin, start from here:
this are content types. You can find them in you plone sites. You can access their methods and properties. Also, you can contact their community here: https://github.com/bikalabs/bika.lims/wiki/Community (for example irc) and submit a feature request, for example.
@austinsdoe I think I slowly understand your question/problem.
The ZODB stores data in a tree of objects. So in order to access data you need to lookup the object either by traversal or by querying the catalog.
In both cases you end up with an loaded ZODB object, in Plone this is a instance of the content-type. Loading happens in background, so you do not need to care about it. Same is with transactions.
All information on this object is accessible directly as Python attributes or methods or using an adapter. It depends on the content-type framework used. With Archetypes each field on
'myfield is accessible with
obj.getMyField() (get plus fieldnames first letter uppcased). With the more modern Dexterity there are two different access methods, depending on the kind of schema used: direct schemas or behaviors based schemas. For direct schamas you just use attribute access. So a field
myfield is accessed (and set) using
obj.myfield. For behaviors you first need to get the behavior adapter by adapting
adapter = IMySchema(obj) and then do a
adapter.myfield. Behaviors are often storing its attributes directly on the object, so often its possible to use direct object access, but it is not recommended.
I hope that helps a bit.
@austinsdoe if you are a total novice to Plone development, I don't recommend you try building this except possibly with Plomino as @djay suggests, but even then you might still be lost conceptually. You would be best off finding someone who has development experience with Plone (anyone in this thread or see Plone.com/providers) and preferably Bika.
Thank you all for your suggestions.