[Product-Developers] need help with creating content using generic setup
Andrew Burkhalter
andrewburkhalter at gmail.com
Wed Dec 10 21:04:25 UTC 2008
> but i think there is a drawback:
> on a larger plone site, having lots of folders, pages, etc the
> catalog-query and update on the objects might take some time.
>
This is why Plone as of 3.2a1 and likely earlier, only reindex the newly
created objects, rather than doing a clear and rebuild of the full catalog.
Here's the relevant code snippet:
members = getattr(p , 'Members')
> members.setTitle(members_title)
> members.setDescription(members_desc)
> members.unmarkCreationFlag()
> if language is not None:
> members.setLanguage(language)
> members.reindexObject()
>
Where 'p' is the plone site. There may be other options and/or
functionality that's being improved in the future, but this is an alternate
approach over the short term.
Andrew
>
>
> On Dec 2, 2008, at 11:43 PM, Andrew Burkhalter wrote:
>
> Oops. Meant to reply all. I'll send the same message to the list.
>
> On Tue, Dec 2, 2008 at 2:43 PM, Andrew Burkhalter <
> andrewburkhalter at gmail.com> wrote:
>
>> I was a bit hasty on the details in my initial response. The reason
>> you're only getting ids within listing views (i.e. navigation, folder
>> listings, etc) is because these are entirely driven from catalog queries.
>> Roughly what's happening when your desired GenericSetup site structure is
>> created is the following:
>>
>> - Create an instance of some type with an id of foo
>> - The creation of this instance is done by the portal_types tool and the
>> particular method leads to a catalog entry with the id, path, and type
>> - From this point forward catalog listings will begin to return the item
>> in question based on what it has available in an item's catalog brains
>> - Next it parses your .properties file setting things like the title and
>> description. It does not however, reindex the item in the catalog.
>>
>> Thus, when you go to an item's full detail page the object has been "woken
>> up" and the presentation is happening entirely based on the values of the
>> content object, not what was in the brain. This also explains why editing
>> and saving an item causes things to work as expected in listing views. That
>> triggers a recatologing.
>>
>> You'll just need to provide the recataloging of each item yourself for
>> consistent behavior across listing and detail pages.
>>
>> Andrew
>>
>>
>>
>> On Tue, Dec 2, 2008 at 12:05 PM, Hilbert Markus <hilbert.markus at gmail.com
>> > wrote:
>>
>>> hi andrew,
>>>
>>> i'll check that.
>>>
>>> thanks for your help
>>>
>>>
>>> there is another point i forgot to mention:
>>>
>>> when calling the folder 'foo' on the portal like
>>> localhost:8080/myportal/foo
>>> the title displayed in the standard folder view (documentfirstheading) is
>>> 'FooBar', which is the title i set inside foo/.properties
>>>
>>> iham
>>>
>>>
>>> On Dec 2, 2008, at 8:58 AM, Andrew Burkhalter wrote:
>>>
>>> The last I checked, there was no way to trigger a portal_catalog
>>> rebuild/update upon content creation. You'll need to either rebuild the
>>> catalog or reindex your created objects after the structure step has run
>>> within a custom import step.
>>>
>>> See for example all of the 'reindexObject' method calls here:
>>>
>>> http://svn.plone.org/svn/plone/Plone/tags/3.1.7/Products/CMFPlone/setuphandlers.py
>>>
>>> Hope that helps.
>>>
>>> Andrew
>>>
>>>
>>> On Thu, Nov 27, 2008 at 6:38 AM, Hilbert Markus <
>>> hilbert.markus at gmail.com> wrote:
>>>
>>>> hi list,
>>>>
>>>> i'm interested in creating some folders by using generic setup.
>>>> i did that following this instruction:
>>>>
>>>> http://plone.org/documentation/how-to/add-a-folder-structure-to-your-product
>>>>
>>>> my profile looks like that:
>>>> profile/
>>>> default/
>>>> structure/
>>>> .objects # containing foo,Large Plone
>>>> Folder
>>>> foo/
>>>> .objects # file is empty
>>>> .properties
>>>>
>>>> .properties contains
>>>> [DEFAULT]
>>>> description = This is a foobar folder
>>>> title = FooBar
>>>>
>>>> after installing the product a 'foo (FooBar)'-folder has been created in
>>>> portal-root.
>>>> but on the plone site (not zmi) the folders displayed title (in
>>>> portal-section and contents-list) is 'foo' like the name of the folder on
>>>> the filesystem.
>>>>
>>>> after clicking edit and save without any changes the correct title
>>>> FooBar is displayed.
>>>> i think thats not the way it should be...
>>>>
>>>> any ideas/help?
>>>>
>>>> ah, my setup (buildout-based)
>>>> * Plone 3.1.7
>>>> * CMF 2.1.1
>>>> * Zope (Zope 2.10.6-final, python 2.4.4, darwin)
>>>> * Python 2.4.4 (#1, Nov 17 2008, 15:59:05) [GCC 4.0.1 (Apple Inc.
>>>> build 5465)]
>>>> * PIL 1.1.6
>>>>
>>>>
>>>> iham
>>>>
>>>>
>>>> _______________________________________________
>>>> Product-Developers mailing list
>>>> Product-Developers at lists.plone.org
>>>> http://lists.plone.org/mailman/listinfo/product-developers
>>>>
>>>
>>>
>>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.plone.org/pipermail/plone-product-developers/attachments/20081210/1aa9b377/attachment.html>
More information about the Product-Developers
mailing list