1
0
mirror of https://github.com/gsi-upm/senpy synced 2025-12-21 10:58:16 +00:00

Improved plugins API and loading

Also:

* added drone-ci integration: tests for py2.7 and py3
This commit is contained in:
J. Fernando Sánchez
2016-02-20 18:15:04 +01:00
parent 14c9f61864
commit 48d7d1d02e
8 changed files with 136 additions and 109 deletions

View File

@@ -117,11 +117,16 @@ class SenpyMixin(object):
sort_keys=True)
return js
def validate(self, obj=None):
if not obj:
obj = self
if hasattr(obj, "jsonld"):
obj = obj.jsonld()
jsonschema.validate(obj, self.schema)
class SenpyModel(SenpyMixin, dict):
schema = base_schema
prefix = None
def __init__(self, *args, **kwargs):
temp = dict(*args, **kwargs)
@@ -161,14 +166,6 @@ class SenpyModel(SenpyMixin, dict):
def __delattr__(self, key):
self.__delitem__(self._get_key(key))
def validate(self, obj=None):
if not obj:
obj = self
if hasattr(obj, "jsonld"):
obj = obj.jsonld()
jsonschema.validate(obj, self.schema)
@classmethod