Commit 061ce41e authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[backend][assetmodel] Add method to AssetType to know how many / should be found

parent 7e4a5c23
...@@ -112,6 +112,18 @@ class AssetType(Enum): ...@@ -112,6 +112,18 @@ class AssetType(Enum):
return self not in [self.UNKNOWN, self.DATABASE, self.PROTOCOLTEMPLATE] return self not in [self.UNKNOWN, self.DATABASE, self.PROTOCOLTEMPLATE]
def split_count(self):
"""Returns the number of "/" that should be part of its name"""
if self == self.UNKNOWN:
return 0
elif self == self.EXPERIMENT:
return 5
elif self not in [self.DATABASE, self.PROTOCOLTEMPLATE]:
return 2
else:
return 1
def validate(self, data): def validate(self, data):
"""Runs the schema validation and returns whether an asset is valid """Runs the schema validation and returns whether an asset is valid
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment