Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Odevzdávací Systém MO
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Martin Mareš
Odevzdávací Systém MO
Commits
e28c24ee
Commit
e28c24ee
authored
4 years ago
by
Martin Mareš
Browse files
Options
Downloads
Patches
Plain Diff
Kešování aktuální času v rámci jednoho requestu
parent
210f93b5
No related branches found
No related tags found
1 merge request
!9
WIP: Zárodek uživatelské části webu a submitování
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
mo/web/__init__.py
+13
-3
13 additions, 3 deletions
mo/web/__init__.py
with
13 additions
and
3 deletions
mo/web/__init__.py
+
13
−
3
View file @
e28c24ee
import
datetime
import
dateutil.tz
from
flask
import
Flask
,
request
,
g
,
session
import
flask.logging
from
flask_bootstrap
import
Bootstrap
from
flask_sqlalchemy
import
SQLAlchemy
import
os
import
locale
import
logging
from
flask_bootstrap
import
Bootstrap
import
os
import
werkzeug.exceptions
import
mo.config
as
config
import
mo.config
as
config
import
mo.db
as
db
import
mo.users
...
...
@@ -83,6 +85,14 @@ def init_request():
app
.
before_request
(
init_request
)
# Kešování aktuálního času
def
get_request_time
()
->
datetime
.
datetime
:
if
not
hasattr
(
g
,
'
now
'
):
g
.
now
=
datetime
.
datetime
.
now
(
tz
=
dateutil
.
tz
.
UTC
)
return
g
.
now
# Většina webu je v samostatných modulech
import
mo.web.auth
import
mo.web.menu
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment