Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
gajim-plugins
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
Model registry
Operate
Environments
Monitor
Incidents
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
Evert Mouw
gajim-plugins
Commits
07af0f43
Commit
07af0f43
authored
8 years ago
by
Philipp Hörist
Browse files
Options
Downloads
Patches
Plain Diff
[httpupload] Refactor error stanza handling
parent
eddbe04b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
httpupload/httpupload.py
+17
-21
17 additions, 21 deletions
httpupload/httpupload.py
with
17 additions
and
21 deletions
httpupload/httpupload.py
+
17
−
21
View file @
07af0f43
...
...
@@ -334,20 +334,26 @@ class Base(object):
progress_messages
=
Queue
(
8
)
event
=
threading
.
Event
()
progress_window
=
ProgressWindow
(
_
(
'
HTTP Upload
'
),
_
(
'
Requesting HTTP Upload Slot...
'
),
progress_messages
,
self
.
plugin
,
event
)
def
upload_file
(
stanza
):
if
stanza
.
getType
()
==
'
error
'
:
ErrorDialog
(
_
(
'
Could not request upload slot
'
),
stanza
.
getErrorMsg
(),
transient_for
=
self
.
chat_control
.
parent_win
.
window
)
log
.
error
(
stanza
)
progress_window
.
close_dialog
()
return
slot
=
stanza
.
getTag
(
"
slot
"
)
if
not
slot
:
if
slot
:
put
=
slot
.
getTag
(
"
put
"
)
get
=
slot
.
getTag
(
"
get
"
)
else
:
progress_window
.
close_dialog
()
log
.
error
(
"
got unexpected stanza:
"
+
str
(
stanza
))
error
=
stanza
.
getTag
(
"
error
"
)
if
error
and
error
.
getTag
(
"
text
"
):
ErrorDialog
(
_
(
'
Could not request upload slot
'
),
_
(
'
Got unexpected response from server: %s
'
)
%
str
(
error
.
getTagData
(
"
text
"
)),
transient_for
=
self
.
chat_control
.
parent_win
.
window
)
else
:
ErrorDialog
(
_
(
'
Could not request upload slot
'
),
_
(
'
Got unexpected response from server (protocol mismatch??)
'
),
transient_for
=
self
.
chat_control
.
parent_win
.
window
)
log
.
error
(
"
got unexpected stanza:
"
+
str
(
stanza
))
ErrorDialog
(
_
(
'
Could not request upload slot
'
),
_
(
'
Got unexpected response from server (see log)
'
),
transient_for
=
self
.
chat_control
.
parent_win
.
window
)
return
try
:
...
...
@@ -369,16 +375,6 @@ class Base(object):
transient_for
=
self
.
chat_control
.
parent_win
.
window
)
raise
# fill error log with useful information
put
=
slot
.
getTag
(
"
put
"
)
get
=
slot
.
getTag
(
"
get
"
)
if
not
put
or
not
get
:
progress_window
.
close_dialog
()
log
.
error
(
"
got unexpected stanza:
"
+
str
(
stanza
))
ErrorDialog
(
_
(
'
Could not request upload slot
'
),
_
(
'
Got unexpected response from server (protocol mismatch??)
'
),
transient_for
=
self
.
chat_control
.
parent_win
.
window
)
return
def
upload_complete
(
response_code
):
if
isinstance
(
response_code
,
str
):
# We got a error Message
...
...
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