#--------------------------------------------------------
def link_communication(self, comm_medium, url, is_confidential = False):
"""
Link a communication medium with a patient.
@param comm_medium The name of the communication medium.
@param url The communication resource locator.
@type url A types.StringType instance.
@param is_confidential Wether the data must be treated as
confidential.
@type is_confidential A types.BooleanType instance.
"""
# locate communication in enum list and sanity check
comm_list = get_comm_list()
if comm_medium not in comm_list:
_log.Log(gmLog.lErr, 'cannot create communication of
type: %s' % comm_medium)
return False
# junk the cache
if self._ext_cache.has_key('comms'):
del self._ext_cache['comms']
# dump to backend
cmd = """
select create_person_comm(%s, %s, %s, %s)"""
successful, data = gmPG.run_commit2 (
link_obj = 'personalia',
queries = [
(cmd, [self._payload[self._idx['pk_identity']],
comm_medium, url,
is_confidential])
]
)
if not successful:
_log.Log(gmLog.lPanic, 'failed to create communication:
%s' % data)
return False
return True
Carlos, Karsten:
What's wrong with
gmPerson.add_subtable ('comms', {'medium':,, 'url':,,,})
There's nothing wrong with your method of course, (apart from sore fingers, but
now they're your
fingers, not mine ;-)
I see you have added SQL stored procedures like create_person_comm (), which is
good, but you
could just change the query strings as defined in _subtables.
If you are not going to use the subtables code (for whatever reason), please
delete it.
Ian
signature.asc
Description: OpenPGP digital signature
_______________________________________________
Gnumed-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/gnumed-devel