From d0d9ef6ecd4946874a2aca9a06ff48d97e0345ef Mon Sep 17 00:00:00 2001 From: Roland Haroutiounian Date: Wed, 1 Jul 2015 11:23:37 +0200 Subject: [PATCH] [EditorialModel/classtypes.py] PEP8 --- EditorialModel/classtypes.py | 101 ++++++++++++++++++---------------- EditorialModel/fieldgroups.py | 2 +- 2 files changed, 56 insertions(+), 47 deletions(-) diff --git a/EditorialModel/classtypes.py b/EditorialModel/classtypes.py index 80c74bf..8a1ae78 100644 --- a/EditorialModel/classtypes.py +++ b/EditorialModel/classtypes.py @@ -1,12 +1,18 @@ # -*- coding: utf-8 -*- -## constant name for the nature of type hierarchy + +## EmNature (Class) +# +# constant name for the nature of type hierarchy class EmNature(object): PARENT = 'parent' TRANSLATION = 'translation' IDENTITY = 'identity' -## Representation of the classTypes + +## EmClassType (Class) +# +# Representation of the classTypes # # Defines 3 generic classtype : entity, entry and person # - entity : to define editorial content @@ -26,55 +32,58 @@ class EmNature(object): class EmClassType(object): entity = { - 'name' : 'entity', - 'hierarchy' : { - EmNature.PARENT : { - 'attach' : 'classtype', - 'automatic' : False, - 'maxdepth' : -1, - 'maxchildren' : -1 - }, - EmNature.TRANSLATION : { - 'attach' : 'type', - 'automatic' : False, - 'maxdepth' : 1, - 'maxchildren' : -1 - }, - }, - } - - entry = { - 'name' : 'entry', - 'hierarchy' : { - EmNature.PARENT : { - 'attach' : 'type', - 'automatic' : False, - }, - EmNature.TRANSLATION : { - 'attach' : 'type', - 'automatic' : False, - 'maxdepth' : 1, - 'maxchildren' : -1 - }, - }, - } - - person = { - 'name' : 'person', - 'hierarchy' : { - EmNature.IDENTITY : { - 'attach' : 'classtype', - 'automatic' : True, - 'maxdepth' : -1, - 'maxchildren' : 1 + 'name': 'entity', + 'hierarchy': { + EmNature.PARENT: { + 'attach': 'classtype', + 'automatic': False, + 'maxdepth': -1, + 'maxchildren': -1 + }, + EmNature.TRANSLATION: { + 'attach': 'type', + 'automatic': False, + 'maxdepth': 1, + 'maxchildren': -1 }, }, } - @staticmethod - ## Return possible nature of relations for a classtype name + entry = { + 'name': 'entry', + 'hierarchy': { + EmNature.PARENT: { + 'attach': 'type', + 'automatic': False, + }, + EmNature.TRANSLATION: { + 'attach': 'type', + 'automatic': False, + 'maxdepth': 1, + 'maxchildren': -1 + }, + }, + } + + person = { + 'name': 'person', + 'hierarchy': { + EmNature.IDENTITY: { + 'attach': 'classtype', + 'automatic': True, + 'maxdepth': -1, + 'maxchildren': 1 + }, + }, + } + + ## natures (Method) + # + # Return possible nature of relations for a classtype name + # # @param classtype str: The classtype name - # @reurn A list of EmNature names (list of str) + # @return A list of EmNature names (list of str) + @staticmethod def natures(classtype_name): if not isinstance(classtype_name, str): raise TypeError("Excepted but got "+str(type(classtype_name))) diff --git a/EditorialModel/fieldgroups.py b/EditorialModel/fieldgroups.py index 75895be..458c144 100644 --- a/EditorialModel/fieldgroups.py +++ b/EditorialModel/fieldgroups.py @@ -64,7 +64,7 @@ class EmFieldGroup(EmComponent): def fields(self): field_table = sqlutils.getTable(EditorialModel.fields.EmField) req = field_table.select(field_table.c.uid).where(field_table.c.fieldgroup_id == self.uid) - conn = self.__class__.getDbE().connect() + conn = self.__class__.db_engine().connect() res = conn.execute(req) rows = res.fetchall() conn.close()