plone / plone.api

The Plone API
https://6.docs.plone.org/plone.api
Other
92 stars 54 forks source link

The parameter validation decorators should be reworked. #248

Open jaroel opened 9 years ago

jaroel commented 9 years ago

Parameter validation is currently handled by function decorators. This has the following downsides: A. Required parameters are defined with '=None'. This is really non-pythonic and unhelpful to IDEs and (more) experienced programmers. Required arguments should never have a default value.

B. Debugging the function calls is more-or-less impossible. If you try to PDB into an plone.api function, the only thing you'll see is '(1)create()'. This is the same problem we have with TTW python scripts.

There's also the overhead of function calls, but that's clearly moot when you're creating content, or doing a workflow transition.

jaroel commented 9 years ago

Point A is easily fixed by remove the '=None' for required parameters. Point B can be resolved by moving the decorators' functionality inside the functions.

pbauer commented 9 years ago

:+1: for removing the decorators. They are nice when programming plone.api but really annoying when using and debugging it.