WinEventLog (possibly others) `type` field cannot be serialized to XML
If I build a WinEventLog object and set the type field on it, I get the following error during to_xml():
Python 2.7.8 (default, Jul 28 2014, 01:34:03) [GCC 4.8.3] on cygwin Type "help", "copyright", "credits" or "license" for more information. >>> from cybox.objects.win_event_log_object import WinEventLog >>> w = WinEventLog() >>> w.type = "foobar" >>> print w.to_xml() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/bworrell/.virtualenvs/openioc-to-stix/lib/python2.7/site-packages/cybox/__init__.py", line 295, in to_xml self.to_obj().export( File "/home/bworrell/.virtualenvs/openioc-to-stix/lib/python2.7/site-packages/cybox/common/object_properties.py", line 105, in to_obj return super(ObjectProperties, self).to_obj(return_obj=return_obj, ns_info=ns_info) File "/home/bworrell/.virtualenvs/openioc-to-stix/lib/python2.7/site-packages/cybox/__init__.py", line 142, in to_obj val = getattr(self, field.attr_name) AttributeError: 'WinEventLog' object has no attribute 'type_'
I believe this is due to the TypedField.attrname property, which converts the XML fieldname "Type" to "type" and then appends an underscore because it's a builtin function. We should probably convert those to type_ as we did in #213.
This probably causes issues with the WinNetworkShare object's type field as well.
Related to #188.