-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathconstants.py
136 lines (104 loc) · 3.77 KB
/
constants.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
"""Constants for websites"""
from model_utils import Choices
CONTENT_TYPE_PAGE = "page"
CONTENT_TYPE_VIDEO_GALLERY = "video_gallery"
CONTENT_TYPE_RESOURCE = "resource"
CONTENT_TYPE_RESOURCE_COLLECTION = "resource_collections"
CONTENT_TYPE_RESOURCE_LIST = "resource-list"
CONTENT_TYPE_INSTRUCTOR = "instructor"
CONTENT_TYPE_METADATA = "sitemetadata"
CONTENT_TYPE_NAVMENU = "navmenu"
CONTENT_TYPE_COURSE_LIST = "course-lists"
CONTENT_TYPE_EXTERNAL_RESOURCE = "external-resource"
CONTENT_TYPE_WEBSITE = "website"
BATCH_SIZE_EXTERNAL_RESOURCE_STATUS_CHECK = 100
COURSE_PAGE_LAYOUTS = ["instructor_insights"]
COURSE_RESOURCE_LAYOUTS = ["pdf", "video"]
CONTENT_FILENAME_MAX_LEN = 125
CONTENT_FILENAMES_FORBIDDEN = ("index", "_index")
CONTENT_DIRPATH_MAX_LEN = 300
CONTENT_FILEPATH_UNIQUE_CONSTRAINT = "unique_page_content_destination"
WEBSITE_SOURCE_STUDIO = "studio"
WEBSITE_SOURCE_OCW_IMPORT = "ocw-import"
WEBSITE_SOURCES = [WEBSITE_SOURCE_STUDIO, WEBSITE_SOURCE_OCW_IMPORT]
STARTER_SOURCE_GITHUB = "github"
STARTER_SOURCE_LOCAL = "local"
STARTER_SOURCES = [STARTER_SOURCE_GITHUB, STARTER_SOURCE_LOCAL]
WEBSITE_CONFIG_FILENAME = "ocw-studio.yml"
WEBSITE_CONFIG_CONTENT_DIR_KEY = "content-dir"
WEBSITE_CONFIG_DEFAULT_CONTENT_DIR = "content"
WEBSITE_CONFIG_ROOT_URL_PATH_KEY = "root-url-path"
WEBSITE_CONFIG_SITE_URL_FORMAT_KEY = "site-url-format"
WEBSITE_CONTENT_FILETYPE = "md"
CONTENT_MENU_FIELD = "menu"
OMNIBUS_STARTER_SLUG = "omnibus-starter"
OCW_WWW_STARTER_SLUG = "ocw-www"
GLOBAL_ADMIN = "global_admin"
GLOBAL_AUTHOR = "global_author"
ADMIN_GROUP_PREFIX = "admins_website_"
EDITOR_GROUP_PREFIX = "editors_website_"
PERMISSION_ADD = "websites.add_website"
PERMISSION_VIEW = "websites.view_website"
PERMISSION_PREVIEW = "websites.preview_website"
PERMISSION_EDIT = "websites.change_website"
PERMISSION_PUBLISH = "websites.publish_website"
PERMISSION_EDIT_CONTENT = "websites.edit_content_website"
PERMISSION_COLLABORATE = "websites.add_collaborators_website"
ROLE_ADMINISTRATOR = "admin"
ROLE_EDITOR = "editor"
ROLE_GLOBAL = "global_admin"
ROLE_OWNER = "owner"
GROUP_ROLES = {ROLE_ADMINISTRATOR, ROLE_EDITOR}
ROLE_GROUP_MAPPING = {
ROLE_ADMINISTRATOR: ADMIN_GROUP_PREFIX,
ROLE_EDITOR: EDITOR_GROUP_PREFIX,
ROLE_GLOBAL: GLOBAL_ADMIN,
}
PERMISSIONS_GLOBAL_AUTHOR = [PERMISSION_ADD]
PERMISSIONS_EDITOR = [PERMISSION_VIEW, PERMISSION_PREVIEW, PERMISSION_EDIT_CONTENT]
PERMISSIONS_ADMIN = [
*PERMISSIONS_EDITOR,
PERMISSION_PUBLISH,
PERMISSION_COLLABORATE,
PERMISSION_EDIT,
]
INSTRUCTORS_FIELD_NAME = "instructors"
EXTERNAL_IDENTIFIER_PREFIX = "external-"
RESOURCE_TYPE_VIDEO = "Video"
RESOURCE_TYPE_DOCUMENT = "Document"
RESOURCE_TYPE_IMAGE = "Image"
RESOURCE_TYPE_OTHER = "Other"
ADMIN_ONLY_CONTENT = ["sitemetadata"]
PUBLISH_STATUS_SUCCEEDED = "succeeded"
PUBLISH_STATUS_PENDING = "pending"
PUBLISH_STATUS_STARTED = "started"
PUBLISH_STATUS_ERRORED = "errored"
PUBLISH_STATUS_ABORTED = "aborted"
PUBLISH_STATUS_NOT_STARTED = "not-started"
PUBLISH_STATUSES = [
PUBLISH_STATUS_SUCCEEDED,
PUBLISH_STATUS_PENDING,
PUBLISH_STATUS_STARTED,
PUBLISH_STATUS_ERRORED,
PUBLISH_STATUS_ABORTED,
PUBLISH_STATUS_NOT_STARTED,
]
PUBLISH_STATUSES_FINAL = [
PUBLISH_STATUS_SUCCEEDED,
PUBLISH_STATUS_ERRORED,
PUBLISH_STATUS_ABORTED,
]
OCW_HUGO_THEMES_GIT = "https://github.com/mitodl/ocw-hugo-themes.git"
class WebsiteStarterStatus:
"""Simple class for values/keys of status in website starter"""
DEFAULT = "default"
ACTIVE = "active"
INACTIVE = "inactive"
ALLOWED_STATUSES = [DEFAULT, ACTIVE]
ALL_STATUSES = [DEFAULT, ACTIVE, INACTIVE]
WEBSITE_STARTER_STATUS_CHOICES = Choices(
(WebsiteStarterStatus.DEFAULT, "Default"),
(WebsiteStarterStatus.ACTIVE, "Active"),
(WebsiteStarterStatus.INACTIVE, "Inactive"),
)
WEBSITE_CONTENT_LEFTNAV = "leftnav"