SlideShare a Scribd company logo
1 of 10
Download to read offline
Plone Conference 2009
                         Budapest
                    Lightning Talk

    cornerstone.soup
     isolated container
   for queryable records

Jens Klein <jens@bluedynamics.com>

           2010-10-29
                           Creative Commons Namensnennung-
                           Keine kommerzielle Nutzung-
                           Keine Bearbeitung 3.0 Österreich Lizenz
Use-Cases

Need Container for many entities (mass-data)
of non-CMSish content, like:
    –   Votes,
    –   Data from a Poll,
    –   Orders in a Webshop,
    –   measuring data,
    –   (fill in your use-case here)


tested with Plone 3.3

                                        Creative Commons Namensnennung-
                                        Keine kommerzielle Nutzung-
                                        Keine Bearbeitung 3.0 Österreich Lizenz
Soup Characteristics

●   isolated: all in one persistent local utility;
●   stores generic „Records“:
        –   persistent items
        –   with attributes passed in at construction time as
             keyword arguments.
●   has its own local index (ZopeToolKit);
●   fetches items by query.



                                                Creative Commons Namensnennung-
                                                Keine kommerzielle Nutzung-
                                                Keine Bearbeitung 3.0 Österreich Lizenz
Recipe
                               Cook your own Soup
Heat editor in a large soucepan, subclass the soup      1
object and give it an appropriate id:

  >>> from cornerstone.soup import Soup
  >>> class MySoup(Soup):
  ...     id = u'mysoup'




                                             Creative Commons Namensnennung-
                                             Keine kommerzielle Nutzung-
                                             Keine Bearbeitung 3.0 Österreich Lizenz
Recipe
                               Cook your own Soup
Provide a Catalog Factory and cook for 2-3 minutes, until 2
softened but not colored.

  >>>   from zope.interface import implements
  >>>   from zope.catalog.catalog import Catalog
  >>>   from zope.catalog.field import FieldIndex
  >>>   from cornerstone.soup.interfaces import ICatalogFactory
  >>>   class MyCatalogFactory(object):
  ...       implements(ICatalogFactory)
  ...
  ...       def __call__(self):
  ...           catalog = Catalog()
  ...           catalog[u'name'] = FieldIndex(field_name='name',
  ...                                      field_callable=False)
  ...           return catalog



                                                Creative Commons Namensnennung-
                                                Keine kommerzielle Nutzung-
                                                Keine Bearbeitung 3.0 Österreich Lizenz
Recipe
                                Cook your own Soup
Add one utility registered under the same name as      3
the soup-id, stirring, for 20 seconds:

  <utility
     name="mysoup"
     factory=".mymodule.MyCatalogFactory"
     provides="cornerstone.soup.interfaces.ICatalogFactory"
  />




                                               Creative Commons Namensnennung-
                                               Keine kommerzielle Nutzung-
                                               Keine Bearbeitung 3.0 Österreich Lizenz
Recipe
                                Cook your own Soup
                                                               4
Add two local utilities to componentregistry.xml registered under
the same name as the soup-id, and
bring to boil.

 <utilities>
   <utility
      name="mysoup"
      factory="mymodule.MySoup"
      interface="cornerstone.soup.interfaces.ISoup"
   />
   <utility
      name="mysoup"
      factory="five.intid.intid.OFSIntIds"
      interface="zope.app.intid.interfaces.IIntIds"
   />
 </utilities>


                                                   Creative Commons Namensnennung-
                                                   Keine kommerzielle Nutzung-
                                                   Keine Bearbeitung 3.0 Österreich Lizenz
Recipe
                                 Cook your own Soup
Start your Plone, turn heat to low, cover and      5
simmer for some minutes.

Go to portal_setup and import your packages GenericSetup profile.

Season and add a little more data if desired.

  >>> from zope.component import getUtility
  >>> from cornerstone.soup.interfaces import ISoup
  >>> soup = getUtility(ISoup, name=u'mysoup')

  >>>   from cornerstone.soup import Record
  >>>   rec = Record(name=u'rec1')
  >>>   soup.add(rec)
  >>>   rec = Record(name=u'rec2')
  >>>   soup.add(rec)


                                                  Creative Commons Namensnennung-
                                                  Keine kommerzielle Nutzung-
                                                  Keine Bearbeitung 3.0 Österreich Lizenz
Enjoy your soup
                                    bon appetit!

Query data:

  >>> soup.query(name=u'rec1')
  [<Record at /.../record-0>]

  >>> soup.query(name=u'rec2')
  [<Record at /.../record-1>]

Modify data:

  >>> rec.data['name'] = u'rec1'
  >>> soup.reindex([rec])
  >>> soup.query(name=u'rec1')
  [<Record at /.../record-0>, <Record at /.../record-1>]

                                           Creative Commons Namensnennung-
                                           Keine kommerzielle Nutzung-
                                           Keine Bearbeitung 3.0 Österreich Lizenz
Ingredients and
                         complete recipe




http://pypi.python.org/pypi/cornerstone.soup




                                   Creative Commons Namensnennung-
                                   Keine kommerzielle Nutzung-
                                   Keine Bearbeitung 3.0 Österreich Lizenz

More Related Content

More from Jens Klein

Plone - Community, Entwicklung, Support
Plone - Community, Entwicklung, SupportPlone - Community, Entwicklung, Support
Plone - Community, Entwicklung, Support
Jens Klein
 

More from Jens Klein (7)

RelStorage Plone Zope RDB Storage Backend
RelStorage Plone Zope RDB Storage BackendRelStorage Plone Zope RDB Storage Backend
RelStorage Plone Zope RDB Storage Backend
 
Plone Performance, Profiling, Power-Consumption
Plone Performance, Profiling, Power-ConsumptionPlone Performance, Profiling, Power-Consumption
Plone Performance, Profiling, Power-Consumption
 
RelStorage - an alternative ZODB Backend
RelStorage - an alternative ZODB BackendRelStorage - an alternative ZODB Backend
RelStorage - an alternative ZODB Backend
 
AGX - Tree Transformations with Python - Lightning Talk at Plone Conference 2009
AGX - Tree Transformations with Python - Lightning Talk at Plone Conference 2009AGX - Tree Transformations with Python - Lightning Talk at Plone Conference 2009
AGX - Tree Transformations with Python - Lightning Talk at Plone Conference 2009
 
Projekte mit Plone
Projekte mit PloneProjekte mit Plone
Projekte mit Plone
 
Plone - Community, Entwicklung, Support
Plone - Community, Entwicklung, SupportPlone - Community, Entwicklung, Support
Plone - Community, Entwicklung, Support
 
Plone Conference 2007 Naples: Lightning Talk Daidalos
Plone Conference 2007 Naples: Lightning Talk DaidalosPlone Conference 2007 Naples: Lightning Talk Daidalos
Plone Conference 2007 Naples: Lightning Talk Daidalos
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 

cornerstone.soup Lighning Talk on Plone Conference 2009

  • 1. Plone Conference 2009 Budapest Lightning Talk cornerstone.soup isolated container for queryable records Jens Klein <jens@bluedynamics.com> 2010-10-29 Creative Commons Namensnennung- Keine kommerzielle Nutzung- Keine Bearbeitung 3.0 Österreich Lizenz
  • 2. Use-Cases Need Container for many entities (mass-data) of non-CMSish content, like: – Votes, – Data from a Poll, – Orders in a Webshop, – measuring data, – (fill in your use-case here) tested with Plone 3.3 Creative Commons Namensnennung- Keine kommerzielle Nutzung- Keine Bearbeitung 3.0 Österreich Lizenz
  • 3. Soup Characteristics ● isolated: all in one persistent local utility; ● stores generic „Records“: – persistent items – with attributes passed in at construction time as keyword arguments. ● has its own local index (ZopeToolKit); ● fetches items by query. Creative Commons Namensnennung- Keine kommerzielle Nutzung- Keine Bearbeitung 3.0 Österreich Lizenz
  • 4. Recipe Cook your own Soup Heat editor in a large soucepan, subclass the soup 1 object and give it an appropriate id: >>> from cornerstone.soup import Soup >>> class MySoup(Soup): ... id = u'mysoup' Creative Commons Namensnennung- Keine kommerzielle Nutzung- Keine Bearbeitung 3.0 Österreich Lizenz
  • 5. Recipe Cook your own Soup Provide a Catalog Factory and cook for 2-3 minutes, until 2 softened but not colored. >>> from zope.interface import implements >>> from zope.catalog.catalog import Catalog >>> from zope.catalog.field import FieldIndex >>> from cornerstone.soup.interfaces import ICatalogFactory >>> class MyCatalogFactory(object): ... implements(ICatalogFactory) ... ... def __call__(self): ... catalog = Catalog() ... catalog[u'name'] = FieldIndex(field_name='name', ... field_callable=False) ... return catalog Creative Commons Namensnennung- Keine kommerzielle Nutzung- Keine Bearbeitung 3.0 Österreich Lizenz
  • 6. Recipe Cook your own Soup Add one utility registered under the same name as 3 the soup-id, stirring, for 20 seconds: <utility name="mysoup" factory=".mymodule.MyCatalogFactory" provides="cornerstone.soup.interfaces.ICatalogFactory" /> Creative Commons Namensnennung- Keine kommerzielle Nutzung- Keine Bearbeitung 3.0 Österreich Lizenz
  • 7. Recipe Cook your own Soup 4 Add two local utilities to componentregistry.xml registered under the same name as the soup-id, and bring to boil. <utilities> <utility name="mysoup" factory="mymodule.MySoup" interface="cornerstone.soup.interfaces.ISoup" /> <utility name="mysoup" factory="five.intid.intid.OFSIntIds" interface="zope.app.intid.interfaces.IIntIds" /> </utilities> Creative Commons Namensnennung- Keine kommerzielle Nutzung- Keine Bearbeitung 3.0 Österreich Lizenz
  • 8. Recipe Cook your own Soup Start your Plone, turn heat to low, cover and 5 simmer for some minutes. Go to portal_setup and import your packages GenericSetup profile. Season and add a little more data if desired. >>> from zope.component import getUtility >>> from cornerstone.soup.interfaces import ISoup >>> soup = getUtility(ISoup, name=u'mysoup') >>> from cornerstone.soup import Record >>> rec = Record(name=u'rec1') >>> soup.add(rec) >>> rec = Record(name=u'rec2') >>> soup.add(rec) Creative Commons Namensnennung- Keine kommerzielle Nutzung- Keine Bearbeitung 3.0 Österreich Lizenz
  • 9. Enjoy your soup bon appetit! Query data: >>> soup.query(name=u'rec1') [<Record at /.../record-0>] >>> soup.query(name=u'rec2') [<Record at /.../record-1>] Modify data: >>> rec.data['name'] = u'rec1' >>> soup.reindex([rec]) >>> soup.query(name=u'rec1') [<Record at /.../record-0>, <Record at /.../record-1>] Creative Commons Namensnennung- Keine kommerzielle Nutzung- Keine Bearbeitung 3.0 Österreich Lizenz
  • 10. Ingredients and complete recipe http://pypi.python.org/pypi/cornerstone.soup Creative Commons Namensnennung- Keine kommerzielle Nutzung- Keine Bearbeitung 3.0 Österreich Lizenz