Ejemplo n.º 1
0
    def __init__(self, req, model, language=None, **kw):
        if language:
            self.language = language
        elif 'language' in req.params:
            self.language = Language.get(req.params['language'])
        else:
            self.language = None

        DataTable.__init__(self, req, model, **kw)
Ejemplo n.º 2
0
Archivo: unit.py Proyecto: mitcho/clld
    def __init__(self, req, model, language=None, **kw):
        if language:
            self.language = language
        elif 'language' in req.params:
            self.language = Language.get(req.params['language'])
        else:
            self.language = None

        DataTable.__init__(self, req, model, **kw)
Ejemplo n.º 3
0
Archivo: unit.py Proyecto: mitcho/clld
 def get_options(self):
     opts = DataTable.get_options(self)
     if self.language:
         opts['sAjaxSource'] = self.req.route_url(
             'units', _query={'language': self.language.id})
         #opts["aaSorting"] = [[ 2, "asc" ]]
     return opts
Ejemplo n.º 4
0
 def get_options(self):
     opts = DataTable.get_options(self)
     if self.language:
         opts['sAjaxSource'] = self.req.route_url(
             'units', _query={'language': self.language.id})
         #opts["aaSorting"] = [[ 2, "asc" ]]
     return opts
Ejemplo n.º 5
0
    def get_options(self):
        opts = DataTable.get_options(self)
        for attr in ['parameter', 'contribution', 'unit']:
            if getattr(self, attr):
                opts['sAjaxSource'] = self.req.route_url(
                    'unitvalues', _query={attr: getattr(self, attr).id})

        return opts
Ejemplo n.º 6
0
    def get_options(self):
        opts = DataTable.get_options(self)
        for attr in ['parameter', 'contribution', 'unit']:
            if getattr(self, attr):
                opts['sAjaxSource'] = self.req.route_url(
                    'unitvalues', _query={attr: getattr(self, attr).id})

        return opts
Ejemplo n.º 7
0
    def __init__(self,
                 req,
                 model,
                 parameter=None,
                 contribution=None,
                 unit=None,
                 **kw):
        for attr, _model in [
            ('parameter', common.UnitParameter),
            ('contribution', common.Contribution),
            ('unit', common.Unit),
        ]:
            if locals()[attr]:
                setattr(self, attr, locals()[attr])
            elif attr in req.params:
                setattr(self, attr, _model.get(req.params[attr]))
            else:
                setattr(self, attr, None)

        DataTable.__init__(self, req, model, **kw)
Ejemplo n.º 8
0
    def __init__(self,
                 req,
                 model,
                 parameter=None,
                 contribution=None,
                 unit=None,
                 **kw):
        for attr, _model in [
            ('parameter', common.UnitParameter),
            ('contribution', common.Contribution),
            ('unit', common.Unit),
        ]:
            if locals()[attr]:
                setattr(self, attr, locals()[attr])
            elif attr in req.params:
                setattr(self, attr, _model.get(req.params[attr]))
            else:
                setattr(self, attr, None)

        DataTable.__init__(self, req, model, **kw)
Ejemplo n.º 9
0
    def get_options(self):
        opts = DataTable.get_options(self)

        for attr in ['parameter', 'contribution', 'language']:
            if getattr(self, attr):
                q = {attr: getattr(self, attr).id}
                if attr == 'contribution' and self.second_tab:
                    q['second_tab'] = '1'
                opts['sAjaxSource'] = self.req.route_url('units', _query=q)

        return opts
Ejemplo n.º 10
0
    def get_options(self):
        opts = DataTable.get_options(self)
        opts['aaSorting'] = [[1, 'asc']]

        for attr in ['parameter', 'contribution', 'language']:
            if getattr(self, attr):
                q = {attr: getattr(self, attr).id}
                if attr == 'contribution' and self.second_tab:
                    q['second_tab'] = '1'
                opts['sAjaxSource'] = self.req.route_url('units', _query=q)

        return opts
Ejemplo n.º 11
0
def test_DataTable_for_custom_class(env):
    from clld.web.datatables.base import DataTable

    class A(object):  # no route is registered for the name 'as' ...
        pass

    class ILanguage(Interface):  # but there is one for 'languages'!
        pass

    classImplements(A, ILanguage)
    dt = DataTable(env['request'], A)
    assert 'languages' in dt.options['sAjaxSource']
Ejemplo n.º 12
0
Archivo: value.py Proyecto: mitcho/clld
    def __init__(self,
                 req,
                 model,
                 parameter=None,
                 contribution=None,
                 language=None,
                 search='col',
                 **kw):
        self.search = search

        for attr, _model in [
            ('parameter', Parameter),
            ('contribution', Contribution),
            ('language', Language),
        ]:
            if locals()[attr]:
                setattr(self, attr, locals()[attr])
            elif attr in req.params:
                setattr(self, attr, _model.get(req.params[attr]))
            else:
                setattr(self, attr, None)

        DataTable.__init__(self, req, model, **kw)
Ejemplo n.º 13
0
Archivo: value.py Proyecto: mitcho/clld
    def get_options(self):
        opts = DataTable.get_options(self)
        #opts["aaSorting"] = [[1, "asc"]]

        #opts['bLengthChange'] = False
        #opts['bPaginate'] = False
        #opts['bInfo'] = False

        for attr in ['parameter', 'contribution', 'language']:
            if getattr(self, attr):
                opts['sAjaxSource'] = self.req.route_url(
                    'values', _query={attr: getattr(self, attr).id})

        return opts
Ejemplo n.º 14
0
    def get_options(self):
        opts = DataTable.get_options(self)
        #opts["aaSorting"] = [[1, "asc"]]

        #opts['bLengthChange'] = False
        #opts['bPaginate'] = False
        #opts['bInfo'] = False

        for attr in ['parameter', 'contribution', 'language']:
            if getattr(self, attr):
                opts['sAjaxSource'] = self.req.route_url(
                    'values', _query={attr: getattr(self, attr).id})

        return opts
Ejemplo n.º 15
0
    def __init__(self,
                 req,
                 model,
                 parameter=None,
                 contribution=None,
                 language=None,
                 search='col',
                 **kw):
        self.search = search

        for attr, _model in [
            ('parameter', Parameter),
            ('contribution', Contribution),
            ('language', Language),
        ]:
            if locals()[attr]:
                setattr(self, attr, locals()[attr])
            elif attr in req.params:
                setattr(self, attr, _model.get(req.params[attr]))
            else:
                setattr(self, attr, None)

        DataTable.__init__(self, req, model, **kw)
Ejemplo n.º 16
0
 def __init__(self, *args, **kw):
     DataTable.__init__(self, *args, **kw)
     self.License = aliased(ImageData)
     self.Place = aliased(ImageData)
Ejemplo n.º 17
0
 def __init__(self, req, model, eid=None, **kw):
     DataTable.__init__(self, req, model, eid=eid, **kw)
     self.vars = []
     if self.parameter:
         self.vars = [aliased(Value_data, name='var%s' % i) for i in range(len(self.parameter.jsondata['varspec']))]
Ejemplo n.º 18
0
 def __init__(self, req, model, **kw):
     DataTable.__init__(self, req, model, **kw)
     self.f1 = aliased(Feature, name="f1")
     self.f2 = aliased(Feature, name="f2")
Ejemplo n.º 19
0
 def __init__(self, *args, **kw):
     DataTable.__init__(self, *args, **kw)
     self.License = aliased(ImageData)
     self.Place = aliased(ImageData)
Ejemplo n.º 20
0
 def __init__(self, req, model, **kw):
     DataTable.__init__(self, req, model, **kw)
     self.fam1 = aliased(Family, name="fam1")
     self.fam2 = aliased(Family, name="fam2")