add ReadmeResource for quick start guide
This commit is contained in:
BIN
markup/Quick Start.pdf
Normal file
BIN
markup/Quick Start.pdf
Normal file
Binary file not shown.
@ -25,7 +25,7 @@ from djangodav.utils import url_join
|
|||||||
from djangodav.views import DavView
|
from djangodav.views import DavView
|
||||||
|
|
||||||
from procat2.models import Catalog
|
from procat2.models import Catalog
|
||||||
from procat2.settings import ASSET_DIR
|
from procat2.settings import BASE_DIR, ASSET_DIR
|
||||||
|
|
||||||
from .utils import clean_path, ensure_dir, set_file_perms, WORKDIR
|
from .utils import clean_path, ensure_dir, set_file_perms, WORKDIR
|
||||||
from .tasks import process_markup_pdf
|
from .tasks import process_markup_pdf
|
||||||
@ -56,6 +56,8 @@ def resource_factory(**kwargs):
|
|||||||
return CatalogResource(**kwargs)
|
return CatalogResource(**kwargs)
|
||||||
elif is_markup_catalog(path):
|
elif is_markup_catalog(path):
|
||||||
return MarkupResource(**kwargs)
|
return MarkupResource(**kwargs)
|
||||||
|
elif path == ReadmeResource.PATH:
|
||||||
|
return ReadmeResource(**kwargs)
|
||||||
else:
|
else:
|
||||||
return NonsensicalResource(**kwargs)
|
return NonsensicalResource(**kwargs)
|
||||||
|
|
||||||
@ -80,12 +82,16 @@ class RootFolderResource(MarkupDavResource):
|
|||||||
NAME = ''
|
NAME = ''
|
||||||
PATH = '/'
|
PATH = '/'
|
||||||
|
|
||||||
|
def __init__(self, path=PATH, user=None):
|
||||||
|
super().__init__(path=path, user=user)
|
||||||
|
|
||||||
def get_parent(self):
|
def get_parent(self):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def get_children(self):
|
def get_children(self):
|
||||||
children = [CatalogFolderResource(user=self.user),
|
children = [CatalogFolderResource(user=self.user),
|
||||||
MarkupResource(user=self.user),
|
MarkupResource(user=self.user),
|
||||||
|
ReadmeResource(user=self.user)
|
||||||
]
|
]
|
||||||
for child in children:
|
for child in children:
|
||||||
yield child
|
yield child
|
||||||
@ -324,3 +330,22 @@ class NonsensicalResource(MarkupDavResource):
|
|||||||
@property
|
@property
|
||||||
def exists(self):
|
def exists(self):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
class ReadmeResource(MarkupDavResource, DummyFSDAVResource):
|
||||||
|
NAME = 'Quick Start.pdf'
|
||||||
|
PATH = f'/{NAME}'
|
||||||
|
|
||||||
|
def __init__(self, path=PATH, user=None):
|
||||||
|
super().__init__(path=path, user=user)
|
||||||
|
|
||||||
|
def get_parent(self):
|
||||||
|
return RootFolderResource(user=self.user)
|
||||||
|
|
||||||
|
def get_children(self):
|
||||||
|
return
|
||||||
|
yield
|
||||||
|
|
||||||
|
def get_abs_path(self):
|
||||||
|
return os.path.join(BASE_DIR, 'markup', self.NAME)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user