2006-05-19 Don Allingham <don@gramps-project.org>
* src/RelLib/_SecondaryObject.py: added, provide is_equal * src/RelLib/_Url.py: inherit from SecondaryObject * src/RelLib/_MediaRef.py: inherit from SecondaryObject * src/RelLib/_ChildRef.py: inherit from SecondaryObject * src/RelLib/_Name.py: inherit from SecondaryObject * src/RelLib/_Address.py: inherit from SecondaryObject * src/RelLib/_SourceRef.py: inherit from SecondaryObject * src/RelLib/_RepoRef.py: inherit from SecondaryObject * src/RelLib/_PersonRef.py: inherit from SecondaryObject * src/RelLib/_Attribute.py: inherit from SecondaryObject * src/RelLib/_Note.py: inherit from SecondaryObject * src/RelLib/_Location.py: inherit from SecondaryObject * src/RelLib/_EventRef.py: inherit from SecondaryObject * src/RelLib/_Event.py: inherit from SecondaryObject * src/RelLib/_LdsOrd.py: inherit from SecondaryObject svn: r6720
This commit is contained in:
parent
7647d541e0
commit
2c91f75fad
@ -1,3 +1,20 @@
|
||||
2006-05-19 Don Allingham <don@gramps-project.org>
|
||||
* src/RelLib/_SecondaryObject.py: added, provide is_equal
|
||||
* src/RelLib/_Url.py: inherit from SecondaryObject
|
||||
* src/RelLib/_MediaRef.py: inherit from SecondaryObject
|
||||
* src/RelLib/_ChildRef.py: inherit from SecondaryObject
|
||||
* src/RelLib/_Name.py: inherit from SecondaryObject
|
||||
* src/RelLib/_Address.py: inherit from SecondaryObject
|
||||
* src/RelLib/_SourceRef.py: inherit from SecondaryObject
|
||||
* src/RelLib/_RepoRef.py: inherit from SecondaryObject
|
||||
* src/RelLib/_PersonRef.py: inherit from SecondaryObject
|
||||
* src/RelLib/_Attribute.py: inherit from SecondaryObject
|
||||
* src/RelLib/_Note.py: inherit from SecondaryObject
|
||||
* src/RelLib/_Location.py: inherit from SecondaryObject
|
||||
* src/RelLib/_EventRef.py: inherit from SecondaryObject
|
||||
* src/RelLib/_Event.py: inherit from SecondaryObject
|
||||
* src/RelLib/_LdsOrd.py: inherit from SecondaryObject
|
||||
|
||||
2006-05-18 Alex Roitman <shura@gramps-project.org>
|
||||
* src/GrampsDb/_GrampsBSDDB.py: Remove unused methods; remove
|
||||
unused secondary tables; add more custom type holders.
|
||||
|
@ -43,6 +43,7 @@ pkgdata_PYTHON = \
|
||||
_Repository.py\
|
||||
_RepositoryType.py\
|
||||
_Researcher.py\
|
||||
_SecondaryObject.py\
|
||||
_SourceNote.py\
|
||||
_Source.py\
|
||||
_SourceRef.py\
|
||||
|
@ -29,7 +29,7 @@ Address class for GRAMPS
|
||||
# GRAMPS modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from _BaseObject import BaseObject
|
||||
from _SecondaryObject import SecondaryObject
|
||||
from _PrivacyBase import PrivacyBase
|
||||
from _SourceBase import SourceBase
|
||||
from _NoteBase import NoteBase
|
||||
@ -41,14 +41,14 @@ from _LocationBase import LocationBase
|
||||
# Address for Person/Repository
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class Address(BaseObject,PrivacyBase,SourceBase,NoteBase,DateBase,
|
||||
class Address(SecondaryObject,PrivacyBase,SourceBase,NoteBase,DateBase,
|
||||
LocationBase):
|
||||
"""Provides address information."""
|
||||
|
||||
def __init__(self,source=None):
|
||||
"""Creates a new Address instance, copying from the source
|
||||
if provided"""
|
||||
BaseObject.__init__(self)
|
||||
SecondaryObject.__init__(self)
|
||||
PrivacyBase.__init__(self,source)
|
||||
SourceBase.__init__(self,source)
|
||||
NoteBase.__init__(self,source)
|
||||
|
@ -36,7 +36,7 @@ from warnings import warn
|
||||
# GRAMPS modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from _BaseObject import BaseObject
|
||||
from _SecondaryObject import SecondaryObject
|
||||
from _PrivacyBase import PrivacyBase
|
||||
from _SourceBase import SourceBase
|
||||
from _NoteBase import NoteBase
|
||||
@ -47,7 +47,7 @@ from _AttributeType import AttributeType
|
||||
# Attribute for Person/Family/MediaObject/MediaRef
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class Attribute(BaseObject,PrivacyBase,SourceBase,NoteBase):
|
||||
class Attribute(SecondaryObject,PrivacyBase,SourceBase,NoteBase):
|
||||
"""Provides a simple key/value pair for describing properties. Used
|
||||
by the Person and Family objects to store descriptive information."""
|
||||
|
||||
@ -55,7 +55,7 @@ class Attribute(BaseObject,PrivacyBase,SourceBase,NoteBase):
|
||||
"""
|
||||
Creates a new Attribute object, copying from the source if provided.
|
||||
"""
|
||||
BaseObject.__init__(self)
|
||||
SecondaryObject.__init__(self)
|
||||
PrivacyBase.__init__(self,source)
|
||||
SourceBase.__init__(self,source)
|
||||
NoteBase.__init__(self,source)
|
||||
|
@ -29,7 +29,7 @@ Child Reference class for GRAMPS.
|
||||
# GRAMPS modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from _BaseObject import BaseObject
|
||||
from _SecondaryObject import SecondaryObject
|
||||
from _PrivacyBase import PrivacyBase
|
||||
from _SourceBase import SourceBase
|
||||
from _NoteBase import NoteBase
|
||||
@ -41,7 +41,7 @@ from _ChildRefType import ChildRefType
|
||||
# Person References for Person/Family
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class ChildRef(BaseObject,PrivacyBase,SourceBase,NoteBase,RefBase):
|
||||
class ChildRef(SecondaryObject,PrivacyBase,SourceBase,NoteBase,RefBase):
|
||||
"""
|
||||
Person reference class.
|
||||
|
||||
@ -51,7 +51,7 @@ class ChildRef(BaseObject,PrivacyBase,SourceBase,NoteBase,RefBase):
|
||||
"""
|
||||
|
||||
def __init__(self,source=None):
|
||||
BaseObject.__init__(self)
|
||||
SecondaryObject.__init__(self)
|
||||
PrivacyBase.__init__(self,source)
|
||||
SourceBase.__init__(self,source)
|
||||
NoteBase.__init__(self,source)
|
||||
|
@ -233,7 +233,7 @@ class Event(PrimaryObject,SourceBase,NoteBase,MediaBase,DateBase,PlaceBase):
|
||||
index = 0
|
||||
olist = other.get_source_references()
|
||||
for a in self.get_source_references():
|
||||
if not a.are_equal(olist[index]):
|
||||
if not a.is_equal(olist[index]):
|
||||
return False
|
||||
index += 1
|
||||
|
||||
|
@ -36,7 +36,7 @@ from warnings import warn
|
||||
# GRAMPS modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from _BaseObject import BaseObject
|
||||
from _SecondaryObject import SecondaryObject
|
||||
from _PrivacyBase import PrivacyBase
|
||||
from _NoteBase import NoteBase
|
||||
from _RefBase import RefBase
|
||||
@ -47,7 +47,7 @@ from _EventRoleType import EventRoleType
|
||||
# Event References for Person/Family
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class EventRef(BaseObject,PrivacyBase,NoteBase,RefBase):
|
||||
class EventRef(SecondaryObject,PrivacyBase,NoteBase,RefBase):
|
||||
"""
|
||||
Event reference class.
|
||||
|
||||
@ -59,7 +59,7 @@ class EventRef(BaseObject,PrivacyBase,NoteBase,RefBase):
|
||||
"""
|
||||
Creates a new EventRef instance, copying from the source if present.
|
||||
"""
|
||||
BaseObject.__init__(self)
|
||||
SecondaryObject.__init__(self)
|
||||
PrivacyBase.__init__(self)
|
||||
NoteBase.__init__(self)
|
||||
RefBase.__init__(self)
|
||||
|
@ -24,12 +24,14 @@
|
||||
LDS Ordinance class for GRAMPS
|
||||
"""
|
||||
|
||||
from warnings import warn
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from _BaseObject import BaseObject
|
||||
from _SecondaryObject import SecondaryObject
|
||||
from _SourceBase import SourceBase
|
||||
from _NoteBase import NoteBase
|
||||
from _DateBase import DateBase
|
||||
@ -41,7 +43,7 @@ from _PrivacyBase import PrivacyBase
|
||||
# LDS Ordinance class
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class LdsOrd(BaseObject,SourceBase,NoteBase,DateBase,PlaceBase,PrivacyBase):
|
||||
class LdsOrd(SecondaryObject,SourceBase,NoteBase,DateBase,PlaceBase,PrivacyBase):
|
||||
"""
|
||||
Class that contains information about LDS Ordinances. LDS
|
||||
ordinances are similar to events, but have very specific additional
|
||||
@ -72,7 +74,7 @@ class LdsOrd(BaseObject,SourceBase,NoteBase,DateBase,PlaceBase,PrivacyBase):
|
||||
|
||||
def __init__(self,source=None):
|
||||
"""Creates a LDS Ordinance instance"""
|
||||
BaseObject.__init__(self)
|
||||
SecondaryObject.__init__(self)
|
||||
SourceBase.__init__(self,source)
|
||||
NoteBase.__init__(self,source)
|
||||
DateBase.__init__(self,source)
|
||||
@ -195,20 +197,5 @@ class LdsOrd(BaseObject,SourceBase,NoteBase,DateBase,PlaceBase,PrivacyBase):
|
||||
|
||||
def are_equal(self,other):
|
||||
"""returns 1 if the specified ordinance is the same as the instance"""
|
||||
if other == None:
|
||||
return self.is_empty()
|
||||
if (self.famc != other.famc or
|
||||
self.place != other.place or
|
||||
self.status != other.status or
|
||||
self.temple != other.temple or
|
||||
not self.get_date_object().is_equal(other.get_date_object()) or
|
||||
len(self.get_source_references()) != len(other.get_source_references())):
|
||||
return False
|
||||
|
||||
index = 0
|
||||
olist = other.get_source_references()
|
||||
for a in self.get_source_references():
|
||||
if not a.are_equal(olist[index]):
|
||||
return False
|
||||
index += 1
|
||||
return True
|
||||
warn( "Use is_equal instead are_equal", DeprecationWarning, 2)
|
||||
return self.is_equal(other)
|
||||
|
@ -29,7 +29,7 @@ Location class for GRAMPS
|
||||
# GRAMPS modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from _BaseObject import BaseObject
|
||||
from _SecondaryObject import SecondaryObject
|
||||
from _LocationBase import LocationBase
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -37,7 +37,7 @@ from _LocationBase import LocationBase
|
||||
# Location class for Places
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class Location(BaseObject,LocationBase):
|
||||
class Location(SecondaryObject,LocationBase):
|
||||
"""
|
||||
Provides information about a place.
|
||||
|
||||
@ -51,7 +51,7 @@ class Location(BaseObject,LocationBase):
|
||||
Creates a Location object, copying from the source object if it exists.
|
||||
"""
|
||||
|
||||
BaseObject.__init__(self)
|
||||
SecondaryObject.__init__(self)
|
||||
LocationBase.__init__(self,source)
|
||||
if source:
|
||||
self.parish = source.parish
|
||||
|
@ -29,7 +29,7 @@ Media Reference class for GRAMPS
|
||||
# GRAMPS modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from _BaseObject import BaseObject
|
||||
from _SecondaryObject import SecondaryObject
|
||||
from _PrivacyBase import PrivacyBase
|
||||
from _SourceBase import SourceBase
|
||||
from _NoteBase import NoteBase
|
||||
@ -41,12 +41,12 @@ from _AttributeBase import AttributeBase
|
||||
# MediaObject References for Person/Place/Source
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class MediaRef(BaseObject,PrivacyBase,SourceBase,NoteBase,RefBase,
|
||||
class MediaRef(SecondaryObject,PrivacyBase,SourceBase,NoteBase,RefBase,
|
||||
AttributeBase):
|
||||
"""Media reference class"""
|
||||
def __init__(self,source=None):
|
||||
|
||||
BaseObject.__init__(self)
|
||||
SecondaryObject.__init__(self)
|
||||
PrivacyBase.__init__(self,source)
|
||||
SourceBase.__init__(self,source)
|
||||
NoteBase.__init__(self,source)
|
||||
|
@ -36,7 +36,7 @@ from warnings import warn
|
||||
# GRAMPS modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from _BaseObject import BaseObject
|
||||
from _SecondaryObject import SecondaryObject
|
||||
from _PrivacyBase import PrivacyBase
|
||||
from _SourceBase import SourceBase
|
||||
from _NoteBase import NoteBase
|
||||
@ -48,7 +48,7 @@ from _NameType import NameType
|
||||
# Personal Name
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class Name(BaseObject,PrivacyBase,SourceBase,NoteBase,DateBase):
|
||||
class Name(SecondaryObject,PrivacyBase,SourceBase,NoteBase,DateBase):
|
||||
"""
|
||||
Provides name information about a person.
|
||||
|
||||
@ -63,7 +63,7 @@ class Name(BaseObject,PrivacyBase,SourceBase,NoteBase,DateBase):
|
||||
|
||||
def __init__(self,source=None,data=None):
|
||||
"""creates a new Name instance, copying from the source if provided"""
|
||||
BaseObject.__init__(self)
|
||||
SecondaryObject.__init__(self)
|
||||
if data:
|
||||
(privacy,source_list,note,date,
|
||||
self.first_name,self.surname,self.suffix,self.title,
|
||||
@ -355,40 +355,3 @@ class Name(BaseObject,PrivacyBase,SourceBase,NoteBase,DateBase):
|
||||
return "%s %s %s, %s" % (first, self.prefix, self.surname, self.suffix)
|
||||
else:
|
||||
return "%s %s, %s" % (first, self.surname, self.suffix)
|
||||
|
||||
def is_equal(self,other):
|
||||
"""
|
||||
compares to names to see if they are equal, return 0 if they
|
||||
are not
|
||||
"""
|
||||
if self.first_name != other.first_name:
|
||||
return False
|
||||
if self.surname != other.surname:
|
||||
return False
|
||||
if self.patronymic != other.patronymic:
|
||||
return False
|
||||
if self.prefix != other.prefix:
|
||||
return False
|
||||
if self.suffix != other.suffix:
|
||||
return False
|
||||
if self.title != other.title:
|
||||
return False
|
||||
if self.type != other.type:
|
||||
return False
|
||||
if self.private != other.private:
|
||||
return False
|
||||
if self.get_note() != other.get_note():
|
||||
return False
|
||||
if (self.date and other.date and not self.date.is_equal(other.date)) \
|
||||
or (self.date and not other.date) \
|
||||
or (not self.date and other.date):
|
||||
return False
|
||||
if len(self.get_source_references()) != len(other.get_source_references()):
|
||||
return False
|
||||
index = 0
|
||||
olist = other.get_source_references()
|
||||
for a in self.get_source_references():
|
||||
if not a.are_equal(olist[index]):
|
||||
return True
|
||||
index += 1
|
||||
return True
|
||||
|
@ -29,14 +29,14 @@ Note class for GRAMPS
|
||||
# GRAMPS modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from _BaseObject import BaseObject
|
||||
from _SecondaryObject import SecondaryObject
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Class for notes used throughout the majority of GRAMPS objects
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class Note(BaseObject):
|
||||
class Note(SecondaryObject):
|
||||
"""
|
||||
Introduction
|
||||
============
|
||||
@ -49,7 +49,7 @@ class Note(BaseObject):
|
||||
"""
|
||||
Creates a new Note object, initializing from the passed string.
|
||||
"""
|
||||
BaseObject.__init__(self)
|
||||
SecondaryObject.__init__(self)
|
||||
self.text = text
|
||||
self.format = 0
|
||||
|
||||
|
@ -29,7 +29,7 @@ Person Reference class for GRAMPS.
|
||||
# GRAMPS modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from _BaseObject import BaseObject
|
||||
from _SecondaryObject import SecondaryObject
|
||||
from _PrivacyBase import PrivacyBase
|
||||
from _SourceBase import SourceBase
|
||||
from _NoteBase import NoteBase
|
||||
@ -40,7 +40,7 @@ from _RefBase import RefBase
|
||||
# Person References for Person/Family
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class PersonRef(BaseObject,PrivacyBase,SourceBase,NoteBase,RefBase):
|
||||
class PersonRef(SecondaryObject,PrivacyBase,SourceBase,NoteBase,RefBase):
|
||||
"""
|
||||
Person reference class.
|
||||
|
||||
@ -50,7 +50,7 @@ class PersonRef(BaseObject,PrivacyBase,SourceBase,NoteBase,RefBase):
|
||||
"""
|
||||
|
||||
def __init__(self,source=None):
|
||||
BaseObject.__init__(self)
|
||||
SecondaryObject.__init__(self)
|
||||
PrivacyBase.__init__(self,source)
|
||||
SourceBase.__init__(self,source)
|
||||
NoteBase.__init__(self,source)
|
||||
|
@ -29,7 +29,7 @@ Repository Reference class for GRAMPS
|
||||
# GRAMPS modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from _BaseObject import BaseObject
|
||||
from _SecondaryObject import SecondaryObject
|
||||
from _NoteBase import NoteBase
|
||||
from _RefBase import RefBase
|
||||
from _SourceMediaType import SourceMediaType
|
||||
@ -39,13 +39,13 @@ from _SourceMediaType import SourceMediaType
|
||||
# Repository Reference for Sources
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class RepoRef(BaseObject,NoteBase,RefBase):
|
||||
class RepoRef(SecondaryObject,NoteBase,RefBase):
|
||||
"""
|
||||
Repository reference class.
|
||||
"""
|
||||
|
||||
def __init__(self,source=None):
|
||||
BaseObject.__init__(self)
|
||||
SecondaryObject.__init__(self)
|
||||
NoteBase.__init__(self)
|
||||
RefBase.__init__(self)
|
||||
if source:
|
||||
|
60
gramps2/src/RelLib/_SecondaryObject.py
Normal file
60
gramps2/src/RelLib/_SecondaryObject.py
Normal file
@ -0,0 +1,60 @@
|
||||
#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2000-2005 Donald N. Allingham
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
# $Id: _SecondaryObject.py 6386 2006-04-21 00:03:27Z rshura $
|
||||
|
||||
"""
|
||||
Secondary Object class for GRAMPS
|
||||
"""
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from _BaseObject import BaseObject
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Secondary Object class
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class SecondaryObject(BaseObject):
|
||||
"""
|
||||
The SecondaryObject is the base class for all primary objects in the
|
||||
database. Secondary objects are the core objects in the database.
|
||||
Each object has a database handle and a GRAMPS ID value. The database
|
||||
handle is used as the record number for the database, and the GRAMPS
|
||||
ID is the user visible version.
|
||||
"""
|
||||
|
||||
def __init__(self,source=None):
|
||||
"""
|
||||
Initialize a SecondaryObject. If source is None, both the ID and handle
|
||||
are assigned as empty strings. If source is not None, then object
|
||||
is initialized from values of the source object.
|
||||
|
||||
@param source: Object used to initialize the new object
|
||||
@type source: SecondaryObject
|
||||
"""
|
||||
BaseObject.__init__(self)
|
||||
|
||||
def is_equal(self, source):
|
||||
return cmp(self.serialize(),source.serialize()) == 0
|
@ -24,12 +24,14 @@
|
||||
Source Reference class for GRAMPS
|
||||
"""
|
||||
|
||||
from warnings import warn
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from _BaseObject import BaseObject
|
||||
from _SecondaryObject import SecondaryObject
|
||||
from _DateBase import DateBase
|
||||
from _PrivacyBase import PrivacyBase
|
||||
from _NoteBase import NoteBase
|
||||
@ -41,7 +43,7 @@ from _Note import Note
|
||||
# Source References for all primary objects
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class SourceRef(BaseObject,DateBase,PrivacyBase,NoteBase,RefBase):
|
||||
class SourceRef(SecondaryObject,DateBase,PrivacyBase,NoteBase,RefBase):
|
||||
"""Source reference, containing detailed information about how a
|
||||
referenced source relates to it"""
|
||||
|
||||
@ -53,7 +55,7 @@ class SourceRef(BaseObject,DateBase,PrivacyBase,NoteBase,RefBase):
|
||||
|
||||
def __init__(self,source=None):
|
||||
"""creates a new SourceRef, copying from the source if present"""
|
||||
BaseObject.__init__(self)
|
||||
SecondaryObject.__init__(self)
|
||||
DateBase.__init__(self,source)
|
||||
PrivacyBase.__init__(self,source)
|
||||
NoteBase.__init__(self,source)
|
||||
@ -149,20 +151,5 @@ class SourceRef(BaseObject,DateBase,PrivacyBase,NoteBase,RefBase):
|
||||
return self.text
|
||||
|
||||
def are_equal(self,other):
|
||||
"""returns True if the passed SourceRef is equal to the current"""
|
||||
if self.ref and other.ref:
|
||||
if self.page != other.page:
|
||||
return False
|
||||
if not self.get_date_object().is_equal(other.get_date_object()):
|
||||
return False
|
||||
if self.get_text() != other.get_text():
|
||||
return False
|
||||
if self.get_note() != other.get_note():
|
||||
return False
|
||||
if self.confidence != other.confidence:
|
||||
return False
|
||||
return True
|
||||
elif not self.ref and not other.ref:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
warn( "Use is_equal instead of are_equal", DeprecationWarning, 2)
|
||||
return self.is_equal(other)
|
||||
|
@ -36,7 +36,7 @@ from warnings import warn
|
||||
# GRAMPS modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from _BaseObject import BaseObject
|
||||
from _SecondaryObject import SecondaryObject
|
||||
from _PrivacyBase import PrivacyBase
|
||||
from _UrlType import UrlType
|
||||
|
||||
@ -45,13 +45,13 @@ from _UrlType import UrlType
|
||||
# Url for Person/Place/Repository
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class Url(BaseObject,PrivacyBase):
|
||||
class Url(SecondaryObject,PrivacyBase):
|
||||
"""Contains information related to internet Uniform Resource Locators,
|
||||
allowing gramps to store information about internet resources"""
|
||||
|
||||
def __init__(self,source=None):
|
||||
"""creates a new URL instance, copying from the source if present"""
|
||||
BaseObject.__init__(self)
|
||||
SecondaryObject.__init__(self)
|
||||
PrivacyBase.__init__(self,source)
|
||||
if source:
|
||||
self.path = source.path
|
||||
@ -110,13 +110,5 @@ class Url(BaseObject,PrivacyBase):
|
||||
return self.type
|
||||
|
||||
def are_equal(self,other):
|
||||
"""returns 1 if the specified URL is the same as the instance"""
|
||||
if other == None:
|
||||
return 0
|
||||
if self.path != other.path:
|
||||
return 0
|
||||
if self.desc != other.desc:
|
||||
return 0
|
||||
if self.type != other.type:
|
||||
return 0
|
||||
return 1
|
||||
warn( "Use is_equal instead of are_equal", DeprecationWarning, 2)
|
||||
return self.is_equal(other)
|
||||
|
@ -29,6 +29,7 @@ __version__ = "$Revision$"
|
||||
from _Date import Date, DateError
|
||||
|
||||
# Secondary objects
|
||||
from _SecondaryObject import SecondaryObject
|
||||
from _Address import Address
|
||||
from _Location import Location
|
||||
from _Attribute import Attribute
|
||||
|
Loading…
Reference in New Issue
Block a user