def create_singer(cls, singer_json, versions): if singer_json is None: return None # create the singer object and save it to the store singer = Singer({"singer" : singer_json}) if versions is not None: singer.versions = versions singer.save() # call the indexing process, and index this object and all # related ones SingerIndex.by_id(singer.id, cascade=True) return singer
def update_singer(cls, singer_id, singer_json=None, versions=None): # retrieve and update the singer object in the desired way singer = Singer().get(singer_id, links=True) if singer is None: raise NotFoundException() if singer_json is not None: singer.patch_singer(singer_json, replace_all=True, keep_id=True) if versions is not None: singer.versions = versions singer.save() # call the indexing process, and index this object and all related ones SingerIndex.by_id(singer.id, cascade=True) return singer
8 Hamish Robb James Robb M Wellbank, Angus Forfar, Angus 1937 Ex-farm worker and hauler. Born in Wellbank, worked in East Lothian and the Borders before settling in Forfar. [YES] Local Voices, with contributor's permission """ # Rab Morrison singer = Singer() singer.lv_id = "1" singer.set_name("Rab", None, "Morrison", "Robert Morrison") singer.gender = "male" singer.add_location(relation="native_area", name="Northrigg, West Lothian") singer.add_location(relation="significant", name="Blackridge, West Lothian") singer.born = "1908" singer.died = "1967" singer.biography = "Miner" # singer.photo_url = "" singer.source = "SoSS via Tobar an Dualchais : http://www.tobarandualchais.co.uk/en/person/3473" singer.save(host=settings.ELASTIC_SEARCH_HOST, index=settings.ELASTIC_SEARCH_DB, refresh=True) singer_ids.append(singer.id) # Mickey McDaid singer = Singer() singer.lv_id = "2" singer.set_name("Mickey", None, "McDaid", "Michael McDaid") singer.gender = "male" singer.add_location(relation="native_area", name="Hillside, Inishowen, Ireland") singer.biography = "Farmer" # singer.photo_url = "" singer.source = "Jimmy McBride, 'My Parents Reared Me Tenderly', pp. 37-38" singer.save(host=settings.ELASTIC_SEARCH_HOST, index=settings.ELASTIC_SEARCH_DB, refresh=True) singer_ids.append(singer.id) # Stravaig (Group)