def get_by_id(cm_id, caller_id, news_id): """ @clmview_admin_clm @param_post{news_id} @response{dict} dict property of the requested News """ return News.get(news_id).dict
def get_by_id(cm_id, caller_id, news_id): """ Returns requested News @prm{news_id}. @clm_view_transparent{cluster.get_by_id()} @response{dict} requested News """ return News.get(news_id).dict
def delete(cm_id, caller_id, news_id): """ Deletes specified News. @clmview_admin_clm @parameter{news_id,int} id of the News to delete """ news = News.get(news_id) try: news.delete() except CLMException, e: raise e
def delete(cm_id, caller_id, news_id): """ Deletes permanently specified News. Deleted News can i no way be recovered. @clmview_admin_clm @param_post{news_id,int} id of the News to delete """ news = News.get(news_id) try: news.delete() except CLMException, e: raise e
def edit(cm_id, caller_id, news_id, topic='', content='', sticky=False): """ Edits specified News. @clmview_admin_clm @parameter{news_id,int} id of the News to edit @parameter{topic,string} new topic of the News @parameter{content,string} new content of the News @parameter{sticky,bool} Whether should be kept displayed long-term """ news = News.get(news_id) news.topic = topic news.content = content news.sticky = sticky try: news.save() except: raise CLMException('news_edit')
def edit(cm_id, caller_id, news_id, topic=None, content=None, sticky=None): """ @clmview_admin_clm @param_post{news_id,int} id of the News to edit @param_post{topic,string} new topic of the News @param_post{content,string} new content of the News @param_post{sticky,bool} whether the News should stay displayed long-term """ news = News.get(news_id) if topic: news.topic = topic if content: news.content = content if sticky is not None: news.sticky = sticky try: news.save() except: raise CLMException('news_edit')
def add(cm_id, caller_id, topic='', content='', sticky=False): """ Creates and saves new News. Such a News appears on the Web Interface's home screen. @clmview_admin_clm @param_post{topic,string} @param_post{content,string} @param_post{sticky,bool} whether the News should stay displayed long-term """ news = News() news.topic = topic news.content = content news.sticky = sticky news.date = datetime.now() try: news.save() except: raise CLMException('news_create')
def add(cm_id, caller_id, topic='', content='', sticky=False): """ @clmview_admin_clm @parameter{topic,string} @parameter{content,string} @parameter{sticky,bool} Whether should be kept displayed long-term Creates News described by params. Next it adds it to database. """ news = News() news.topic = topic news.content = content news.sticky = sticky news.date = datetime.now() try: news.save() except: raise CLMException('news_create')