The part of the application that I am coding is structured like this:
class PostModel(db.Model):
some_property = db.WhateverProperty()
some_other_property = db.WhateverProperty()
class PostHandler(webapp.RequestHandler):
def get(self):
def post(self):
Now, from what I read about MVC, this validation logic should be in the model, right? So should I do something like this instead?
class PostModel(db.Model):
some_property = db.WhateverProperty()
some_other_property = db.WhateverProperty()
@staticmethod
def validation_logic(form_input):
@staticmethod
def save_to_datastore(form_input):
class PostHandler(webapp.RequestHandler):
def get(self):
def post(self):
try:
PostModel.validation_logic(form_input)
except CustomException,e:
self.redirect('/errorpage?msg='+e.msg)
PostModel.save_to_datastore(form_input)
Is this a good form of MVC?
liewl source
share