Skip to content

Commit

Permalink
fix-programs-list-error
Browse files Browse the repository at this point in the history
  • Loading branch information
TheFern2 committed Sep 28, 2019
1 parent bb51c06 commit f6c4c96
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
3 changes: 3 additions & 0 deletions changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
09/27/19 - kodaman2
- Modified to return correct return status, when nesting Response.Status to another Response object

09/25/19 - kodaman2
- Path for GetProgramTagList to return LGXTag properly

Expand Down
2 changes: 1 addition & 1 deletion pylogix/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .lgxDevice import LGXDevice
from .eip import PLC
__version_info__ = (0, 4, 5)
__version_info__ = (0, 4, 6)
__version__ = '.'.join(str(x) for x in __version_info__)
21 changes: 17 additions & 4 deletions pylogix/eip.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,11 @@ def GetProgramTagList(self, programName):
# Get single program tags if progragName exists
if programName in self.ProgramNames:
program_tags = self._getProgramTagList(programName)
# Getting status from program_tags Response object
# _getUDT returns a list of LGXTags might need rework in the future
status = program_tags.Status
program_tags = self._getUDT(program_tags.Value)
return Response(None, program_tags, 0)
return Response(None, program_tags, status)
else:
return Response(None, None, 'Program not found, please check name!')

Expand All @@ -153,8 +156,8 @@ def GetProgramsList(self):
and runs _getTagList
'''
if not self.ProgramNames:
self._getTagList(False)
return Response(None, self.ProgramNames, 0)
tags = self._getTagList(False)
return Response(None, self.ProgramNames, tags.Status)

def Discover(self):
'''
Expand Down Expand Up @@ -1697,8 +1700,18 @@ def __init__(self, tag_name, value, status):

def get_error_code(status):
'''
Get the CIP error code string
Get the CIP error code string, if the status is a string it will be returned
'''
# hack to check if status string for both py2 and py3
# because of nesting Response.Status to another Response obj constr
# some Success results are shown as 'Unknown error Success'
if sys.version_info.major == 3:
if isinstance(status, str):
return status
if sys.version_info.major == 2:
if isinstance(status, basestring):
return status

if status in cip_error_codes.keys():
err = cip_error_codes[status]
else:
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="pylogix",
version="0.4.5",
version="0.4.6",
author="Dustin Roeder",
author_email="[email protected]",
description="Read/Write Rockwell Automation Logix based PLC's",
Expand Down

0 comments on commit f6c4c96

Please sign in to comment.