Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Gepetto
dashboard
Commits
cbccb2cc
Commit
cbccb2cc
authored
Oct 03, 2018
by
Guilhem Saurel
Browse files
dont update values that are the same
parent
6a7f2737
Pipeline
#1539
passed with stages
in 1 minute and 29 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
rainboard/models.py
View file @
cbccb2cc
...
...
@@ -11,8 +11,9 @@ from django.template.loader import get_template
from
django.utils.dateparse
import
parse_datetime
from
django.utils.safestring
import
mark_safe
import
git
import
requests
import
git
from
autoslug
import
AutoSlugField
from
ndh.models
import
Links
,
NamedModel
,
TimeStampedModel
from
ndh.utils
import
enum_to_choices
,
query_sum
...
...
@@ -249,11 +250,13 @@ class Project(Links, NamedModel, TimeStampedModel):
search
=
re
.
search
(
f
'set\s*\(\s*project_
{
key
}
\s+([^)]+)*\)'
,
content
,
re
.
I
)
if
search
:
try
:
old
=
self
.
__dict__
[
value
]
self
.
__dict__
[
value
]
=
search
.
groups
()[
0
].
strip
(
'''
\r\n\t
'"'''
)
self
.
save
()
old
=
getattr
(
self
,
value
)
new
=
search
.
groups
()[
0
].
strip
(
'''
\r\n\t
'"'''
)
if
old
!=
new
:
setattr
(
self
,
value
,
new
)
self
.
save
()
except
DataError
:
se
lf
.
__dict__
[
value
]
=
old
se
tattr
(
self
,
value
,
old
)
for
dependency
in
re
.
findall
(
r
'ADD_[A-Z]+_DEPENDENCY\s*\(["\']?([^ "\')]+).*["\']?\)'
,
content
,
re
.
I
):
project
=
Project
.
objects
.
filter
(
models
.
Q
(
slug
=
dependency
)
|
models
.
Q
(
slug
=
dependency
.
replace
(
'_'
,
'-'
)))
if
project
.
exists
():
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment