Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
Cranspasswords
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Gabriel Detraz
Cranspasswords
Commits
8d4cda9f
Commit
8d4cda9f
authored
Apr 12, 2013
by
Vincent Le gallic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ce n'est pas le boulot de notification() de faire le backup, mais il faut penser à appeler backup()
parent
167e9887
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
9 deletions
+10
-9
server.py
server.py
+10
-9
No files found.
server.py
View file @
8d4cda9f
...
...
@@ -93,11 +93,11 @@ def putfile(filename):
if
not
validate
(
oldroles
,
'w'
):
return
False
notification
(
"Modification de %s"
%
filename
,
"Le fichier %s a été modifié par %s."
%
(
filename
,
MYUID
)
,
filename
,
old
)
backup
(
filename
,
old
)
notification
(
u
"Modification de %s"
%
filename
,
u
"Le fichier %s a été modifié par %s."
%
(
filename
,
MYUID
),
filename
,
old
)
writefile
(
filepath
,
json
.
dumps
({
'roles'
:
roles
,
'contents'
:
contents
}))
return
True
...
...
@@ -110,9 +110,10 @@ def rmfile(filename):
return
True
else
:
if
validate
(
roles
,
'w'
):
notification
(
"Suppression de %s"
%
filename
,
\
"Le fichier %s a été supprimé par %s."
%
\
(
filename
,
MYUID
),
filename
,
old
)
backup
(
filename
,
old
)
notification
(
u
"Suppression de %s"
%
filename
,
u
"Le fichier %s a été supprimé par %s."
%
(
filename
,
MYUID
),
filename
,
old
)
os
.
remove
(
getpath
(
filename
))
else
:
return
False
...
...
@@ -125,7 +126,7 @@ def backup(fname, old):
back
.
write
(
'
\n
'
)
back
.
write
(
'* %s: %s
\n
'
%
(
str
(
datetime
.
datetime
.
now
()),
corps
))
back
.
close
()
def
notification
(
subject
,
corps
,
fname
,
old
):
"""Envoie par mail une notification de changement de fichier"""
conn
=
smtplib
.
SMTP
(
'localhost'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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