# HG changeset patch # User Nicolas DURAND # Date 1418125178 -3600 # Node ID 893799c494e287fee10b5b4bef3cdfc514a911c4 # Parent d02faa4a2eb2067cdada2a51f0e3e77d08a36db8 pep8-fication + added skos:related in the list of available properties diff -r d02faa4a2eb2 -r 893799c494e2 src/catedit/api.py --- a/src/catedit/api.py Wed Dec 03 17:40:19 2014 +0100 +++ b/src/catedit/api.py Tue Dec 09 12:39:38 2014 +0100 @@ -47,7 +47,7 @@ args["property_predicate"], args["property_object"]): if property_object: - property_object_to_append=property_object + property_object_to_append = property_object # if URIRef category, we must prefix id with namespace if app.config["PROPERTY_LIST"] \ [property_predicate] \ @@ -55,7 +55,8 @@ property_object_to_append = app.config["ONTOLOGY_NAMESPACE"] \ + property_object # print property_object_to_append - new_property_list.append((property_predicate, property_object_to_append)) + new_property_list.append((property_predicate, + property_object_to_append)) # print new_property_list c = cat_manager_instance.load_cat(cat_id) c.edit_category(new_description=args["description"], diff -r d02faa4a2eb2 -r 893799c494e2 src/catedit/app.py --- a/src/catedit/app.py Wed Dec 03 17:40:19 2014 +0100 +++ b/src/catedit/app.py Tue Dec 09 12:39:38 2014 +0100 @@ -14,19 +14,21 @@ github = GitHub(app) # set up logging -file_handler = FileHandler(filename=app.config["LOG_FILE_PATH"]) -file_handler.setFormatter(Formatter(''' -Message type: %(levelname)s -Location: %(pathname)s:%(lineno)d -Module: %(module)s -Function: %(funcName)s -Time: %(asctime)s +if app.config["LOGGING"]: + file_handler = FileHandler(filename=app.config["LOG_FILE_PATH"]) + file_handler.setFormatter(Formatter(''' + Message type: %(levelname)s + Location: %(pathname)s:%(lineno)d + Module: %(module)s + Function: %(funcName)s + Time: %(asctime)s -Message: + Message: -%(message)s -''')) -app.logger.addHandler(file_handler) + %(message)s + ''')) + app.logger.addHandler(file_handler) + app.logger.setLevel(app.config["LOGGING_LEVEL"]) # session management diff -r d02faa4a2eb2 -r 893799c494e2 src/catedit/models.py --- a/src/catedit/models.py Wed Dec 03 17:40:19 2014 +0100 +++ b/src/catedit/models.py Tue Dec 09 12:39:38 2014 +0100 @@ -92,7 +92,8 @@ """ Checks if there is a new label and if so apply changes """ - if new_label is not False and new_label != self.label: + if new_label is not (False or None) and \ + new_label != self.label: self.cat_graph.remove((self.this_category, RDFS.label, self.cat_graph.label(self.this_category))) @@ -103,7 +104,8 @@ """ Checks if there is a new description and if so apply changes """ - if new_description is not False and new_description != self.description: + if new_description is not (False or None) and \ + new_description != self.description: self.cat_graph.remove((self.this_category, RDF.Description, self.cat_graph.value(self.this_category, diff -r d02faa4a2eb2 -r 893799c494e2 src/catedit/settings.py --- a/src/catedit/settings.py Wed Dec 03 17:40:19 2014 +0100 +++ b/src/catedit/settings.py Tue Dec 09 12:39:38 2014 +0100 @@ -1,4 +1,5 @@ from rdflib import * +from rdflib.namespace import SKOS class appSettings(object): @@ -8,6 +9,7 @@ HOST = "0.0.0.0" DEBUG = True LOGGING = False + LOGGING_LEVEL = "DEBUG" # WTForms settings @@ -37,7 +39,7 @@ GITHUB_CLIENT_ID = "3e31f3b000a4914f75ef" GITHUB_CLIENT_SECRET = "bc17eb0ec11385628c2e75aacb5ff8ef5f29e490" - # Property List - DO NOT OVERWRITE IN config.py EVER + # Property List PROPERTY_LIST = { "subClassOf": { @@ -68,6 +70,13 @@ "rdflib_class": RDFS.Resource, "object_rdflib_class": URIRef, }, + "related": { + "descriptive_label_fr": "En relation avec", + "descriptive_label_en": "Related to", + "object_type": "uriref-category", + "rdflib_class": SKOS.related, + "object_rdflib_class": URIRef, + } } # Category persistence parameters