Skip to content

Commit

Permalink
Merge pull request #114 from cbanek/master
Browse files Browse the repository at this point in the history
Fix SecurityMethod parsing of capabilities.
  • Loading branch information
funbaker committed Apr 3, 2019
2 parents 9e05d84 + 738d63a commit f854676
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 35 deletions.
1 change: 1 addition & 0 deletions pyvo/dal/tests/data/tap/capabilities.xml
Expand Up @@ -14,6 +14,7 @@
<capability standardID="ivo://ivoa.net/std/VOSI#tables">
<interface role="std" xsi:type="vs:ParamHTTP">
<accessURL use="full">http://dc.zah.uni-heidelberg.de/__system__/tap/run/tableMetadata</accessURL>
<securityMethod standardID="http://www.w3.org/Protocols/HTTP/1.0/spec.html#BasicAA"/>
</interface>
</capability>
<capability standardID="ivo://ivoa.net/std/TAP" xsi:type="tr:TableAccess">
Expand Down
70 changes: 35 additions & 35 deletions pyvo/io/vosi/voresource.py
Expand Up @@ -151,6 +151,40 @@ def use(self, use):
self._use = use


class SecurityMethod(ContentMixin, Element):
"""
SecurityMethod element as described in
http://www.ivoa.net/xml/VOResource/v1.0
A description of a security mechanism.
this type only allows one to refer to the mechanism via a URI.
Derived types would allow for more metadata.
"""
def __init__(
self, config=None, pos=None, _name='securityMethod', standardID=None,
**kwargs
):
super(SecurityMethod, self).__init__(config, pos, _name, **kwargs)

self._standardid = standardID

def __repr__(self):
return '<SecurityMethod standardID={}>{}</SecurityMethod>'.format(
self.standardid, self.content)

@xmlattribute(name='standardID')
def standardid(self):
"""
A URI identifier for a standard security mechanism.
"""
return self._standardid

@standardid.setter
def standardid(self, standardid):
self._standardid = standardid


class Interface(Element):
"""
Interface element as described in
Expand Down Expand Up @@ -265,7 +299,7 @@ def accessurls(self):
"""
return self._accessurls

@xmlelement(name='securityMethod')
@xmlelement(name='securityMethod', cls=SecurityMethod)
def securitymethods(self):
"""
the mechanism the client must employ to gain secure
Expand Down Expand Up @@ -417,40 +451,6 @@ def standardid(self, standardid):
self._standardid = standardid


class SecurityMethod(ContentMixin, Element):
"""
SecurityMethod element as described in
http://www.ivoa.net/xml/VOResource/v1.0
A description of a security mechanism.
this type only allows one to refer to the mechanism via a URI.
Derived types would allow for more metadata.
"""
def __init__(
self, config=None, pos=None, _name='securityMethod', standardID=None,
**kwargs
):
super(SecurityMethod, self).__init__(config, pos, _name, **kwargs)

self._standardid = standardID

def __repr__(self):
return '<SecurityMethod standardID={}>{}</SecurityMethod>'.format(
self.standardid, self.content)

@xmlattribute(name='standardID')
def standardid(self):
"""
A URI identifier for a standard security mechanism.
"""
return self._standardid

@standardid.setter
def standardid(self, standardid):
self._standardid = standardid


@Interface.register_xsi_type('vr:WebBrowser')
class WebBrowser(Interface):
"""
Expand Down

0 comments on commit f854676

Please sign in to comment.