Successfully reported this slideshow.
Your SlideShare is downloading. ×

plone.api

More Related Content

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all

plone.api

  1. 1. plone.api A simple API for a saner futureA simple API for a saner future
  2. 2. @me github.com/gforcada twitter.com/gforcada Work at der Freitag @me github.com/gforcada twitter.com/gforcada Work at der Freitag
  3. 3. QUICK QUIZQUICK QUIZ
  4. 4. Who knows plone.api?Who knows plone.api?
  5. 5. Who uses plone.api?Who uses plone.api?
  6. 6. plone.apiplone.api
  7. 7. CREDITSCREDITS
  8. 8. Credit where credit is dueCredit where credit is due
  9. 9. plone Konferenz sprint Belgian beer sprint Specially @zupo plone Konferenz sprint Belgian beer sprint Specially @zupo
  10. 10. WHY?WHY?
  11. 11. Get plone site root?Get plone site root?
  12. 12. Check permissions?Check permissions?
  13. 13. GOALSGOALS
  14. 14. «to cover 20% of the tasks any Plone developer does 80% of the time» «to cover 20% of the tasks any Plone developer does 80% of the time»
  15. 15. provide clear API methodsprovide clear API methods
  16. 16. provide clear API methods keeping everything in one place provide clear API methods keeping everything in one place
  17. 17. provide clear API methods keeping everything in one place staying introspectable and discoverable provide clear API methods keeping everything in one place staying introspectable and discoverable
  18. 18. provide clear API methods keeping everything in one place staying introspectable and discoverable being Pythonic provide clear API methods keeping everything in one place staying introspectable and discoverable being Pythonic
  19. 19. APPROACHAPPROACH
  20. 20. DDDDDD
  21. 21. TDDTDD
  22. 22. SGDDSGDD
  23. 23. EXAMPLESEXAMPLES
  24. 24. from plone import api api.portal.get() from plone import api api.portal.get()
  25. 25. from plone import api api.user.has_permission( 'View', username='adam' obj=api.portal.get(), ) from plone import api api.user.has_permission( 'View', username='adam' obj=api.portal.get(), )
  26. 26. from plone import api portal = api.portal.get() training = portal['events']['training'] api.content.copy( source=training, target=portal, ) from plone import api portal = api.portal.get() training = portal['events']['training'] api.content.copy( source=training, target=portal, )
  27. 27. DID YOU NOTICE?DID YOU NOTICE?
  28. 28. Cleans your own code (flake8-plone-api) Cleans your own code (flake8-plone-api)
  29. 29. Raise the barRaise the bar
  30. 30. #303 #302 #286 #244 #214 #211 . . . . #303 #302 #286 #244 #214 #211 . . . .
  31. 31. plone.api pypi.python.org/pypi/plone.api github.com/plone/plone.api docs.plone.org/develop/plone.api/docs/index.html travis-ci.org/plone/plone.api coveralls.io/github/plone/plone.api plone.api pypi.python.org/pypi/plone.api github.com/plone/plone.api docs.plone.org/develop/plone.api/docs/index.html travis-ci.org/plone/plone.api coveralls.io/github/plone/plone.api
  32. 32. FUTURE?FUTURE?
  33. 33. api.portal.get_portal_url() api.portal.run_upgrades() . . . sprinting anyone? api.portal.get_portal_url() api.portal.run_upgrades() . . . sprinting anyone?
  34. 34. Thanks for listening! Thanks for listening!

Editor's Notes

  • I’m Gil Forcada, Plone developer, part of the testing team in Plone and working at der Freitag a German weekly newspaper
  • Before diving into plone.api, just a quick survey to know a bit about the audience
  • Python distribution that provides a simple API to interface with Plone to cover 20% of the tasks any Plone developer does 80% of the time
  • I’m done!
  • I’m not the one behind it, I barely made some fixes and small additions to it
  • If anyone of this list is here, please stand up (applause)
  • - way too many ways to do the same thing
    - way too many packages to know where to look for functionality
    - inconsistent APIs
    - where to learn the basics?
  • So, how did they get there?
  • Documentation driven development
  • Test driven development
  • Style guide driven development
    Code style guide
    How to contribute
    How-to release
    All of it upstreamed!
  • So now to something different... Anyone took a look at the code?
  • Migrating code using old arcane APIs to plone.api makes your code express their intention way more clearer
    All of a sudden your code looks far more readable
  • Golden rule «make your code blend with the surrounding code»
  • All these numbers are pull requests for plone.api that have something very speciall in common
  • Every pull request changes these 4 files:
    - a changelog entry: brief description of what was changed
    - documentation for how to use the new functionality
    - tests to ensure the functionality works as expected
    - the code itself
  • - releases
    - public code
    - docs
    - testing
    - coverage

×