From 2c91f75fad7298d1edc993be91dd964a8e9dd6fd Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Fri, 19 May 2006 15:01:12 +0000 Subject: [PATCH] 2006-05-19 Don Allingham * 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 --- gramps2/ChangeLog | 17 ++++++++ gramps2/src/RelLib/Makefile.am | 1 + gramps2/src/RelLib/_Address.py | 6 +-- gramps2/src/RelLib/_Attribute.py | 6 +-- gramps2/src/RelLib/_ChildRef.py | 6 +-- gramps2/src/RelLib/_Event.py | 2 +- gramps2/src/RelLib/_EventRef.py | 6 +-- gramps2/src/RelLib/_LdsOrd.py | 27 +++--------- gramps2/src/RelLib/_Location.py | 6 +-- gramps2/src/RelLib/_MediaRef.py | 6 +-- gramps2/src/RelLib/_Name.py | 43 ++---------------- gramps2/src/RelLib/_Note.py | 6 +-- gramps2/src/RelLib/_PersonRef.py | 6 +-- gramps2/src/RelLib/_RepoRef.py | 6 +-- gramps2/src/RelLib/_SecondaryObject.py | 60 ++++++++++++++++++++++++++ gramps2/src/RelLib/_SourceRef.py | 27 +++--------- gramps2/src/RelLib/_Url.py | 18 +++----- gramps2/src/RelLib/__init__.py | 1 + 18 files changed, 129 insertions(+), 121 deletions(-) create mode 100644 gramps2/src/RelLib/_SecondaryObject.py diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index f055add48..f3f0c7e05 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,20 @@ +2006-05-19 Don Allingham + * 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 * src/GrampsDb/_GrampsBSDDB.py: Remove unused methods; remove unused secondary tables; add more custom type holders. diff --git a/gramps2/src/RelLib/Makefile.am b/gramps2/src/RelLib/Makefile.am index af7a870a7..e87c71835 100644 --- a/gramps2/src/RelLib/Makefile.am +++ b/gramps2/src/RelLib/Makefile.am @@ -43,6 +43,7 @@ pkgdata_PYTHON = \ _Repository.py\ _RepositoryType.py\ _Researcher.py\ + _SecondaryObject.py\ _SourceNote.py\ _Source.py\ _SourceRef.py\ diff --git a/gramps2/src/RelLib/_Address.py b/gramps2/src/RelLib/_Address.py index 4406ba66f..97d864b59 100644 --- a/gramps2/src/RelLib/_Address.py +++ b/gramps2/src/RelLib/_Address.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) diff --git a/gramps2/src/RelLib/_Attribute.py b/gramps2/src/RelLib/_Attribute.py index db01f5ad2..57ed6a8ef 100644 --- a/gramps2/src/RelLib/_Attribute.py +++ b/gramps2/src/RelLib/_Attribute.py @@ -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) diff --git a/gramps2/src/RelLib/_ChildRef.py b/gramps2/src/RelLib/_ChildRef.py index 52f74acc7..fa07ed716 100644 --- a/gramps2/src/RelLib/_ChildRef.py +++ b/gramps2/src/RelLib/_ChildRef.py @@ -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) diff --git a/gramps2/src/RelLib/_Event.py b/gramps2/src/RelLib/_Event.py index 95773dbc0..2c14546ee 100644 --- a/gramps2/src/RelLib/_Event.py +++ b/gramps2/src/RelLib/_Event.py @@ -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 diff --git a/gramps2/src/RelLib/_EventRef.py b/gramps2/src/RelLib/_EventRef.py index 86b806209..a33a2bf08 100644 --- a/gramps2/src/RelLib/_EventRef.py +++ b/gramps2/src/RelLib/_EventRef.py @@ -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) diff --git a/gramps2/src/RelLib/_LdsOrd.py b/gramps2/src/RelLib/_LdsOrd.py index 7f8416246..285264b47 100644 --- a/gramps2/src/RelLib/_LdsOrd.py +++ b/gramps2/src/RelLib/_LdsOrd.py @@ -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) diff --git a/gramps2/src/RelLib/_Location.py b/gramps2/src/RelLib/_Location.py index 48b49e9ea..c0b66a397 100644 --- a/gramps2/src/RelLib/_Location.py +++ b/gramps2/src/RelLib/_Location.py @@ -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 diff --git a/gramps2/src/RelLib/_MediaRef.py b/gramps2/src/RelLib/_MediaRef.py index 83105aef4..344d64da1 100644 --- a/gramps2/src/RelLib/_MediaRef.py +++ b/gramps2/src/RelLib/_MediaRef.py @@ -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) diff --git a/gramps2/src/RelLib/_Name.py b/gramps2/src/RelLib/_Name.py index 97554540f..6dcee4265 100644 --- a/gramps2/src/RelLib/_Name.py +++ b/gramps2/src/RelLib/_Name.py @@ -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 diff --git a/gramps2/src/RelLib/_Note.py b/gramps2/src/RelLib/_Note.py index 743dea5e1..2952e1daa 100644 --- a/gramps2/src/RelLib/_Note.py +++ b/gramps2/src/RelLib/_Note.py @@ -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 diff --git a/gramps2/src/RelLib/_PersonRef.py b/gramps2/src/RelLib/_PersonRef.py index 00ce98942..6f5625809 100644 --- a/gramps2/src/RelLib/_PersonRef.py +++ b/gramps2/src/RelLib/_PersonRef.py @@ -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) diff --git a/gramps2/src/RelLib/_RepoRef.py b/gramps2/src/RelLib/_RepoRef.py index 9aeed657a..7f99d1084 100644 --- a/gramps2/src/RelLib/_RepoRef.py +++ b/gramps2/src/RelLib/_RepoRef.py @@ -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: diff --git a/gramps2/src/RelLib/_SecondaryObject.py b/gramps2/src/RelLib/_SecondaryObject.py new file mode 100644 index 000000000..40c2c8ab5 --- /dev/null +++ b/gramps2/src/RelLib/_SecondaryObject.py @@ -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 diff --git a/gramps2/src/RelLib/_SourceRef.py b/gramps2/src/RelLib/_SourceRef.py index 8ed9665b6..1dec6da3f 100644 --- a/gramps2/src/RelLib/_SourceRef.py +++ b/gramps2/src/RelLib/_SourceRef.py @@ -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) diff --git a/gramps2/src/RelLib/_Url.py b/gramps2/src/RelLib/_Url.py index ad767914c..eba913b92 100644 --- a/gramps2/src/RelLib/_Url.py +++ b/gramps2/src/RelLib/_Url.py @@ -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) diff --git a/gramps2/src/RelLib/__init__.py b/gramps2/src/RelLib/__init__.py index 963ccd191..a89de9c4a 100644 --- a/gramps2/src/RelLib/__init__.py +++ b/gramps2/src/RelLib/__init__.py @@ -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