uw.local.util package¶
Submodules¶
uw.local.util.format module¶
Convenient UW-specific formatting routines.
-
uw.local.util.format.
format_aff
(aff)[source]¶ Format an “Accounting Flex Field” account number.
- Parameters
aff (str) – the account number.
Formerly, inserted spaces appropriately to separate the various fields. Now this is done by the database stored procedures so this procedure is now the identity.
-
uw.local.util.format.
format_mailto_url
(cursor, person_ids, subject=None)[source]¶ Format a mailto: URL for some people and optionally a subject line.
- Parameters
cursor – DB connection cursor.
person_ids – an iterable of Identity person_id values of recipients.
subject (str) – the default subject for the email message.
-
uw.local.util.format.
format_person
(cursor, person_id)[source]¶ Format a person’s identity as HTML.
- Parameters
cursor – DB connection cursor.
person_id (int) – the person_id of the person.
Return HTML of the person’s name, which is a link to their WatIAM lookup page, followed by their userid in parentheses, which is a mailto: link for the person.
uw.local.util.identity module¶
-
uw.local.util.identity.
set_remote_identity
(handler)[source]¶ Wrap a handler; store identity associated with $REMOTE_USER.
Returns a handler which saves the identity associated with the remote user in the environment before chaining to the provided handler. Requires access to the database through the already-defined “cursor” parameter.
-
uw.local.util.identity.
use_remote_identity
(handler)[source]¶ Wrap a handler; access identity associated with $REMOTE_USER.
Returns a handler which copy the identity associated with the remote user from the environment to the ‘remote_identity’ parameter before chaining to the provided handler. Resulting handler must eventually be wrapped by set_remote_identity.
uw.local.util.mail module¶
Convenient UW-specific mail-related items.
uw.local.util.uw_business_day module¶
Defines some helper function using the uw_business_days table.
-
uw.local.util.uw_business_day.
non_business_days_in_span
(cursor, startdate=None, months=4, holidays_only=False)[source]¶ Returns a list of non-work days between the start & # months (inclusive)
- Parameters
cursor – a database cursor
startdate – a datetime date
enddate – a datetime date
holidays_only (boolean) – only include special holidays? (i.e. not weekends)