Skip to content

Commit

Permalink
check for transform_reply type (#270)
Browse files Browse the repository at this point in the history
  • Loading branch information
vnitinv authored and einarnn committed Aug 25, 2018
1 parent a475d87 commit df3311c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ncclient/xml_.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import io
import sys
import six
import types
from six import StringIO
from io import BytesIO
from lxml import etree
Expand Down Expand Up @@ -148,12 +149,15 @@ def validated_element(x, tags=None, attrs=None):
're':'http://exslt.org/regular-expressions'
}


class NCElement(object):
def __init__(self, result, transform_reply):
self.__result = result
self.__transform_reply = transform_reply
self.__doc = self.remove_namespaces(self.__result)

if isinstance(transform_reply, types.FunctionType):
self.__doc = self.__transform_reply(result._root)
else:
self.__doc = self.remove_namespaces(self.__result)

def xpath(self, expression):
"""
Expand Down

0 comments on commit df3311c

Please sign in to comment.