15.2.99. camcops_server.cc_modules.cc_exportrecipient

camcops_server/cc_modules/cc_exportrecipient.py


Copyright (C) 2012-2020 Rudolf Cardinal (rudolf@pobox.com).

This file is part of CamCOPS.

CamCOPS 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 3 of the License, or (at your option) any later version.

CamCOPS 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 CamCOPS. If not, see <https://www.gnu.org/licenses/>.


ExportRecipient class.

class camcops_server.cc_modules.cc_exportrecipient.ExportRecipient(*args, **kwargs)[source]

SQLAlchemy ORM class representing an export recipient.

This has a close relationship with (and inherits from) camcops_server.cc_modules.cc_exportrecipientinfo.ExportRecipientInfo (q.v.).

Full details of parameters are in the docs for the config file.

__init__(*args, **kwargs)

Creates a blank ExportRecipient object.

NB not called when SQLAlchemy objects loaded from database; see init_on_load() instead.

property db_url_obscuring_password

Returns the database URL (if present), but with its password obscured.

get_attrnames() → List[str][source]

Returns all relevant attribute names.

classmethod get_existing_matching_recipient(dbsession: sqlalchemy.orm.session.Session, recipient: camcops_server.cc_modules.cc_exportrecipient.ExportRecipient) → Optional[camcops_server.cc_modules.cc_exportrecipient.ExportRecipient][source]

Retrieves an active instance from the database that matches other, if there is one.

Parameters
  • dbsession – a sqlalchemy.orm.session.Session

  • recipient – an ExportRecipient

Returns

a database instance of ExportRecipient that matches, or None.

init_on_load() → None[source]

Called when SQLAlchemy recreates an object; see https://docs.sqlalchemy.org/en/latest/orm/constructors.html.

is_task_suitable(task: Task) → bool[source]

Used as a double-check that a task remains suitable.

Parameters

task – a camcops_server.cc_modules.cc_task.Task

Returns

is the task suitable for this recipient?

Return type

bool

is_upload_suitable_for_push(tablename: str, uploading_group_id: int) → bool[source]

Might an upload potentially give tasks to be “pushed”?

Called by camcops_server.cc_modules.cc_client_api_core.get_task_push_export_pks().

Parameters
  • tablename – table name being uploaded

  • uploading_group_id – group ID if the uploading user

Returns

whether this upload should be considered further