Also use the new nwItem checkers in the NWItem class
This commit is contained in:
+6
-4
@@ -28,8 +28,10 @@ import logging
|
|||||||
|
|
||||||
from lxml import etree
|
from lxml import etree
|
||||||
|
|
||||||
from nw.common import checkInt, isHandle
|
|
||||||
from nw.constants import nwItemType, nwItemClass, nwItemLayout
|
from nw.constants import nwItemType, nwItemClass, nwItemLayout
|
||||||
|
from nw.common import (
|
||||||
|
checkInt, isHandle, isItemClass, isItemLayout, isItemType
|
||||||
|
)
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -201,7 +203,7 @@ class NWItem():
|
|||||||
"""
|
"""
|
||||||
if isinstance(theType, nwItemType):
|
if isinstance(theType, nwItemType):
|
||||||
self.itemType = theType
|
self.itemType = theType
|
||||||
elif theType in nwItemType.__members__:
|
elif isItemType(theType):
|
||||||
self.itemType = nwItemType[theType]
|
self.itemType = nwItemType[theType]
|
||||||
else:
|
else:
|
||||||
logger.error("Unrecognised item type '%s'" % theType)
|
logger.error("Unrecognised item type '%s'" % theType)
|
||||||
@@ -214,7 +216,7 @@ class NWItem():
|
|||||||
"""
|
"""
|
||||||
if isinstance(theClass, nwItemClass):
|
if isinstance(theClass, nwItemClass):
|
||||||
self.itemClass = theClass
|
self.itemClass = theClass
|
||||||
elif theClass in nwItemClass.__members__:
|
elif isItemClass(theClass):
|
||||||
self.itemClass = nwItemClass[theClass]
|
self.itemClass = nwItemClass[theClass]
|
||||||
else:
|
else:
|
||||||
logger.error("Unrecognised item class '%s'" % theClass)
|
logger.error("Unrecognised item class '%s'" % theClass)
|
||||||
@@ -227,7 +229,7 @@ class NWItem():
|
|||||||
"""
|
"""
|
||||||
if isinstance(theLayout, nwItemLayout):
|
if isinstance(theLayout, nwItemLayout):
|
||||||
self.itemLayout = theLayout
|
self.itemLayout = theLayout
|
||||||
elif theLayout in nwItemLayout.__members__:
|
elif isItemLayout(theLayout):
|
||||||
self.itemLayout = nwItemLayout[theLayout]
|
self.itemLayout = nwItemLayout[theLayout]
|
||||||
else:
|
else:
|
||||||
logger.error("Unrecognised item layout '%s'" % theLayout)
|
logger.error("Unrecognised item layout '%s'" % theLayout)
|
||||||
|
|||||||
Reference in New Issue
Block a user