rattail.people
¶
People Handler
See also People Handler.
- class rattail.people.PeopleHandler(config, **kwargs)[source]¶
Base class and default implementation for people handlers.
- add_address(person, type=None, street=None, street2=None, city=None, state=None, zipcode=None, invalid=False, preferred=False, **kwargs)[source]¶
Add a physical/mailing address record for the person.
- Parameters:
person¶ – Reference to a
Person
record.type¶ – Type of address to add.
street¶ – Street (line 1) for the address.
street2¶ – Street (line 2) for the address.
city¶ – City for the address.
state¶ – State for the address.
zipcode¶ – Zipcode for the address.
invalid¶ – Boolean indicating the address is known to not be valid.
preferred¶ – Boolean indicating that this should (or not) be the “preferred” address for the person.
- add_email(person, address, type='Home', invalid=False, preferred=False, **kwargs)[source]¶
Add a email record for the person.
- Parameters:
- add_phone(person, number, type='Home', preferred=False, **kwargs)[source]¶
Add a phone record for the person.
- address_is_invalid(person, address, **kwargs)[source]¶
Returns a boolean indicating if the given person’s address is invalid.
- ensure_address(person, **kwargs)[source]¶
Returns the default address record associated with the given person, creating it first if necessary.
- get_merge_preview_data(person, **kwargs)[source]¶
Must return a data dictionary for the given person, which can be presented to the user during a merge preview.
- get_merge_preview_fields(**kwargs)[source]¶
Returns a sequence of fields which will be used during a merge preview.
- get_person(obj, **kwargs)[source]¶
Retrieve the Person related to the given object.
This is a rather fundamental method, in that it is called by several other methods, both within this handler as well as others. There is even a shortcut to it, accessible via
rattail.app.AppHandler.get_person()
.Its purpose is to navigate relationships as needed, to get at the “default” person associated with the object. Depending on how the app tracks relationships, this logic may need to vary.
- mark_address_invalid(person, address, invalid, **kwargs)[source]¶
Mark the person’s address as invalid.
- merge_update_keeping_object(removing, keeping)[source]¶
Update the object to be kept, with any relevant data from the object to be removed, in the context of a merge.
- normalize_full_name(first, last, **kwargs)[source]¶
Normalize a “full” name based on the given first and last names. Tries to be smart about collapsing whitespace etc.
- quickie_lookup(entry, session)[source]¶
Attempt to locate a person based on the given entry. By default this will do a lookup based on the configured Customer key field. Override as needed.
- request_merge(user, removing_uuid, keeping_uuid, **kwargs)[source]¶
Submit an officical merge request for two Person records.
The caller must obviously specify which is to be kept and which removed, but really this is arbitrary, as the user performing the merge is free to swap them around.
- satisfy_merge_requests(removing, keeping, user)[source]¶
If there was a merge request(s) for this pair, mark it complete.
- update_email(person, email, **kwargs)[source]¶
Update a email record for the person.
- Parameters:
person¶ – Reference to a
Person
record.email¶ – Reference to the
PersonEmailAddress
record to update.address¶ – Actual email address.
type¶ – Type of email address.
invalid¶ – Boolean indicating the address is known to not be valid.
preferred¶ – Boolean indicating that this should (or not) be the “preferred” address for the person.
- rattail.people.get_people_handler(config, **kwargs)[source]¶
Create and return the configured
PeopleHandler
instance.Warning
This function is deprecated; please use
get_people_handler()
instead.