[TASK] Rename Citavi.CitaviProject to Citavi.Project. Introduce Mapper class.
This commit is contained in:
parent
34d4226f2b
commit
9e58a69285
@ -137,7 +137,7 @@ class UpdateProjectView(ProtectedFormView, SingleObjectMixin):
|
|||||||
|
|
||||||
""" Test if SQLite is a valid citavi project. """
|
""" Test if SQLite is a valid citavi project. """
|
||||||
from service import Citavi
|
from service import Citavi
|
||||||
citavi_project = Citavi.CitaviProject(temp_sqlite)
|
citavi_project = Citavi.Project(temp_sqlite)
|
||||||
citavi_project_valid = citavi_project.is_valid()
|
citavi_project_valid = citavi_project.is_valid()
|
||||||
""" Free temporary ressources. """
|
""" Free temporary ressources. """
|
||||||
del citavi_project
|
del citavi_project
|
||||||
@ -163,7 +163,7 @@ class UpdateProjectView(ProtectedFormView, SingleObjectMixin):
|
|||||||
|
|
||||||
""" Refresh identities from citavi project. """
|
""" Refresh identities from citavi project. """
|
||||||
# TODO
|
# TODO
|
||||||
#citavi_project = Citavi.CitaviProject(sqlite_path)
|
#citavi_project = Citavi.Project(sqlite_path)
|
||||||
#del citavi_project
|
#del citavi_project
|
||||||
return super(UpdateProjectView, self).form_valid(form)
|
return super(UpdateProjectView, self).form_valid(form)
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ from sqlalchemy.ext.automap import automap_base
|
|||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
|
|
||||||
|
|
||||||
class CitaviProject():
|
class Project():
|
||||||
""" A helper class representing a Citavi project. """
|
""" A helper class representing a Citavi project. """
|
||||||
def __init__(self, sqlite_file):
|
def __init__(self, sqlite_file):
|
||||||
""" Constructor to get absolute path to sqlite. """
|
""" Constructor to get absolute path to sqlite. """
|
||||||
@ -24,9 +24,15 @@ class CitaviProject():
|
|||||||
return self._is_open and not self._is_error
|
return self._is_open and not self._is_error
|
||||||
|
|
||||||
def get_persons(self):
|
def get_persons(self):
|
||||||
|
""" Returns all persons from the Citavi project. """
|
||||||
try:
|
try:
|
||||||
PersonClass = self._sa_sqlite_autobase.classes.Person
|
person_class = self._sa_sqlite_autobase.classes.Person
|
||||||
|
citavi_persons = self._sa_sqlite_session.query(person_class).all()
|
||||||
|
return citavi_persons
|
||||||
except:
|
except:
|
||||||
|
self._is_error = True
|
||||||
|
# TODO: better error handling!
|
||||||
|
print "An error occured within a get_person call!"
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def open(self):
|
def open(self):
|
||||||
@ -71,6 +77,15 @@ class CitaviProject():
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class Mapper():
|
||||||
|
""" A class encapsulating the django models for mapping against Citavi projects. """
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def __del__(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user