|
@@ -1,4 +1,5 @@
|
|
from flask import request, Blueprint
|
|
from flask import request, Blueprint
|
|
|
|
+from flask.wrappers import Response
|
|
from flask_restful import Resource, Api
|
|
from flask_restful import Resource, Api
|
|
from os import path, remove, walk, mkdir
|
|
from os import path, remove, walk, mkdir
|
|
import logging
|
|
import logging
|
|
@@ -187,9 +188,12 @@ def gen_content():
|
|
name = request.json.get('name', 'Undefind')
|
|
name = request.json.get('name', 'Undefind')
|
|
dir_ = path.join(_search_content_dir(
|
|
dir_ = path.join(_search_content_dir(
|
|
request.json.get('type'), request.json.get('categories')), name)
|
|
request.json.get('type'), request.json.get('categories')), name)
|
|
|
|
+ #print(name)
|
|
if dir_:
|
|
if dir_:
|
|
if not path.exists(dir_):
|
|
if not path.exists(dir_):
|
|
mkdir(dir_)
|
|
mkdir(dir_)
|
|
|
|
+ else:
|
|
|
|
+ return Response({},status=201)
|
|
if not path.exists(path.join(dir_, 'img')):
|
|
if not path.exists(path.join(dir_, 'img')):
|
|
mkdir(path.join(dir_, 'img'))
|
|
mkdir(path.join(dir_, 'img'))
|
|
with open(path.join(dir_, 'index.md'), 'w', encoding="utf-8") as md:
|
|
with open(path.join(dir_, 'index.md'), 'w', encoding="utf-8") as md:
|