Skip to content

Instantly share code, notes, and snippets.

@jordic
Created November 5, 2018 05:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jordic/124fc679ce57dde41c8000ee77f0c23f to your computer and use it in GitHub Desktop.
Save jordic/124fc679ce57dde41c8000ee77f0c23f to your computer and use it in GitHub Desktop.
configure
from plone.rest.zcml import serviceDirective
class service(_base_decorator):
def __call__(self, klass):
global context
method = self.config.get('method', 'GET')
accept = self.config.get('accept', u"application/json")
permission = self.config.pop('permission', 'zope2.View')
for_ = self.config.pop("for_", Interface)
serviceDirective(
context, method, accept, klass, for_,
permission,
**self.config
)
return klass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment