Seperated Logic for ProjectSurvey and GradingProject surveys.
These changes also include their respective records.
--- a/app/soc/logic/models/survey.py Sun Jun 28 23:58:03 2009 +0200
+++ b/app/soc/logic/models/survey.py Mon Jun 29 13:50:03 2009 +0200
@@ -405,8 +405,32 @@
# return the scope
return entity.scope
+class ProjectLogic(Logic):
+ """Logic class for ProjectSurvey.
+ """
+
+ def __init__(self, model=ProjectSurvey,
+ base_model=None, scope_logic=None):
+ """Defines the name, key_name and model for this entity.
+ """
+
+ super(Logic, self).__init__(model=model, base_model=base_model,
+ scope_logic=scope_logic)
+
+
+class GradingProjectLogic(ProjectLogic):
+ """Logic class for GradingProjectSurvey
+ """
+
+ def __init__(self, model=GradingProjectSurvey,
+ base_model=None, scope_logic=None):
+ """Defines the name, key_name and model for this entity.
+ """
+
+ super(Logic, self).__init__(model=model, base_model=base_model,
+ scope_logic=scope_logic)
+
logic = Logic()
-# TODO separate project and grading logic into own class to overwrite methods
-project_logic = Logic(model=ProjectSurvey)
-grading_logic = Logic(model=GradingProjectSurvey)
+project_logic = ProjectLogic()
+grading_logic = GradingProjectLogic()
--- a/app/soc/logic/models/survey_record.py Sun Jun 28 23:58:03 2009 +0200
+++ b/app/soc/logic/models/survey_record.py Mon Jun 29 13:50:03 2009 +0200
@@ -82,10 +82,35 @@
return survey_record
+class ProjectLogic(Logic):
+ """Logic class for ProjectSurveyRecord.
+ """
+
+ def __init__(self, model=ProjectSurveyRecord,
+ base_model=None, scope_logic=None):
+ """Defines the name, key_name and model for this entity.
+ """
+
+ super(Logic, self).__init__(model=model, base_model=base_model,
+ scope_logic=scope_logic)
+
+
+class GradingProjectLogic(ProjectLogic):
+ """Logic class for GradingProjectSurveyRecord
+ """
+
+ def __init__(self, model=GradingProjectSurveyRecord,
+ base_model=None, scope_logic=None):
+ """Defines the name, key_name and model for this entity.
+ """
+
+ super(Logic, self).__init__(model=model, base_model=base_model,
+ scope_logic=scope_logic)
+
+
logic = Logic()
-# TODO separate project and grading logic into own class to overwrite methods
-project_logic = Logic(model=ProjectSurveyRecord)
-grading_logic = Logic(model=GradingProjectSurveyRecord)
+project_logic = ProjectLogic()
+grading_logic = GradingProjectLogic()
def updateSurveyRecord(user, survey, survey_record, fields):