Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Side by Side Diff: appengine/monorail/framework/framework_constants.py

Issue 1868553004: Open Source Monorail (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is govered by a BSD-style
3 # license that can be found in the LICENSE file or at
4 # https://developers.google.com/open-source/licenses/bsd
5
6 """Some constants used throughout Monorail."""
7
8 import os
9 import re
10
11
12 # Number of seconds in various periods.
13 SECS_PER_MINUTE = 60
14 SECS_PER_HOUR = SECS_PER_MINUTE * 60
15 SECS_PER_DAY = SECS_PER_HOUR * 24
16 SECS_PER_MONTH = SECS_PER_DAY * 30
17 SECS_PER_YEAR = SECS_PER_DAY * 365
18
19 # When we write to memcache, let the values expire so that we don't
20 # get any unexpected super-old values as we make code changes over the
21 # years. Also, searches can contain date terms like [opened<today-1]
22 # that would become wrong if cached for a long time.
23 MEMCACHE_EXPIRATION = 6 * SECS_PER_HOUR
24
25 # Fulltext indexing happens asynchronously and we get no notification
26 # when the indexing operation has completed. So, when we cache searches
27 # that use fulltext terms, the results might be stale. We still do
28 # cache them and use the cached values, but we expire them so that the
29 # results cannot be stale for a long period of time.
30 FULLTEXT_MEMCACHE_EXPIRATION = 3 * SECS_PER_MINUTE
31
32 # Size in bytes of the largest form submission that we will accept
33 MAX_POST_BODY_SIZE = 10 * 1024 * 1024 # = 10 MB
34
35 # Special user ID and name to use when no user was specified.
36 NO_USER_SPECIFIED = 0
37 NO_SESSION_SPECIFIED = 0
38 NO_USER_NAME = '----'
39
40 # String to display when some field has no value.
41 NO_VALUES = '----'
42
43 # If the user enters one or more dashes, that means "no value". This is useful
44 # in bulk edit, inbound email, and commit log command where a blank field
45 # means "keep what was there" or is ignored.
46 NO_VALUE_RE = re.compile(r'^-+$')
47
48 # Used to loosely validate column spec. Mainly guards against malicious input.
49 COLSPEC_RE = re.compile(r'^[-.\w\s/]*$', re.UNICODE)
50 COLSPEC_COL_RE = re.compile(r'[-.\w/]+', re.UNICODE)
51
52 # Used to loosely validate sort spec. Mainly guards against malicious input.
53 SORTSPEC_RE = re.compile(r'^[-.\w\s/]*$', re.UNICODE)
54
55 # For the artifact search box autosizing when the user types a long query.
56 MIN_ARTIFACT_SEARCH_FIELD_SIZE = 38
57 MAX_ARTIFACT_SEARCH_FIELD_SIZE = 75
58 AUTOSIZE_STEP = 3
59
60 # Regular expressions used in parsing label and status configuration text
61 IDENTIFIER_REGEX = r'[-.\w]+'
62 IDENTIFIER_RE = re.compile(IDENTIFIER_REGEX, re.UNICODE)
63 # Labels and status values that are prefixed by a pound-sign are not displayed
64 # in autocomplete menus.
65 IDENTIFIER_DOCSTRING_RE = re.compile(
66 r'^(#?%s)[ \t]*=?[ \t]*(.*)$' % IDENTIFIER_REGEX,
67 re.MULTILINE | re.UNICODE)
68
69 # Number of label text fields that we can display on a web form for issues.
70 MAX_LABELS = 24
71
72 # Default number of comments to display on an artifact detail page at one time.
73 # Other comments will be paginated. This happens to be the same as the max
74 # set by the --max_comments_per_page flag.
75 DEFAULT_COMMENTS_PER_PAGE = 500
76
77 # Content type to use when serving JSON.
78 CONTENT_TYPE_JSON = 'application/x-javascript; charset=UTF-8'
79
80 # Maximum comments to index to keep the search index from choking. E.g., if an
81 # artifact had 1200 comments, only 0..99 and 701..1200 would be indexed.
82 # This mainly affects advocacy issues which are highly redundant anyway.
83 INITIAL_COMMENTS_TO_INDEX = 100
84 FINAL_COMMENTS_TO_INDEX = 500
85
86 # This is the longest string that GAE search will accept in one field.
87 # The entire serach document is also limited to 1M, so our limit is 800
88 # so that the comments leave room for metadata.
89 MAX_FTS_FIELD_SIZE = 800 * 1024
90
91 # Base path to EZT templates.
92 this_dir = os.path.dirname(__file__)
93 TEMPLATE_PATH = this_dir[:this_dir.rindex('/')] + '/templates/'
94
95 # Defaults for dooming a project.
96 DEFAULT_DOOM_REASON = 'No longer needed'
97 DEFAULT_DOOM_PERIOD = SECS_PER_DAY * 90
98
99 MAX_PROJECT_PEOPLE = 1000
100 MAX_PROJECT_NAME_LENGTH = 63
101
102 # When logging potentially long debugging strings, only show this many chars.
103 LOGGING_MAX_LENGTH = 2000
104
105 # Maps languages supported by google-code-prettify
106 # to the class name that should be added to code blocks in that language.
107 # This list should be kept in sync with the handlers registered
108 # in lang-*.js and prettify.js from the prettify project.
109 PRETTIFY_CLASS_MAP = {
110 ext: 'lang-' + ext
111 for ext in [
112 # Supported in lang-*.js
113 'apollo', 'agc', 'aea', 'lisp', 'el', 'cl', 'scm',
114 'css', 'go', 'hs', 'lua', 'fs', 'ml', 'proto', 'scala', 'sql', 'vb',
115 'vbs', 'vhdl', 'vhd', 'wiki', 'yaml', 'yml', 'clj',
116 # Supported in prettify.js
117 'htm', 'html', 'mxml', 'xhtml', 'xml', 'xsl',
118 'c', 'cc', 'cpp', 'cxx', 'cyc', 'm',
119 'json', 'cs', 'java', 'bsh', 'csh', 'sh', 'cv', 'py', 'perl', 'pl',
120 'pm', 'rb', 'js', 'coffee',
121 ]}
122
123 # Languages which are not specifically mentioned in prettify.js
124 # but which render intelligibly with the default handler.
125 PRETTIFY_CLASS_MAP.update(
126 (ext, '') for ext in [
127 'hpp', 'hxx', 'hh', 'h', 'inl', 'idl', 'swig', 'd',
128 'php', 'tcl', 'aspx', 'cfc', 'cfm',
129 'ent', 'mod', 'as',
130 'y', 'lex', 'awk', 'n', 'pde',
131 ])
132
133 # Languages which are not specifically mentioned in prettify.js
134 # but which should be rendered using a certain prettify module.
135 PRETTIFY_CLASS_MAP.update({
136 'docbook': 'lang-xml',
137 'dtd': 'lang-xml',
138 'duby': 'lang-rb',
139 'mk': 'lang-sh',
140 'mak': 'lang-sh',
141 'make': 'lang-sh',
142 'mirah': 'lang-rb',
143 'ss': 'lang-lisp',
144 'vcproj': 'lang-xml',
145 'xsd': 'lang-xml',
146 'xslt': 'lang-xml',
147 })
148
149 PRETTIFY_FILENAME_CLASS_MAP = {
150 'makefile': 'lang-sh',
151 'makefile.in': 'lang-sh',
152 'doxyfile': 'lang-sh', # Key-value pairs with hash comments
153 '.checkstyle': 'lang-xml',
154 '.classpath': 'lang-xml',
155 '.project': 'lang-xml',
156 }
157
158 OAUTH_SCOPE = 'https://www.googleapis.com/auth/userinfo.email'
OLDNEW
« no previous file with comments | « appengine/monorail/framework/framework_bizobj.py ('k') | appengine/monorail/framework/framework_helpers.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698