Commit 54ea05ea authored by Philipp Hörist's avatar Philipp Hörist

Make getAttrs() return a copy

parent 54d0e5b3
......@@ -493,7 +493,7 @@ class MUC:
def _parse_muc_user(muc_user):
item = muc_user.getTag('item')
if item is not None:
item_dict = item.getAttrs()
item_dict = item.getAttrs(copy=True)
if 'role' in item_dict:
item_dict['role'] = Role(item_dict['role'])
else:
......
......@@ -21,6 +21,7 @@ projects. It is designed to be as standalone as possible
import logging
import xml.parsers.expat
from xml.parsers.expat import ExpatError
from copy import deepcopy
log = logging.getLogger('nbxmpp.simplexml')
......@@ -226,10 +227,12 @@ class Node:
self.kids.remove(node)
return node
def getAttrs(self):
def getAttrs(self, copy=False):
"""
Return all node's attributes as dictionary
"""
if copy:
return deepcopy(self.attrs)
return self.attrs
def getAttr(self, key):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment