Skip to content

Commit

Permalink
Renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
vr2262 committed Aug 7, 2015
1 parent 7d93785 commit 879967d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions dokomoforms/api/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def current_user(self):
"""The handler's current_user."""
return self.r_handler.current_user

def get_model(self, model_id, model_cls=None):
def _get_model(self, model_id, model_cls=None):
"""Get an instance of this model class by id."""
if model_cls is None:
model_cls = self.resource_type
Expand Down Expand Up @@ -214,7 +214,7 @@ def _specific_fields(self, model_or_models, is_detail=True):

def detail(self, model_id):
"""Return a single instance of a model."""
return self._specific_fields(self.get_model(model_id))
return self._specific_fields(self._get_model(model_id))

def list(self, where=None):
"""Return a list of instances of this model.
Expand Down Expand Up @@ -312,15 +312,15 @@ def list(self, where=None):

def update(self, model_id):
"""Update a model."""
model = self.get_model(model_id)
model = self._get_model(model_id)
with self.session.begin():
for attribute, value in self.data.items():
setattr(model, attribute, value)
return model

def delete(self, model_id):
"""Set the deleted attribute to True. Does not destroy the instance."""
model = self.get_model(model_id)
model = self._get_model(model_id)
with self.session.begin():
model.deleted = True

Expand Down
4 changes: 2 additions & 2 deletions dokomoforms/api/submissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def _create_submission(self, survey):
# If logged in, add enumerator
if self.current_user_model is not None:
try:
enumerator = self.get_model(
enumerator = self._get_model(
self.data['enumerator_user_id'], model_cls=User
)
except KeyError:
Expand Down Expand Up @@ -120,7 +120,7 @@ def create(self):
"""
survey_id = self.data.pop('survey_id')
try:
survey = self.get_model(survey_id, model_cls=Survey)
survey = self._get_model(survey_id, model_cls=Survey)
except NoResultFound:
raise exc.BadRequest(
'The survey could not be found: {}'.format(survey_id)
Expand Down
2 changes: 1 addition & 1 deletion dokomoforms/api/surveys.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def create(self):

def submit(self, survey_id):
"""Submit to a survey."""
return _create_submission(self, self.get_model(survey_id))
return _create_submission(self, self._get_model(survey_id))

def list_submissions(self, survey_id):
"""List all submissions for a survey."""
Expand Down

0 comments on commit 879967d

Please sign in to comment.