(self, multimedia, path, save=True)
This creates the mapping of a path to the multimedia in an application to the media object stored in couch.
This creates the mapping of a path to the multimedia in an application to the media object stored in couch.
This creates the mapping of a path to the multimedia in an application to the media object stored in couch .
def create_mapping(self, multimedia, path, save=True):
        """
            This creates the mapping of a path to the multimedia in an application to the media object stored in couch.
        """
        path = path.strip()
        map_item = HQMediaMapItem()
        map_item.multimedia_id = multimedia._id
        map_item.unique_id = HQMediaMapItem.gen_unique_id(map_item.multimedia_id, path)
        map_item.media_type = multimedia.doc_type
        self.multimedia_map[path] = map_item

        if save:
            try:
                self.save()
            except ResourceConflict:
                # Attempt to fetch the document again.
                updated_doc = self.get(self._id)
                updated_doc.create_mapping(multimedia, form_path)
def create_mapping ( self , multimedia , path , save = True ) : path = path . strip ( ) map_item = HQMediaMapItem ( ) map_item . multimedia_id = multimedia . _id map_item . unique_id = HQMediaMapItem . gen_unique_id ( map_item . multimedia_id , path ) map_item . media_type = multimedia . doc_type self . multimedia_map [ path ] = map_item if save : try : self . save ( ) except ResourceConflict : # Attempt to fetch the document again. updated_doc = self . get ( self . _id ) updated_doc . create_mapping ( multimedia , form_path )