def _get_model_domain_object_instance(self, blog_post_model): """Returns blog post domain object instance created from the model. Args: blog_post_model: datastore_services.Model. Entity to validate. Returns: BlogPost. A domain object to validate. """ return blog_domain.BlogPost( blog_post_model.id, blog_post_model.author_id, blog_post_model.title, blog_post_model.content, blog_post_model.url_fragment, blog_post_model.tags, blog_post_model.thumbnail_filename, blog_post_model.last_updated, blog_post_model.published_on)
def get_blog_post_from_model(blog_post_model): """Returns a blog post domain object given a blog post model loaded from the datastore. Args: blog_post_model: BlogPostModel. The blog post model loaded from the datastore. Returns: BlogPost. A blog post domain object corresponding to the given blog post model. """ return blog_domain.BlogPost( blog_post_model.id, blog_post_model.author_id, blog_post_model.title, blog_post_model.content, blog_post_model.url_fragment, blog_post_model.tags, blog_post_model.thumbnail_filename, blog_post_model.last_updated, blog_post_model.published_on)