Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions mtconnect/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from .storage import MTBuffer, MTDataEntity
from .xmlhelper import read_devices, process_path
from .error import MTInvalidRequest, MTInvalidRange
from .device import MTComponent, MTDevice
from .device import MTComponent, MTDevice, MTDataItem
from .loghandler import MTLogger


Expand Down Expand Up @@ -287,7 +287,9 @@ def get_item_list(self, path=None):
#get all sub items from path
item_set = set()
for component in component_list:
item_set = item_set.union(set(component.get_all_sub_items()))
if (isinstance(component, MTDataItem)):
return component_list
component.get_all_sub_items()
return item_set

#format data into xml
Expand Down
10 changes: 7 additions & 3 deletions mtconnect/xmlhelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ def process_components(component_list, device, parent_component):
#get list of subcomponents
sub_component_item = component.find('Components')
if(sub_component_item is not None):
sub_component_list = sub_component_item.getchildren()
sub_component_list = []
for item in sub_component_item:
sub_component_list.append(item)
process_components(sub_component_list, device, new_component)

#read device xml from file
Expand All @@ -92,7 +94,7 @@ def read_devices(file):

#get devices
root = device_tree.getroot()
for device in root.getchildren():
for device in root:
#get identifiers for device
device_name = device.get('name')
device_uuid = device.get('uuid')
Expand All @@ -118,7 +120,9 @@ def read_devices(file):
#get list of subcomponents
component_item = device.find('Components')
if(component_item is not None):
component_list = component_item.getchildren()
component_list = []
for item in component_item:
component_list.append(item)
process_components(component_list, new_device, new_device)

device_list[new_device.id]=new_device
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="MTConnect",
version="0.3.1",
version="0.3.2",
author="Michael Honaker",
author_email="[email protected]",
description="A python agent for MTConnect",
Expand Down
2 changes: 1 addition & 1 deletion tests/agent_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class AgentTest(unittest.TestCase):

def __init__(self, *args, **kwargs):
super(AgentTest, self).__init__(*args, **kwargs)
self.test_agent = MTConnect(loc='tests/test_device.xml')
self.test_agent = MTConnect(loc='test_device.xml')


def testProbe(self):
Expand Down