Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
uffd2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
thies
uffd2
Commits
1ed39c8e
Commit
1ed39c8e
authored
2 years ago
by
Julian
Browse files
Options
Downloads
Patches
Plain Diff
Remove unused json encoder customizations
parent
9545981a
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
uffd/__init__.py
+1
-2
1 addition, 2 deletions
uffd/__init__.py
uffd/database.py
+0
-12
0 additions, 12 deletions
uffd/database.py
with
1 addition
and
14 deletions
uffd/__init__.py
+
1
−
2
View file @
1ed39c8e
...
@@ -8,7 +8,7 @@ from babel.dates import LOCALTZ
...
@@ -8,7 +8,7 @@ from babel.dates import LOCALTZ
from
werkzeug.exceptions
import
Forbidden
from
werkzeug.exceptions
import
Forbidden
from
flask_migrate
import
Migrate
from
flask_migrate
import
Migrate
from
.database
import
db
,
SQLAlchemyJSON
,
customize_db_engine
from
.database
import
db
,
customize_db_engine
from
.template_helper
import
register_template_helper
from
.template_helper
import
register_template_helper
from
.navbar
import
setup_navbar
from
.navbar
import
setup_navbar
from
.csrf
import
bp
as
csrf_bp
from
.csrf
import
bp
as
csrf_bp
...
@@ -52,7 +52,6 @@ def init_config(app: Flask, test_config):
...
@@ -52,7 +52,6 @@ def init_config(app: Flask, test_config):
def
create_app
(
test_config
=
None
):
# pylint: disable=too-many-locals,too-many-statements
def
create_app
(
test_config
=
None
):
# pylint: disable=too-many-locals,too-many-statements
app
=
Flask
(
__name__
,
instance_relative_config
=
False
)
app
=
Flask
(
__name__
,
instance_relative_config
=
False
)
app
.
json_encoder
=
SQLAlchemyJSON
init_config
(
app
,
test_config
)
init_config
(
app
,
test_config
)
...
...
This diff is collapsed.
Click to expand it.
uffd/database.py
+
0
−
12
View file @
1ed39c8e
from
collections
import
OrderedDict
from
sqlalchemy
import
MetaData
,
event
from
sqlalchemy
import
MetaData
,
event
from
sqlalchemy.types
import
TypeDecorator
,
Text
from
sqlalchemy.types
import
TypeDecorator
,
Text
from
sqlalchemy.ext.mutable
import
MutableList
from
sqlalchemy.ext.mutable
import
MutableList
from
flask_sqlalchemy
import
SQLAlchemy
from
flask_sqlalchemy
import
SQLAlchemy
from
flask.json
import
JSONEncoder
convention
=
{
convention
=
{
'
ix
'
:
'
ix_%(column_0_label)s
'
,
'
ix
'
:
'
ix_%(column_0_label)s
'
,
...
@@ -48,15 +45,6 @@ def customize_db_engine(engine):
...
@@ -48,15 +45,6 @@ def customize_db_engine(engine):
cursor
.
execute
(
'
SET NAMES utf8mb4 COLLATE utf8mb4_nopad_bin
'
)
cursor
.
execute
(
'
SET NAMES utf8mb4 COLLATE utf8mb4_nopad_bin
'
)
cursor
.
close
()
cursor
.
close
()
class
SQLAlchemyJSON
(
JSONEncoder
):
def
default
(
self
,
o
):
if
isinstance
(
o
,
db
.
Model
):
result
=
OrderedDict
()
for
key
in
o
.
__mapper__
.
c
.
keys
():
result
[
key
]
=
getattr
(
o
,
key
)
return
result
return
JSONEncoder
.
default
(
self
,
o
)
class
CommaSeparatedList
(
TypeDecorator
):
class
CommaSeparatedList
(
TypeDecorator
):
# For some reason TypeDecorator.process_literal_param and
# For some reason TypeDecorator.process_literal_param and
# TypeEngine.python_type are abstract but not actually required
# TypeEngine.python_type are abstract but not actually required
...
...
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