Пример #1
0
    def __init__(self, *args, **kwargs):
        '''Merge __form_options__ from parent class and child class'''
        self.__table_options__ = merge(EventsCrudController.__table_options__, self.__table_options__)
        self.__form_options__ = merge(EventsCrudController.__form_options__, self.__form_options__)
#         kwargs['inject'] = dict(teacher=request.user)
        kwargs['query_modifier'] = lambda qry: qry.filter_by(enabled=False)
        kwargs['show_menu'] = False
        super(EventRequestController, self).__init__(*args, **kwargs)
Пример #2
0
 def __init__(self, *args, **kwargs):
     '''Merge __form_options__ from parent class and child class'''
     self.__table_options__ = merge(EventsCrudController.__table_options__,
                                    self.__table_options__)
     self.__form_options__ = merge(EventsCrudController.__form_options__,
                                   self.__form_options__)
     #         kwargs['inject'] = dict(teacher=request.user)
     kwargs['query_modifier'] = lambda qry: qry.filter_by(enabled=False)
     kwargs['show_menu'] = False
     super(EventRequestController, self).__init__(*args, **kwargs)
Пример #3
0
 def test_good(self):
     dict1 = {
         "str": "xxx",
         "str1": "abc",
         "l": [1, 2, 3],
         "t": ("a", "b", "c"),
         "s": set(("1", "2", "3")),
         "d": {"a": 1, "b": 2, "c": 3, "x": 42},
     }
     dict2 = {
         "str": "zzz",
         "str2": "def",
         "l": [4, 5, 6],
         "t": ("d", "e", "f"),
         "s": set(("4", "5", "6")),
         "d": {"d": 4, "e": 5, "f": 6, "x": 1337},
     }
     merged_dict = merge(dict1, dict2)
     expected_dict = {
         "str": "zzz",
         "str1": "abc",
         "str2": "def",
         "l": [1, 2, 3, 4, 5, 6],
         "t": ("a", "b", "c", "d", "e", "f"),
         "s": set(("1", "2", "3", "4", "5", "6")),
         "d": {"a": 1, "b": 2, "c": 3, "d": 4, "e": 5, "f": 6, "x": 1337},
     }
     self.assertDictEqual(merged_dict, expected_dict)
Пример #4
0
 def __init__(self, *args, **kwargs):
     '''Merge __table_options__ from parent class and child class'''
     self.__table_options__ = merge(UsersCrudController.__table_options__, self.__table_options__)
     super(UsersCrudController, self).__init__(*args, **kwargs)