Exemplo n.º 1
0
 def load(self):
     tokens = self.path.split('/')[1:]
     if tokens[0] == 'types' and len(tokens) == 1:
         return {'id': 'types', 'values': schema.get_itemtypes()}
     elif tokens[0] == 'types':
         return schema.get_schema(tokens[1])
     elif tokens[0] == 'properties':
         return schema.get_property(tokens[1])
     elif tokens[0] == 'datatypes':
         return schema.get_datatype(tokens[1])
     else:
         return None
Exemplo n.º 2
0
 def load(self):
     tokens = self.path.split('/')[1:]
     if tokens[0] == 'types' and len(tokens) == 1:
         return {'id': 'types', 'itemtypes': schema.get_itemtypes(), 'selectable_itemtypes': schema.get_selectable_itemtypes()}
     elif tokens[0] == 'types':
         return schema.get_schema(tokens[1])
     elif tokens[0] == 'sctypes':
         return schema.get_schema(tokens[1], self_contained=True)
     elif tokens[0] == 'properties':
         return schema.get_property(tokens[1])
     elif tokens[0] == 'datatypes':
         return schema.get_datatype(tokens[1])
     else:
         return None
Exemplo n.º 3
0
 def load(self):
     tokens = self.path.split("/")[1:]
     if tokens[0] == "types" and len(tokens) == 1:
         return {
             "id": "types",
             "itemtypes": schema.get_itemtypes(),
             "selectable_itemtypes": schema.get_selectable_itemtypes(),
         }
     elif tokens[0] == "types":
         return schema.get_schema(tokens[1])
     elif tokens[0] == "sctypes":
         return schema.get_schema(tokens[1], self_contained=True)
     elif tokens[0] == "properties":
         return schema.get_property(tokens[1])
     elif tokens[0] == "datatypes":
         return schema.get_datatype(tokens[1])
     else:
         return None
Exemplo n.º 4
0
 def load(self):
     tokens = self.path.split('/')[1:]
     if tokens[0] == 'types' and len(tokens) == 1:
         return {
             'id': 'types',
             'itemtypes': schema.get_itemtypes(),
             'selectable_itemtypes': schema.get_selectable_itemtypes()
         }
     elif tokens[0] == 'types':
         return schema.get_schema(tokens[1])
     elif tokens[0] == 'sctypes':
         return schema.get_schema(tokens[1], self_contained=True)
     elif tokens[0] == 'properties':
         return schema.get_property(tokens[1])
     elif tokens[0] == 'datatypes':
         return schema.get_datatype(tokens[1])
     else:
         return None
Exemplo n.º 5
0
 def setUp(self):
     super(SimpleCustomTypeAndPropertyTest, self).setUp()
     schema.SCHEMA_TO_LOAD.append({
         "datatypes": {
             "ISBN2": {
                 "comment": "ISBN 2",
             },
         },
         "properties": {
             "politicalParty": {
                 "comment": "A political party.",
             }
         },
         "types": {
             "Politician": {
                 "supertypes": ["Person"],
                 "specific_properties": ["politicalParty"],
                 "comment": "A political party.",
             }
         }
     })
     self.dtype = schema.get_datatype('ISBN2')
     self.item = schema.get_schema('Politician')
     self.prop = schema.get_property('politicalParty')
Exemplo n.º 6
0
 def setUp(self):
     super(SimpleCustomTypeAndPropertyTest, self).setUp()
     schema.SCHEMA_TO_LOAD.append({
         "datatypes": {
             "ISBN2": {
                 "comment": "ISBN 2",
             },
         },
         "properties": {
             "politicalParty": {
                 "comment": "A political party.",
             }
         },
         "types": {
             "Politician": {
                 "supertypes": ["Person"],
                 "specific_properties": ["politicalParty"],
                 "comment": "A political party.",
             }
         }
     })
     self.dtype = schema.get_datatype('ISBN2')
     self.item = schema.get_schema('Politician')
     self.prop = schema.get_property('politicalParty')
Exemplo n.º 7
0
 def test_get_property_label_for_custom_reversed_form(self):
     self.assertEqual(u'Date Published', schema.get_property('datePublished')['label'])
     self.assertEqual(u'Published %s', schema.get_property('datePublished')['reversed_label'])
Exemplo n.º 8
0
 def test_get_property_label(self):
     self.assertEqual(u'Author', schema.get_property('author')['label'])
     self.assertEqual(u'Authored %s', schema.get_property('author')['reversed_label'])
Exemplo n.º 9
0
 def test_get_property_label_for_custom_reversed_form(self):
     self.assertEqual(u'Date Published',
                      schema.get_property('datePublished')['label'])
     self.assertEqual(
         u'Published %s',
         schema.get_property('datePublished')['reversed_label'])
Exemplo n.º 10
0
 def test_get_property_label(self):
     self.assertEqual(u'Author', schema.get_property('author')['label'])
     self.assertEqual(u'Authored %s',
                      schema.get_property('author')['reversed_label'])