No Description
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.

dummy.py 2.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #-*- coding: utf-8 -*-
  2. ## @brief Dummy datasource for LeObject
  3. #
  4. # This class has to be extended to apply to a real datasource
  5. # But it can be used as an empty and debug datasource
  6. class DummyDatasource(object):
  7. def __init__(self, module=None, *conn_args, **conn_kargs):
  8. self.module = module
  9. self.conn_args = conn_args
  10. self.conn_kargs = conn_kargs
  11. ## @brief select lodel editorial components given filters
  12. # @param target_cls LeCrud(class) : The component class concerned by the insert (a LeCrud child class (not instance !) )
  13. # @param filters list : List of filters (see @ref leobject_filters )
  14. # @param rel_filters list : List of relationnal filters (see @ref leobject_filters )
  15. # @return a list of LeCrud child classes
  16. def select(self, target_cls, filters, rel_filters):
  17. pass
  18. ## @brief delete lodel editorial components given filters
  19. # @param target_cls LeCrud(class) : The component class concerned by the insert (a LeCrud child class (not instance !) )
  20. # @param filters list : List of filters (see @ref leobject_filters )
  21. # @param rel_filters list : List of relationnal filters (see @ref leobject_filters )
  22. # @return the number of deleted components
  23. def delete(self, target_cls, filters, rel_filters):
  24. pass
  25. ## @brief update an existing lodel editorial component
  26. # @param target_cls LeCrud(class) : The component class concerned by the insert (a LeCrud child class (not instance !) )
  27. # @param filters list : List of filters (see @ref leobject_filters )
  28. # @param rel_filters list : List of relationnal filters (see @ref leobject_filters )
  29. # @param **datas : Datas in kwargs
  30. # @return The number of updated components
  31. def update(self, lec_id, filters, rel_filters, **datas):
  32. pass
  33. ## @brief insert a new lodel editorial component
  34. # @param target_cls LeCrud(class) : The component class concerned by the insert (a LeCrud child class (not instance !) )
  35. # @param **datas : The datas to insert
  36. # @return The inserted component's id
  37. def insert(self, target_cls, **datas):
  38. pass
  39. ## @brief insert multiple editorial component
  40. # @param target_cls LeCrud(class) : The component class concerned by the insert (a LeCrud child class (not instance !) )
  41. # @param datas list : A list of dict representing the datas to insert
  42. # @return int the number of inserted component
  43. def batch_insert(self, target_cls, datas):
  44. pass