Mercurial > farol > farolluz
comparison farolluz/cvrf.py @ 6:633ebfcff0d0
Add a method to request a Document ID
author | Benoît Allard <benoit.allard@greenbone.net> |
---|---|
date | Mon, 06 Oct 2014 11:39:59 +0200 |
parents | d47e1164740f |
children | c924c15bd110 |
comparison
equal
deleted
inserted
replaced
5:d62264a643fb | 6:633ebfcff0d0 |
---|---|
63 self._aliases = [] | 63 self._aliases = [] |
64 | 64 |
65 def addAlias(self, alias): | 65 def addAlias(self, alias): |
66 self._aliases.append(alias) | 66 self._aliases.append(alias) |
67 | 67 |
68 def getId(self): | |
69 return self._id | |
70 | |
68 def validate(self): | 71 def validate(self): |
69 if not self._id: | 72 if not self._id: |
70 raise ValidationError('Document ID cannot be left empty') | 73 raise ValidationError('Document ID cannot be left empty') |
71 | 74 |
72 def __str__(self): | 75 def __str__(self): |
89 def addRevision(self, revision): | 92 def addRevision(self, revision): |
90 self._history.append(revision) | 93 self._history.append(revision) |
91 | 94 |
92 def setGenerator(self, generator): | 95 def setGenerator(self, generator): |
93 self._generator = generator | 96 self._generator = generator |
97 | |
98 def getId(self): | |
99 return self._identification.getId() | |
94 | 100 |
95 def validate(self): | 101 def validate(self): |
96 if self._identification is None: | 102 if self._identification is None: |
97 raise ValidationError('Document Tracking needs to have an Identification') | 103 raise ValidationError('Document Tracking needs to have an Identification') |
98 self._identification.validate() | 104 self._identification.validate() |
976 for note in self._notes: | 982 for note in self._notes: |
977 if note._ordinal == ordinal: | 983 if note._ordinal == ordinal: |
978 return note | 984 return note |
979 return None | 985 return None |
980 | 986 |
987 def getDocId(self): | |
988 if self._tracking is not None: | |
989 return self._tracking.getId() | |
990 # Make up something ... | |
991 return self._title.lower() | |
992 | |
981 def validate(self): | 993 def validate(self): |
982 if not self._title: | 994 if not self._title: |
983 raise ValidationError('Document Title cannot be empty') | 995 raise ValidationError('Document Title cannot be empty') |
984 if not self._type: | 996 if not self._type: |
985 raise ValidationError('Document Type cannot be empty') | 997 raise ValidationError('Document Type cannot be empty') |