Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
proto3
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
protokollsystem
proto3
Commits
3efbb9c9
Commit
3efbb9c9
authored
7 years ago
by
Robin Sonnabend
Browse files
Options
Downloads
Patches
Plain Diff
Fix XML RPC dokuwiki push
ref
#157
parent
28612a9d
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
tasks.py
+23
-14
23 additions, 14 deletions
tasks.py
with
23 additions
and
14 deletions
tasks.py
+
23
−
14
View file @
3efbb9c9
...
@@ -517,14 +517,22 @@ def push_to_dokuwiki(protocol, content, summary):
...
@@ -517,14 +517,22 @@ def push_to_dokuwiki(protocol, content, summary):
@celery.task
@celery.task
def
push_to_dokuwiki_async
(
protocol_id
,
content
,
summary
):
def
push_to_dokuwiki_async
(
protocol_id
,
content
,
summary
):
with
app
.
app_context
():
protocol
=
Protocol
.
query
.
filter_by
(
id
=
protocol_id
).
first
()
protocol
=
Protocol
.
query
.
filter_by
(
id
=
protocol_id
).
first
()
with
xmlrpc
.
client
.
ServerProxy
(
config
.
WIKI_API_URL
)
as
proxy
:
with
xmlrpc
.
client
.
ServerProxy
(
config
.
WIKI_API_URL
)
as
proxy
:
try
:
if
not
proxy
.
wiki
.
putPage
(
protocol
.
get_wiki_title
(),
if
not
proxy
.
wiki
.
putPage
(
protocol
.
get_wiki_title
(),
content
,
{
"
sum
"
:
"
Automatisch generiert vom Protokollsystem 3.
"
}):
content
,
{
"
sum
"
:
"
Automatisch generiert vom Protokollsystem 3.
"
}):
error
=
protocol
.
create_error
(
"
Pushing to Wiki
"
,
error
=
protocol
.
create_error
(
"
Pushing to Wiki
"
,
"
Pushing to Wiki failed.
"
""
)
"
Pushing to Wiki failed.
"
""
)
db
.
session
.
add
(
error
)
db
.
session
.
add
(
error
)
db
.
session
.
commit
()
db
.
session
.
commit
()
except
xmlrpc
.
client
.
Error
as
exception
:
error
=
protocol
.
create_error
(
"
Pushing to Wiki
"
,
"
XML RPC Exception
"
,
str
(
exception
))
db
.
session
.
add
(
error
)
db
.
session
.
commit
()
def
compile
(
content
,
protocol
,
show_private
,
maxdepth
):
def
compile
(
content
,
protocol
,
show_private
,
maxdepth
):
compile_async
.
delay
(
content
,
protocol
.
id
,
show_private
=
show_private
,
maxdepth
=
maxdepth
)
compile_async
.
delay
(
content
,
protocol
.
id
,
show_private
=
show_private
,
maxdepth
=
maxdepth
)
...
@@ -595,19 +603,20 @@ def compile_async(content, protocol_id, show_private=False, use_decision=False,
...
@@ -595,19 +603,20 @@ def compile_async(content, protocol_id, show_private=False, use_decision=False,
except
subprocess
.
SubprocessError
:
except
subprocess
.
SubprocessError
:
log
=
""
log
=
""
total_log_filename
=
os
.
path
.
join
(
compile_dir
,
log_filename
)
total_log_filename
=
os
.
path
.
join
(
compile_dir
,
log_filename
)
if
os
.
path
.
isfile
(
total_log_filename
):
with
open
(
total_log_filename
,
"
r
"
)
as
log_file
:
log
=
"
Log:
\n\n
"
+
add_line_numbers
(
log_file
.
read
())
else
:
log
=
"
Logfile not found.
"
total_source_filename
=
os
.
path
.
join
(
compile_dir
,
protocol_source_filename
)
total_source_filename
=
os
.
path
.
join
(
compile_dir
,
protocol_source_filename
)
log
=
""
if
os
.
path
.
isfile
(
total_source_filename
):
if
os
.
path
.
isfile
(
total_source_filename
):
with
open
(
total_source_filename
,
"
r
"
)
as
source_file
:
with
open
(
total_source_filename
,
"
r
"
)
as
source_file
:
log
+=
"
\n\n
Source:
\n\n
"
+
add_line_numbers
(
source_file
.
read
())
log
+=
"
Source:
\n\n
"
+
add_line_numbers
(
source_file
.
read
())
total_class_filename
=
os
.
path
.
join
(
compile_dir
,
protocol_class_filename
)
total_class_filename
=
os
.
path
.
join
(
compile_dir
,
protocol_class_filename
)
if
os
.
path
.
isfile
(
total_class_filename
):
if
os
.
path
.
isfile
(
total_class_filename
):
with
open
(
total_class_filename
,
"
r
"
)
as
class_file
:
with
open
(
total_class_filename
,
"
r
"
)
as
class_file
:
log
+=
"
\n\n
Class:
\n\n
"
+
add_line_numbers
(
class_file
.
read
())
log
+=
"
\n\n
Class:
\n\n
"
+
add_line_numbers
(
class_file
.
read
())
if
os
.
path
.
isfile
(
total_log_filename
):
with
open
(
total_log_filename
,
"
r
"
)
as
log_file
:
log
+=
"
\n\n
Log:
\n\n
"
+
add_line_numbers
(
log_file
.
read
())
else
:
log
+=
"
\n\n
Logfile not found.
"
error
=
protocol
.
create_error
(
"
Compiling
"
,
"
Compiling LaTeX failed
"
,
log
)
error
=
protocol
.
create_error
(
"
Compiling
"
,
"
Compiling LaTeX failed
"
,
log
)
db
.
session
.
add
(
error
)
db
.
session
.
add
(
error
)
db
.
session
.
commit
()
db
.
session
.
commit
()
...
...
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