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

Class SimpleAccess

source code

Provide 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)
Initialize the SimpleAccess object with the database that will be used.
source code
unicode
name(self, person)
Return the name of the person, or and empty string if the person is None
source code
unicode
surname(self, person)
Return the name of the person, or and empty string if the person is None
source code
unicode
first_name(self, person)
Return the first name of the person, or and empty string if the person is None
source code
unicode
gid(self, obj)
Return the GRAMPS ID of the person or family
source code
unicode
gender(self, person)
Return a string representing the gender of the person
source code
gen.lib.Person
spouse(self, person)
Return the primary spouse of the person
source code
unicode
marriage_type(self, person)
Return a string describing the relationship between the person and his/per primary spouse.
source code
unicode
marriage_place(self, person)
Return a string describing the place where the person and his/her spouse where married.
source code
unicode
marriage_date(self, person)
Return a string indicating the date when the person and his/her spouse where married.
source code
list
children(self, obj)
Return a list of the children as the children of the primary spouse.
source code
gen.lib.Person
father(self, obj)
Return the primary father of the person or the father of the associated family.
source code
gen.lib.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)
Return a string indicating the date when the person's birth.
source code
gen.lib.Date
birth_date_obj(self, person)
Return the date when the person's birth.
source code
unicode
birth_place(self, person)
Return a string indicating the place of the person's birth.
source code
unicode
death_date(self, person)
Return a string indicating the date when the person's death.
source code
gen.lib.Date
death_date_obj(self, person)
Return the date when the person's death.
source code
unicode
death_place(self, person)
Return a string indicating the place of the person's death.
source code
unicode
event_place(self, event)
Return a string indicating the place of the event
source code
unicode
date_string(self, date_obj)
Return a string representation a date_obj
source code
unicode
event_date(self, event)
Return a string indicating the date of the event
source code
unicode
event_type(self, event)
Return a string indicating the type of the event
source code
list
events(self, obj, restrict=None)
Return a list of events associated with the object.
source code
list
sources(self, obj)
Return a list of events associated with the object.
source code
list
parent_in(self, person)
Return a list of families in which the person is listed as a parent.
source code
list
child_in(self, person)
Return a list of families in which the person is listed as a child.
source code
list
all_people(self)
Return a all the people in the database, one at a time as an iterator.
source code
list
all_families(self)
Return all the families in the database, one at a time as an iterator.
source code
list
all_events(self)
Return all the events in the database, one at a time as an iterator.
source code
list
all_sources(self)
Return all the sources in the database, one at a time as an iterator.
source code
unicode
title(self, source)
Return the title of the source.
source code
unicode
author(self, source)
Return the author of the source.
source code
Method Details

__init__(self, dbase)
(Constructor)

source code 

Initialize the SimpleAccess object with the database that will be used.

Parameters:
  • dbase (GrampsDbBase) - GRAMPS database object

name(self, person)

source code 

Return 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 

Return 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

first_name(self, person)

source code 

Return the first name of the person, or and empty string if the person is None

Parameters:
Returns: unicode
Returns the first name of the person based of the program preferences

gid(self, obj)

source code 

Return 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 

Return a string representing the gender of the person

Parameters:
Returns: unicode
Returns a string indentifying the person's gender

spouse(self, person)

source code 

Return the primary spouse of the person

Parameters:
Returns: gen.lib.Person
The spouse identified as the person's primary spouse

marriage_type(self, person)

source code 

Return 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 

Return 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 

Return 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 

Return a list of the children as the children of the primary spouse.

Parameters:
Returns: list
Returns a list of gen.lib.Person objects representing the children

father(self, obj)

source code 

Return the primary father of the person or the father of the associated family.

Parameters:
Returns: gen.lib.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: gen.lib.Person
The mother in the person's primary family or the mother of the family

birth_date(self, person)

source code 

Return 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_date_obj(self, person)

source code 

Return the date when the person's birth.

Parameters:
Returns: gen.lib.Date
Returns the date when the person's birth.

birth_place(self, person)

source code 

Return 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 

Return 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_date_obj(self, person)

source code 

Return the date when the person's death.

Parameters:
Returns: gen.lib.Date
Returns the date when the person's death.

death_place(self, person)

source code 

Return 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 

Return a string indicating the place of the event

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

date_string(self, date_obj)

source code 

Return a string representation a date_obj

Parameters:
Returns: unicode
Returns a string representation a date_obj

event_date(self, event)

source code 

Return 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 

Return 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 

Return a list of events associated with the object. This object can be either a gen.lib.Person or gen.lib.Family.

Parameters:
  • obj (gen.lib.Person or gen.lib.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 

Return a list of events associated with the object. This object can be either a gen.lib.Person or gen.lib.Family.

Parameters:
Returns: list
list of events assocated with the object

parent_in(self, person)

source code 

Return a list of families in which the person is listed as a parent.

Parameters:
Returns: list
list of gen.lib.Family objects in which the person is listed as a parent.

child_in(self, person)

source code 

Return a list of families in which the person is listed as a child.

Parameters:
Returns: list
list of gen.lib.Family objects in which the person is listed as a child.

all_people(self)

source code 

Return 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 

Return 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 

Return 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 

Return 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 

Return the title of the source.

Parameters:
Returns: unicode
title of the source

author(self, source)

source code 

Return the author of the source.

Parameters:
Returns: unicode
author of the source