16. provide clear API methods
keeping everything in one place
provide clear API methods
keeping everything in one place
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. 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
24. from plone import api
api.portal.get()
from plone import api
api.portal.get()
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. 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,
)
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