Skip to content

Commit

Permalink
Adding an origin attribute to VOSI tables coming from RegistryResource.
Browse files Browse the repository at this point in the history
This points back to the parent instance.

This is an attempt to address
astropy#289 (comment)
  • Loading branch information
msdemlei committed Jan 24, 2022
1 parent 1b4633a commit b111e8b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pyvo/registry/regtap.py
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,9 @@ def _build_vosi_table(self, table_row, columns):
res._columns = [
self._build_vosi_column(row)
for row in columns]

res.origin = self

return res

def get_tables(self, table_limit=20):
Expand All @@ -763,7 +766,8 @@ def get_tables(self, table_limit=20):
This returns a dict with table names as keys and vosi.Table
objects as values (pretty much what tables returns for a TAP
service).
service). The table instances will have an ``origin`` attribute
pointing back to the registry record.
Note that not only TAP services can (and do) define table
structures. The meaning of non-TAP tables is not always
Expand Down
3 changes: 3 additions & 0 deletions pyvo/registry/tests/test_regtap.py
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,9 @@ def test_get_tables_table_instance(self, flash_tables):
assert (flash_tables["flashheros.data"].title
== "Flash/Heros SSA table")

assert (flash_tables["flashheros.data"].origin.ivoid
== "ivo://org.gavo.dc/flashheros/q/ssa")

@pytest.mark.remote_data
def test_get_tables_column_meta(self, flash_tables):
def getflashcol(name):
Expand Down

0 comments on commit b111e8b

Please sign in to comment.