Open megies opened 8 years ago
The same applies to ValidatorPluginPoint
as well, putting a second validator in quakeml/plugins.py
, like e.g.:
32 class QuakeMLValidatorPlugin(ValidatorPluginPoint):
33 """
34 Any number of validators can be defined for each document type.
35
36 Each validator must have a validate() method that returns True or False
37 depending on weather or not the particular validation has passed or not.
38 Only documents that pass all validations can be stored in the database.
39 """
40 name = 'quakeml'
41 title = 'QuakeML XMLSchema Validator'
42
43 def validate(self, document):
44 from obspy.io.quakeml.core import _validate as validate_quakeml # NOQA
45 try:
46 is_valid = validate_quakeml(document)
47 except:
48 is_valid = False
49 return is_valid
50
51
+ 52 class QuakeMLValidatorPlugin2(ValidatorPluginPoint):
+ 53 """
+ 54 """
+ 55 name = 'quakeml'
+ 56 title = 'QuakeML Dummy Validator'
+ 57
+ 58 def validate(self, document):
+ 59 return True
Makes the initial DB setup with python manage.py migrate
fail (starting from a completely empty DB).
So, I'm sure now that this is unintended behavior (at least the docstring says otherwise), i.e. a bug.
I think this has to be fixed in https://github.com/krischer/django-plugins..
I'm trying to register a second custom retrieve permission for quakeml document type, analogous to
CanSeePrivateEventsRetrievePermissionPlugin
(starting from a completely empty jane DB), but this seems to be not possible as duringpython manage.py migrate
there is an error (see below)...For my understanding the key in the
documents_documenttype_retrieve_permissions
table should include also the enumerated id field of the table.. but django and jane internals are still pretty much a mystery to me at this point..