def _get_unique_filename(my): filename = my.file_object.get_full_file_name() # find if this filename has been used for this project file = File.get_by_filename(filename, skip_id=my.file_object.get_id()) if file: root, ext = os.path.splitext(filename) parts = [root] filename = my.add_ending(parts, auto_version=True) return filename else: return None
def _get_unique_filename(my): filename = my.file_object.get_full_file_name() # find if this filename has been used for this project file = File.get_by_filename(filename, skip_id=my.file_object.get_id()) if file: root, ext = os.path.splitext(filename) parts = [root] filename = my.add_ending(parts, auto_version=True) return filename else: return None
def add_ref_by_file_path(my, file_path, type='ref', node_name='', tag='main'): '''add a reference based on the file name. If the file is unique, then a reference can be found based on the file name''' from pyasm.biz import File filename = os.path.basename(file_path) file = File.get_by_filename(filename, padding=4) if not file: Environment.add_warning("Unknown File Reference", "File reference [%s] does not exist in database" % file_path) my.add_unknown_ref(file_path) return else: snapshot_code = file.get_value("snapshot_code") return my.add_ref_by_snapshot_code(snapshot_code, type=type, node_name=node_name, tag=tag)
def add_ref_by_file_path(my, file_path, type='ref', node_name='', tag='main'): '''add a reference based on the file name. If the file is unique, then a reference can be found based on the file name''' from pyasm.biz import File filename = os.path.basename(file_path) file = File.get_by_filename(filename, padding=4) if not file: Environment.add_warning( "Unknown File Reference", "File reference [%s] does not exist in database" % file_path) my.add_unknown_ref(file_path) return else: snapshot_code = file.get_value("snapshot_code") return my.add_ref_by_snapshot_code(snapshot_code, type=type, node_name=node_name, tag=tag)