Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
zesje
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Réouven ASSOULY
zesje
Commits
fe18d043
Commit
fe18d043
authored
7 years ago
by
Anton Akhmerov
Browse files
Options
Downloads
Patches
Plain Diff
implement full export
parent
a9754f46
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
zesje/api.py
+7
-0
7 additions, 0 deletions
zesje/api.py
zesje/resources/export.py
+23
-0
23 additions, 0 deletions
zesje/resources/export.py
with
30 additions
and
0 deletions
zesje/api.py
+
7
−
0
View file @
fe18d043
...
...
@@ -9,6 +9,7 @@ from .resources.submissions import Submissions
from
.resources
import
signature
from
.resources
import
images
from
.resources
import
summary_plot
from
.resources
import
export
from
.resources.problems
import
Problems
from
.resources.feedback
import
Feedback
...
...
@@ -53,3 +54,9 @@ api_bp.add_url_rule(
'
exam_summary
'
,
summary_plot
.
get
,
)
api_bp
.
add_url_rule
(
'
/export/full
'
,
'
full_export
'
,
export
.
full
,
)
This diff is collapsed.
Click to expand it.
zesje/resources/export.py
0 → 100644
+
23
−
0
View file @
fe18d043
import
os
from
io
import
BytesIO
from
flask
import
abort
,
Response
,
current_app
as
app
from
pony
import
orm
from
..helpers
import
db_helper
def
full
():
"""
Export the complete database
Returns
-------
course.sqlite
"""
data_dir
=
app
.
config
[
'
DATA_DIRECTORY
'
]
with
open
(
os
.
path
.
join
(
data_dir
,
'
course.sqlite
'
),
'
rb
'
)
as
f
:
data
=
f
.
read
()
resp
=
Response
(
data
,
200
)
resp
.
headers
.
set
(
'
Content-Disposition
'
,
'
attachment
'
,
filename
=
'
course.sqlite
'
)
return
resp
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