Пример #1
0
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
Пример #2
0
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
Пример #3
0
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
Пример #4
0
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
Пример #5
0
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
Пример #6
0
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
Пример #7
0
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')
Пример #8
0
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')
Пример #9
0
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')
Пример #10
0
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')
Пример #11
0
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')
Пример #12
0
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')