This class acts as a tagged union. Only one of the ``is_*`` methods will return true. To get the associated value of a tag (if one exists), use the corresponding ``get_*`` method. :ivar file_properties.PropertiesError.unsupported_folder: This folder cannot be tagged. Taggin
| 135 | TemplateError_validator = bv.Union(TemplateError) |
| 136 | |
| 137 | class PropertiesError(TemplateError): |
| 138 | """ |
| 139 | This class acts as a tagged union. Only one of the ``is_*`` methods will |
| 140 | return true. To get the associated value of a tag (if one exists), use the |
| 141 | corresponding ``get_*`` method. |
| 142 | |
| 143 | :ivar file_properties.PropertiesError.unsupported_folder: This folder cannot |
| 144 | be tagged. Tagging folders is not supported for team-owned templates. |
| 145 | """ |
| 146 | |
| 147 | # Attribute is overwritten below the class definition |
| 148 | unsupported_folder = None |
| 149 | |
| 150 | @classmethod |
| 151 | def path(cls, val): |
| 152 | """ |
| 153 | Create an instance of this class set to the ``path`` tag with value |
| 154 | ``val``. |
| 155 | |
| 156 | :param LookupError val: |
| 157 | :rtype: PropertiesError |
| 158 | """ |
| 159 | return cls('path', val) |
| 160 | |
| 161 | def is_path(self): |
| 162 | """ |
| 163 | Check if the union tag is ``path``. |
| 164 | |
| 165 | :rtype: bool |
| 166 | """ |
| 167 | return self._tag == 'path' |
| 168 | |
| 169 | def is_unsupported_folder(self): |
| 170 | """ |
| 171 | Check if the union tag is ``unsupported_folder``. |
| 172 | |
| 173 | :rtype: bool |
| 174 | """ |
| 175 | return self._tag == 'unsupported_folder' |
| 176 | |
| 177 | def get_path(self): |
| 178 | """ |
| 179 | Only call this if :meth:`is_path` is true. |
| 180 | |
| 181 | :rtype: LookupError |
| 182 | """ |
| 183 | if not self.is_path(): |
| 184 | raise AttributeError("tag 'path' not set") |
| 185 | return self._value |
| 186 | |
| 187 | def _process_custom_annotations(self, annotation_type, field_path, processor): |
| 188 | super(PropertiesError, self)._process_custom_annotations(annotation_type, field_path, processor) |
| 189 | |
| 190 | PropertiesError_validator = bv.Union(PropertiesError) |
| 191 |