def testSetDescription(self): t = Tag('test/fomtest') t.description = u'melon' self.assertEquals(self.db.reqs[0], ( 'PUT', u'/tags/test/fomtest', {u'description': u'melon'}, None, None))
def testGetDescription(self): t = Tag(u'test/fomtest') t.description = u'banana' self.assertEquals(self.db.reqs[0], ('PUT', u'/tags/test/fomtest', { u'description': u'banana' }, None, None)) self.db.add_resp( 200, 'application/json', '{"indexed": false, "id": "9", "description": "banana"}') self.assertEquals(t.description, u'banana') self.assertEquals(self.db.reqs[1], ('GET', u'/tags/test/fomtest', NO_CONTENT, { u'returnDescription': True }, None))
def make_tag(parent_ns, name, dataset, desc, indexed=False): """ Given a parent namespace, name, description and optional indexed flag will create and return the resulting tag parent_ns - the parent namespace under which the tag will be created name - the name of the new tag dataset - the title of the dataset that is causing this tag to be created (used when setting the description of the new tag) desc - the description of the dataset that's causing the tag to be created (used when setting the description of the new tag) indexed - flag to indicate if the tag is to be indexed for full text search """ try: logger.info('Creating new tag "%r" under %r' % (name, parent_ns.path)) tag = parent_ns.create_tag(name, TAG_DESC % (name, dataset, desc), False) logger.info('Tag %r created' % tag.path) except Fluid412Error: # 412 simply means the tag already exists tag = Tag(parent_ns.path + '/' + name) logger.info('%r already existed' % tag.path) return tag
def testGetDescription(self): t = Tag(u'test/fomtest') t.description = u'banana' self.assertEquals(self.db.reqs[0], ( 'PUT', u'/tags/test/fomtest', {u'description': u'banana'}, None, None)) self.db.add_resp(200, 'application/json', '{"indexed": false, "id": "9", "description": "banana"}') self.assertEquals(t.description, u'banana') self.assertEquals(self.db.reqs[1], ( 'GET', u'/tags/test/fomtest', NO_CONTENT, {u'returnDescription': True}, None))
def testSetDescription(self): t = Tag('test/fomtest') t.description = u'melon' self.assertEquals(self.db.reqs[0], ('PUT', u'/tags/test/fomtest', { u'description': u'melon' }, None, None))
def testNew(self): t = Tag(u'test/fomtest') self.assertEquals(t.path, 'test/fomtest')
# import pprint # pprint.pprint(dictObjects ) CommitTagging(dictObjects) # Put some usefull info on the description-tag of the namespace objects. Namespace(sUserNS + u'/lang')._set_description( u'Data imported by the fiLang scripts found at https://github.com/axeloide/fiLang' ) Namespace(sUserNS + u'/lang/iso639')._set_description( u'Data related to ISO 639 language codes.') Namespace(sUserNS + u'/lang/glossonym')._set_description(u'Contains language names.') Tag(sUserNS + u'/lang/iso639/1')._set_description( u'Flags valid ISO639-1 language codes. Empty-valued.') Tag(sUserNS + u'/lang/iso639/2')._set_description( u'Flags valid ISO639-2 language codes. Empty-valued.') Tag(sUserNS + u'/lang/iso639/2B')._set_description( u'Flags valid ISO639-2/B language codes. Empty-valued.') Tag(sUserNS + u'/lang/iso639/2T')._set_description( u'Flags valid ISO639-2/T language codes. Empty-valued.') Tag(sUserNS + u'/lang/iso639/related-1')._set_description( u'Link to corresponding ISO 639-1 code.') Tag(sUserNS + u'/lang/iso639/related-2B')._set_description( u'Link to corresponding ISO 639-2/B code.') Tag(sUserNS + u'/lang/iso639/related-2T')._set_description( u'Link to corresponding ISO 639-2/T code.') for sTagPath in Namespace(sUserNS + u'/lang/glossonym').tag_paths:
AddTag(dictObjects[sTcode], sUserNS + u'/lang/glossonym/autoglossonym-all', lsAutoglossonyms) AddTag(dictObjects[sTcode], sUserNS + u'/lang/wikipedia-home', sWikiHome) import pprint pprint.pprint(dictObjects) print "############### Going to tag:", len( dictObjects), "objects###############" CommitTagging(dictObjects) # Put some usefull info on the description-tag of the tag objects. Tag(sUserNS + u'/lang/wikipedia-home')._set_description( u'Base URL of Wikipedia project authored in that language.') Tag(sUserNS + u'/lang/glossonym/autoglossonym')._set_description( u'Name of a language in that very same language.') Tag(sUserNS + u'/lang/glossonym/autoglossonym-all')._set_description( u'List of names of a language in that very same language.') Tag(sUserNS + u'/lang/iso639/related-1')._set_description( u'Link to corresponding ISO 639-1 code.') Tag(sUserNS + u'/lang/iso639/related-2B')._set_description( u'Link to corresponding ISO 639-2/B code.') Tag(sUserNS + u'/lang/iso639/related-2T')._set_description( u'Link to corresponding ISO 639-2/T code.') #for sTagPath in Namespace(sUserNS+u'/lang/glossonym').tag_paths: # sCode = sTagPath.split(u'/')[-1] # Tag(sTagPath)._set_description( u'A language as named in '+sCode)