Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
gajim
python-nbxmpp
Commits
bab56bc1
Commit
bab56bc1
authored
Mar 20, 2021
by
Philipp Hörist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Protocol: Refactor Error Stanza
- Don’t allow type=error - Don’t set from attribute
parent
e96a713a
Pipeline
#7512
passed with stages
in 5 minutes and 9 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
10 deletions
+4
-10
nbxmpp/protocol.py
nbxmpp/protocol.py
+4
-10
No files found.
nbxmpp/protocol.py
View file @
bab56bc1
...
...
@@ -1807,24 +1807,18 @@ class Error(Protocol):
If the 'node' is not the received stanza but locally created ('to' and
'from' fields needs not swapping) specify the 'reply' argument as false.
"""
if
node
.
getType
()
==
'error'
:
raise
ValueError
(
'Can’t create error reply from error'
)
if
reply
:
Protocol
.
__init__
(
self
,
to
=
node
.
getFrom
(),
frm
=
node
.
getTo
(),
node
=
node
)
self
.
delAttr
(
'from'
)
else
:
Protocol
.
__init__
(
self
,
node
=
node
)
self
.
setError
(
error
)
if
node
.
getType
()
==
'error'
:
self
.
__str__
=
self
.
__dupstr__
def
__dupstr__
(
self
,
_dup1
=
None
,
_dup2
=
None
):
"""
Dummy function used as preventor of creating error node in reply to
error node. I.e. you will not be able to serialise "double" error
into string.
"""
return
''
class
DataField
(
Node
):
"""
...
...
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