Skip to content

Commit

Permalink
Ensure cybox.core is imported before accessing parent object.
Browse files Browse the repository at this point in the history
Fixes #254. Closes #256
  • Loading branch information
gtback committed Jun 23, 2015
1 parent c8e146a commit c889ade
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cybox/common/object_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,16 @@ def __init__(self):

@property
def parent(self):
import cybox.core

if not self._parent:
self._parent = cybox.core.Object(self)
return self._parent

@parent.setter
def parent(self, value):
import cybox.core

if value and not isinstance(value, cybox.core.Object):
raise ValueError("Must be an Object")
self._parent = value
Expand All @@ -117,6 +121,7 @@ def to_obj(self, return_obj=None, ns_info=None):
def _finalize_obj(self, partial_obj=None):
"""Add xsi_type to the binding object."""

# The _XSI_NS and _XSI_TYPE are set by concrete implementations.
partial_obj.xsi_type = "%s:%s" % (self._XSI_NS, self._XSI_TYPE)

def to_dict(self, partial_dict=None):
Expand Down

0 comments on commit c889ade

Please sign in to comment.