File tree Expand file tree Collapse file tree 3 files changed +13
-14
lines changed Expand file tree Collapse file tree 3 files changed +13
-14
lines changed Original file line number Diff line number Diff line change @@ -75,20 +75,19 @@ def get_href(self):
75
75
then the HREF returned will be relative.
76
76
In all other cases, this method will return an absolute HREF.
77
77
"""
78
- href = None
78
+ # get the self href
79
+ if self .is_resolved ():
80
+ href = self .target .get_self_href ()
81
+ else :
82
+ href = self .target
83
+
84
+ # if a hierarchical link with an owner and root, and relative catalog
79
85
if self .rel in HIERARCHICAL_LINKS and self .owner is not None :
80
- # get root
81
86
root = self .owner .get_root ()
82
- if root is not None :
83
- if root .catalog_type in ['RELATIVE_PUBLISHED' , 'SELF_CONTAINED' ]:
84
- if self .is_resolved ():
85
- href = self .target .get_self_href ()
86
- else :
87
- href = self .target
88
- if href and is_absolute_href (href ):
89
- href = make_relative_href (href , self .owner .get_self_href ())
90
- if href is None :
91
- href = self .get_absolute_href ()
87
+ if root is not None and root .catalog_type in ['RELATIVE_PUBLISHED' , 'SELF_CONTAINED' ]:
88
+ if href and is_absolute_href (href ):
89
+ href = make_relative_href (href , self .owner .get_self_href ())
90
+
92
91
return href
93
92
94
93
def get_absolute_href (self ):
Original file line number Diff line number Diff line change 95
95
"links" : [
96
96
{
97
97
"rel" : " source" ,
98
- "href" : " http://example.com /area-1-1-imagery/area-1-1-imagery.json" ,
98
+ "href" : " .. /area-1-1-imagery/area-1-1-imagery.json" ,
99
99
"type" : " application/json"
100
100
}
101
101
],
Original file line number Diff line number Diff line change 88
88
"links" : [
89
89
{
90
90
"rel" : " source" ,
91
- "href" : " http://example.com /area-1-1-imagery/area-1-1-imagery.json" ,
91
+ "href" : " .. /area-1-1-imagery/area-1-1-imagery.json" ,
92
92
"type" : " application/json"
93
93
}
94
94
],
You can’t perform that action at this time.
0 commit comments