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.

leapidatasource.py 3.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. # @param group list of tupple: List of column to group together. group = [('titre', 'ASC'), ]
  16. # @param order list of tupple : List of column to order. order = [('titre', 'ASC'), ]
  17. # @param limit int : Number of row to be returned
  18. # @param offset int : Used with limit to choose the start row
  19. # @return a list of LeCrud child classes
  20. def select(self, target_cls, field_list, filters, rel_filters=None, order=None, group=None, limit=None, offset=0, instanciate=True):
  21. pass
  22. ## @brief delete lodel editorial components given filters
  23. # @param target_cls LeCrud(class) : The component class concerned by the insert (a LeCrud child class (not instance !) )
  24. # @param filters list : List of filters (see @ref leobject_filters )
  25. # @param rel_filters list : List of relationnal filters (see @ref leobject_filters )
  26. # @return the number of deleted components
  27. def delete(self, target_cls, filters, rel_filters):
  28. pass
  29. ## @brief update an existing lodel editorial component
  30. # @param target_cls LeCrud(class) : The component class concerned by the insert (a LeCrud child class (not instance !) )
  31. # @param filters list : List of filters (see @ref leobject_filters )
  32. # @param rel_filters list : List of relationnal filters (see @ref leobject_filters )
  33. # @param **datas : Datas in kwargs
  34. # @return The number of updated components
  35. def update(self, target_cls, filters, rel_filters, **datas):
  36. pass
  37. ## @brief insert a new lodel editorial component
  38. # @param target_cls LeCrud(class) : The component class concerned by the insert (a LeCrud child class (not instance !) )
  39. # @param **datas : The datas to insert
  40. # @return The inserted component's id
  41. def insert(self, target_cls, **datas):
  42. pass
  43. ## @brief insert multiple editorial component
  44. # @param target_cls LeCrud(class) : The component class concerned by the insert (a LeCrud child class (not instance !) )
  45. # @param datas_list list : A list of dict representing the datas to insert
  46. # @return int the number of inserted component
  47. def insert_multi(self, target_cls, datas_list):
  48. pass
  49. ## @brief Update a rank for a relation (and shift properly every concerned relations)
  50. # @param le_relation LeRelation : A LeRelation instance
  51. # @param new_rank int : An integer representing the absolute new rank
  52. # @return ???
  53. def update_rank(self, le_relation, new_rank):
  54. pass