Return None if Object.create(None); white space cleanup

This commit is contained in:
Doug Blank 2015-08-21 08:14:22 -04:00
parent ccbed9cb95
commit e5d6be61f8

View File

@ -37,12 +37,12 @@ import re
class BaseObject(object): class BaseObject(object):
""" """
The BaseObject is the base class for all data objects in Gramps, The BaseObject is the base class for all data objects in Gramps,
whether primary or not. whether primary or not.
Its main goal is to provide common capabilites to all objects, such as Its main goal is to provide common capabilites to all objects, such as
searching through all available information. searching through all available information.
""" """
def serialize(self): def serialize(self):
""" """
Convert the object to a serialized tuple of data. Convert the object to a serialized tuple of data.
@ -55,12 +55,12 @@ class BaseObject(object):
""" """
assert False, "Needs to be overridden in the derived class" assert False, "Needs to be overridden in the derived class"
return self return self
def to_struct(self): def to_struct(self):
""" """
Convert the data held in this object to a structure (eg, Convert the data held in this object to a structure (eg,
struct) that represents all the data elements. struct) that represents all the data elements.
This method is used to recursively convert the object into a This method is used to recursively convert the object into a
self-documenting form that can easily be used for various self-documenting form that can easily be used for various
purposes, including diffs and queries. purposes, including diffs and queries.
@ -178,7 +178,7 @@ class BaseObject(object):
""" """
Return the list of (classname, handle) tuples for all directly Return the list of (classname, handle) tuples for all directly
referenced primary objects. referenced primary objects.
:returns: Returns the list of (classname, handle) tuples for referenced :returns: Returns the list of (classname, handle) tuples for referenced
objects. objects.
:rtype: list :rtype: list
@ -189,7 +189,7 @@ class BaseObject(object):
""" """
Return the list of child objects which may, directly or through Return the list of child objects which may, directly or through
their children, reference primary objects. their children, reference primary objects.
:returns: Returns the list of objects referencing primary objects. :returns: Returns the list of objects referencing primary objects.
:rtype: list :rtype: list
""" """
@ -199,13 +199,13 @@ class BaseObject(object):
""" """
Return the list of (classname, handle) tuples for all referenced Return the list of (classname, handle) tuples for all referenced
primary objects, whether directly or through child objects. primary objects, whether directly or through child objects.
:returns: Returns the list of (classname, handle) tuples for referenced :returns: Returns the list of (classname, handle) tuples for referenced
objects. objects.
:rtype: list :rtype: list
""" """
ret = self.get_referenced_handles() ret = self.get_referenced_handles()
# Run through child objects # Run through child objects
for obj in self.get_handle_referents(): for obj in self.get_handle_referents():
ret += obj.get_referenced_handles_recursively() ret += obj.get_referenced_handles_recursively()
@ -228,4 +228,5 @@ class BaseObject(object):
@classmethod @classmethod
def create(cls, data): def create(cls, data):
return cls().unserialize(data) if data:
return cls().unserialize(data)