SlideShare ist ein Scribd-Unternehmen logo
1 von 10
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Mehr von Jens Klein

RelStorage Plone Zope RDB Storage Backend
RelStorage Plone Zope RDB Storage BackendRelStorage Plone Zope RDB Storage Backend
RelStorage Plone Zope RDB Storage BackendJens Klein
 
Plone Performance, Profiling, Power-Consumption
Plone Performance, Profiling, Power-ConsumptionPlone Performance, Profiling, Power-Consumption
Plone Performance, Profiling, Power-ConsumptionJens Klein
 
RelStorage - an alternative ZODB Backend
RelStorage - an alternative ZODB BackendRelStorage - an alternative ZODB Backend
RelStorage - an alternative ZODB BackendJens Klein
 
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 2009Jens Klein
 
Projekte mit Plone
Projekte mit PloneProjekte mit Plone
Projekte mit PloneJens Klein
 
Plone - Community, Entwicklung, Support
Plone - Community, Entwicklung, SupportPlone - Community, Entwicklung, Support
Plone - Community, Entwicklung, SupportJens Klein
 
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 DaidalosJens Klein
 

Mehr von 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
 

Kürzlich hochgeladen

New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...itnewsafrica
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Kaya Weers
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 

Kürzlich hochgeladen (20)

New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 

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