def get_parent_dir(my, search_type=None, context=None, sobject=None): from project import Project if not sobject: sobject = my.sobject if search_type: parent = sobject.get_parent(search_type) else: search_type = sobject.get_value("search_type") search_id = sobject.get_value("search_id") parent = Search.get_by_id(search_type, search_id) if not parent: raise TacticException("No parent exists for '%s', possibly a result of Shot rename or removal." % sobject.get_code()) # just use the latest of the context desired if context: search_id = parent.get_id() search_type = parent.get_search_type() snapshot = Snapshot.get_latest(search_type, search_id, context) else: # basically this means that without a parent context, there is # no way to know the directory this is in. snapshot = None dirs = Project._get_dir( my.protocol,parent,snapshot,None ) dirs = dirs.split("/") return dirs
def get_parent_dir(self, search_type=None, context=None, sobject=None): from project import Project if not sobject: sobject = self.sobject if search_type: parent = sobject.get_parent(search_type) else: search_type = sobject.get_value("search_type") search_id = sobject.get_value("search_id") parent = Search.get_by_id(search_type, search_id) if not parent: raise TacticException("No parent exists for '%s', possibly a result of Shot rename or removal." % sobject.get_code()) # just use the latest of the context desired if context: search_id = parent.get_id() search_type = parent.get_search_type() snapshot = Snapshot.get_latest(search_type, search_id, context) else: # basically this means that without a parent context, there is # no way to know the directory this is in. snapshot = None dirs = Project._get_dir( self.protocol,parent,snapshot,None ) dirs = dirs.split("/") return dirs