Esempio n. 1
0
def DeletePost():
    session = get_current_session()
    username = session.get('username','')
    if not username:
        return {'code': -2, 'msg': '未登录'}
    
    raw_url = request.POST.get("raw_url",'')
    entry_url = raw_url.replace(config.raw_url, config.entry_url).replace(config.raw_suffix, config.url_suffix)
    entry = entryService.find_by_url(entryService.types.entry, entry_url).entry
    entryService.delete_entry(entry.path)
    os.remove(entry.path)
    
    if entry.private:
        entryService.del_private(entry.path)
    
    return {'code': 0, 'msg': '删除成功'}
Esempio n. 2
0
def DeletePost():
    session = get_current_session()
    username = session.get('username', '')
    if not username:
        return {'code': -2, 'msg': '未登录'}

    raw_url = request.POST.get("raw_url", '')
    entry_url = raw_url.replace(config.raw_url, config.entry_url).replace(
        config.raw_suffix, config.url_suffix)
    entry = entryService.find_by_url(entryService.types.entry, entry_url).entry
    entryService.delete_entry(entry.path)
    os.remove(entry.path)

    if entry.private:
        entryService.del_private(entry.path)

    return {'code': 0, 'msg': '删除成功'}