def add_post(title, body, publish_date, img, requires_login, author_id): date = datetime.now() if publish_date is None: publish_date = date else: publish_date = __parse_date(publish_date) requires_login = __parse_bool(requires_login.lower()) __validate_params(title, body, publish_date, requires_login) img_path = storage.upload_image_file(img, "post") post = Post(title, body, date, publish_date, img_path, requires_login, author_id) insert(post)
def add_author(name, biography): validate_params(name, biography) author = Author(name, biography) insert(author)
def add_video_category(name): video_category = VideoCategory(name) insert(video_category)
def add_ad(text, img, url): img_path = storage.upload_image_file(img, "ad") ad = Ad(text, img_path, url) insert(ad)
def add_symbol_subcategory(name, category_id): symbol_subcategory = SymbolSubcategory(name, category_id) insert(symbol_subcategory)
def add_video_view(current_date, uid, video_id): video_view = VideoView(current_date, uid, video_id) insert(video_view)
def add_post_view(current_date, uid, viewability, post_id): post_view = PostView(current_date, uid, viewability, post_id) insert(post_view)
def add_video(title, youtube_url, date, subcategory_id): video = Video(title, youtube_url, date, subcategory_id) insert(video)
def add_symbol(title, body, img, subcategory_id): img_path = storage.upload_image_file(img, "symbol") symbol = Symbol(title, body, img_path, subcategory_id) insert(symbol)
def add_symbol_category(name): symbol_category = SymbolCategory(name) insert(symbol_category)
def add_video_subcategory(name, category_id): video_subcategory = VideoSubcategory(name, category_id) insert(video_subcategory)
def add_forum_view(current_date, uid, forum_id): forum_view = ForumView(current_date, uid, forum_id) insert(forum_view)
def add_post(body, date, is_original_post, uid, forum_id, approved): forum_post = ForumPost(body, date, is_original_post, uid, forum_id, approved) insert(forum_post)
def add_forum(title, body, uid): validate_params(title, body) forum = Forum(title) id = insert(forum) add_post(body, datetime.now().isoformat(), True, uid, id, False)
def add_symbol_view(current_date, uid, viewability, symbol_id): symbol_view = SymbolView(current_date, uid, viewability, symbol_id) insert(symbol_view)