Esempio 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
Esempio 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
Esempio 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
Esempio 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
Esempio 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')
Esempio 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')
Esempio 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'])
Esempio 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'])
Esempio 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'])
Esempio 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'])