Package Simple :: Module _SimpleAccess :: Class SimpleAccess
[frames] | no frames]

Class SimpleAccess

source code

Provides a simplified database access system. This system has been designed to ease the development of reports.

The user needs to take care when using this interface. Since it returns real objects instead of database references, it can consume a significant amount of memory if the user is not careful.

Example

A typical system of usage would be:
 sa = SimpleAccess(database)

 print "Person        : ", sa.name(person)
 print "Gender        : ", sa.gender(person)
 print "Birth date    : ", sa.birth_date(person)
 print "Birth place   : ", sa.birth_place(person)
 print "Death date    : ", sa.death_date(person)
 print "Death place   : ", sa.death_place(person)
 print "Father        : ", sa.name(sa.father(person))
 print "Mother        : ", sa.name(sa.mother(person))
 print "Spouse        : ", sa.name(sa.spouse(person))
 print "Marriage Type : ", sa.marriage_type(person)
 print "Marriage Date : ", sa.marriage_date(person)
 print "Marriage Place: ", sa.marriage_place(person)
 for child in sa.children(person):
    print "Child         : ", sa.name(child)
   
 # Print out burial and baptism events
 for event in sa.events( person , [ "Burial", "Baptism" ]):
    print "Event         : ", sa.event_type(event), sa.event_date(event), 
    print sa.event_place(event)
This would produce an output that looks like:
    Person        :  Garner, Lewis Anderson
    Gender        :  male
    Birth date    :  6/21/1855
    Birth place   :  Great Falls, MT
    Death date    :  6/28/1911
    Death place   :  Twin Falls, ID
    Father        :  Garner, Robert W.
    Mother        :  Zielinski, Phoebe Emily
    Spouse        :  Martel, Luella Jacques
    Marriage Type :  Married
    Marriage Date :  4/1/1875
    Marriage Place:  Paragould, AR
    Child         :  Garner, Eugene Stanley
    Child         :  Garner, Jesse V.
    Child         :  Garner, Raymond E.
    Child         :  Garner, Jennie S.
    Child         :  Garner, Walter E.
    Child         :  Garner, Daniel Webster
    Child         :  Garner, Bertha P.
    Child         :  Garner, Elizabeth
    Event         :  Burial 7/1/1911 Twin Falls, ID


Instance Methods
 
__init__(self, dbase)
Initializes the SimpleAccess object with the database that will be used.
source code
unicode
name(self, person)
Returns the name of the person, or and empty string if the person is None
source code
unicode
surname(self, person)
Returns the name of the person, or and empty string if the person is None
source code
unicode
gid(self, obj)
Returns the GRAMPS ID of the person or family
source code
unicode
gender(self, person)
Returns a string representing the gender of the person
source code
RelLib.Person
spouse(self, person)
Returns the primary spouse of the person
source code
unicode
marriage_type(self, person)
Returns a string describing the relationship between the person and his/per primary spouse.
source code
unicode
marriage_place(self, person)
Returns a string describing the place where the person and his/her spouse where married.
source code
unicode
marriage_date(self, person)
Returns a string indicating the date when the person and his/her spouse where married.
source code
list
children(self, obj)
Returns a list of the children as the children of the primary spouse.
source code
RelLib.Person
father(self, obj)
Returns the primary father of the person or the father of the associated family.
source code
RelLib.Person
mother(self, obj)
Returns the primary mother of the person or the mother of the associated family.
source code
unicode
birth_date(self, person)
Returns a string indicating the date when the person's birth.
source code
unicode
birth_place(self, person)
Returns a string indicating the place of the person's birth.
source code
unicode
death_date(self, person)
Returns a string indicating the date when the person's death.
source code
unicode
death_place(self, person)
Returns a string indicating the place of the person's death.
source code
unicode
event_place(self, event)
Returns a string indicating the place of the event
source code
unicode
event_date(self, event)
Returns a string indicating the date of the event
source code
unicode
event_type(self, event)
Returns a string indicating the type of the event
source code
list
events(self, obj, restrict=None)
Returns a list of events associated with the object.
source code
list
sources(self, obj)
Returns a list of events associated with the object.
source code
list
parent_in(self, person)
Returns a list of families in which the person is listed as a parent.
source code
list
child_in(self, person)
Returns a list of families in which the person is listed as a child.
source code
list
all_people(self)
Returns a all the people in the database, one at a time as an iterator.
source code
list
all_families(self)
Returns all the families in the database, one at a time as an iterator.
source code
list
all_events(self)
Returns all the events in the database, one at a time as an iterator.
source code
list
all_sources(self)
Returns all the sources in the database, one at a time as an iterator.
source code
unicode
title(self, source)
Returns the title of the source.
source code
unicode
author(self, source)
Returns the author of the source.
source code
Method Details

__init__(self, dbase)
(Constructor)

source code 
Initializes the SimpleAccess object with the database that will be used.
Parameters:
  • dbase (GrampsDbBase) - GRAMPS database object

name(self, person)

source code 
Returns the name of the person, or and empty string if the person is None
Parameters:
Returns: unicode
Returns the name of the person based of the program preferences

surname(self, person)

source code 
Returns the name of the person, or and empty string if the person is None
Parameters:
Returns: unicode
Returns the name of the person based of the program preferences

gid(self, obj)

source code 
Returns the GRAMPS ID of the person or family
Parameters:
Returns: unicode
Returns the GRAMPS Id value of the person or family

gender(self, person)

source code 
Returns a string representing the gender of the person
Parameters:
Returns: unicode
Returns a string indentifying the person's gender

spouse(self, person)

source code 
Returns the primary spouse of the person
Parameters:
Returns: RelLib.Person
The spouse identified as the person's primary spouse

marriage_type(self, person)

source code 
Returns a string describing the relationship between the person and his/per primary spouse.
Parameters:
Returns: unicode
Returns a string describing the relationship between the person and his/per primary spouse.

marriage_place(self, person)

source code 
Returns a string describing the place where the person and his/her spouse where married.
Parameters:
Returns: unicode
Returns a string describing the place where the person and his/her spouse where married.

marriage_date(self, person)

source code 
Returns a string indicating the date when the person and his/her spouse where married.
Parameters:
Returns: unicode
Returns a string indicicating the date when the person and his/her spouse where married.

children(self, obj)

source code 
Returns a list of the children as the children of the primary spouse.
Parameters:
Returns: list
Returns a list of RelLib.Person objects representing the children

father(self, obj)

source code 
Returns the primary father of the person or the father of the associated family.
Parameters:
Returns: RelLib.Person
The father in the person's primary family or the father of the family

mother(self, obj)

source code 
Returns the primary mother of the person or the mother of the associated family.
Parameters:
Returns: RelLib.Person
The mother in the person's primary family or the mother of the family

birth_date(self, person)

source code 
Returns a string indicating the date when the person's birth.
Parameters:
Returns: unicode
Returns a string indicating the date when the person's birth.

birth_place(self, person)

source code 
Returns a string indicating the place of the person's birth.
Parameters:
Returns: unicode
Returns a string indicating the place of the person's birth.

death_date(self, person)

source code 
Returns a string indicating the date when the person's death.
Parameters:
Returns: unicode
Returns a string indicating the date when the person's death.

death_place(self, person)

source code 
Returns a string indicating the place of the person's death.
Parameters:
Returns: unicode
Returns a string indicating the place of the person's death.

event_place(self, event)

source code 
Returns a string indicating the place of the event
Parameters:
Returns: unicode
Returns a string indicating the place of the event

event_date(self, event)

source code 
Returns a string indicating the date of the event
Parameters:
Returns: unicode
Returns a string indicating the date of the event

event_type(self, event)

source code 
Returns a string indicating the type of the event
Parameters:
Returns: unicode
Returns a string indicating the type of the event

events(self, obj, restrict=None)

source code 
Returns a list of events associated with the object. This object can be either a RelLib.Person or RelLib.Family.
Parameters:
  • obj (RelLib.Person or RelLib.Family) - Person or Family
  • restrict (list) - Optional list of strings that will limit the types of events to those of the specfied types.
Returns: list
list of events assocated with the object

sources(self, obj)

source code 
Returns a list of events associated with the object. This object can be either a RelLib.Person or RelLib.Family.
Parameters:
Returns: list
list of events assocated with the object

parent_in(self, person)

source code 
Returns a list of families in which the person is listed as a parent.
Parameters:
Returns: list
list of RelLib.Family objects in which the person is listed as a parent.

child_in(self, person)

source code 
Returns a list of families in which the person is listed as a child.
Parameters:
Returns: list
list of RelLib.Family objects in which the person is listed as a child.

all_people(self)

source code 
Returns a all the people in the database, one at a time as an iterator. The user can treat this just like a list. For example:
  for person in sa.all_people():
     sa.print(person)
Returns: list
list of people in the database

all_families(self)

source code 
Returns all the families in the database, one at a time as an iterator. The user can treat this just like a list. For example:
  for person in sa.all_families():
     sa.print(sa.father(person))
Returns: list
list of families in the database

all_events(self)

source code 
Returns all the events in the database, one at a time as an iterator. The user can treat this just like a list. For example:
  for person in sa.all_events():
     sa.print(sa.event_place(event))
Returns: list
list of events in the database

all_sources(self)

source code 
Returns all the sources in the database, one at a time as an iterator. The user can treat this just like a list. For example:

Returns: list
list of sources in the database

title(self, source)

source code 
Returns the title of the source.
Parameters:
Returns: unicode
title of the source

author(self, source)

source code 
Returns the author of the source.
Parameters:
Returns: unicode
author of the source