Ei kuvausta
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

main.py 910B

123456789101112131415161718192021222324252627282930
  1. #-*- coding: utf-8 -*-
  2. from lodel.context import LodelContext
  3. LodelContext.expose_modules(globals(), {
  4. 'lodel.plugin': ['LodelHook', 'CustomMethod']})
  5. @LodelHook('leapi_get_post')
  6. @LodelHook('leapi_update_pre')
  7. @LodelHook('leapi_update_post')
  8. @LodelHook('leapi_delete_pre')
  9. @LodelHook('leapi_delete_post')
  10. @LodelHook('leapi_insert_pre')
  11. @LodelHook('leapi_insert_post')
  12. def dummy_callback(hook_name, caller, payload):
  13. if Lodel.settings.Settings.debug:
  14. print("\tHook %s\tcaller %s with %s" % (hook_name, caller, payload))
  15. return payload
  16. @CustomMethod('Object', 'dummy_method')
  17. def dummy_instance_method(self):
  18. print("Hello world !\
  19. I'm a custom method on an instance of class %s" % self.__class__)
  20. @CustomMethod('Object', 'dummy_class_method', CustomMethod.CLASS_METHOD)
  21. def dummy_instance_method(self):
  22. print("Hello world !\
  23. I'm a custom method on class %s" % self.__class__)