예제 #1
0
    def test_linked_references(self):
        from clld.web.util.helpers import linked_references

        with patch('clld.web.util.helpers.link'):
            linked_references(
                self.env['request'], Mock(
                    references=[MagicMock(description=''), MagicMock(description='')]))
예제 #2
0
    def test_linked_references(self):
        from clld.web.util.helpers import linked_references

        with patch("clld.web.util.helpers.link"):
            linked_references(
                self.env["request"], Mock(references=[MagicMock(description=""), MagicMock(description="")])
            )
예제 #3
0
def test_linked_references(env, mocker):
    from clld.web.util.helpers import linked_references

    assert linked_references(env['request'], None) == ''
    mocker.patch('clld.web.util.helpers.link')
    linked_references(
        env['request'],
        mocker.Mock(references=[
            mocker.MagicMock(description=''), mocker.MagicMock(description='')]))
예제 #4
0
    def test_linked_references(self):
        from clld.web.util.helpers import linked_references

        with patch('clld.web.util.helpers.link'):
            linked_references(
                self.env['request'],
                Mock(references=[
                    MagicMock(description=''),
                    MagicMock(description='')
                ]))
예제 #5
0
파일: base.py 프로젝트: marctang/clld
 def format(self, item):
     vs = self.get_obj(item)
     return ', '.join(
         nfilter([
             getattr(vs, 'source', None),
             linked_references(self.dt.req, vs)
         ]))
예제 #6
0
 def format(self, item):
     lis = []
     if item.source:
         s = item.source
         if s.startswith('http://'):
             label = s
             for t in 'wikimedia wikipedia plantzafrica'.split():
                 if t in s:
                     label = t
                     break
             lis.append(external_link(s, label))
     lis.append(linked_references(self.dt.req, item))
     return HTML.ul(*lis, class_='unstyled')
예제 #7
0
 def format(self, item):
     lis = []
     if item.source:
         s = item.source
         if s.startswith('http://'):
             label = s
             for t in 'wikimedia wikipedia plantzafrica'.split():
                 if t in s:
                     label = t
                     break
             lis.append(external_link(s, label))
     lis.append(linked_references(self.dt.req, item))
     return HTML.ul(*lis, class_='unstyled')
예제 #8
0
 def format(self, item):
     return linked_references(self.dt.req, item)
예제 #9
0
파일: value.py 프로젝트: mitcho/clld
 def format(self, item):
     return linked_references(self.dt.req, item.valueset)
예제 #10
0
파일: value.py 프로젝트: FieldDB/clld
 def format(self, item):
     return ', '.join(filter(
         None, [item.valueset.source, linked_references(self.dt.req, item.valueset)]))
예제 #11
0
 def format(self, item):
     return ', '.join(
         filter(None, [
             item.valueset.source,
             linked_references(self.dt.req, item.valueset)
         ]))
예제 #12
0
파일: base.py 프로젝트: clld/clld
 def format(self, item):
     vs = self.get_obj(item)
     return ', '.join(
         nfilter([getattr(vs, 'source', None), linked_references(self.dt.req, vs)]))
예제 #13
0
파일: datatables.py 프로젝트: mapmeld/wals3
 def format(self, item):
     return HTML.small(linked_references(self.dt.req, item.valueset))
예제 #14
0
 def format(self, item):
     vs = self.get_obj(item)
     return linked_references(self.dt.req, vs)