added parent links

This commit is contained in:
mdipierro
2014-07-03 12:22:55 -05:00
parent 1606c938a7
commit 5d3c915c61
2 changed files with 21 additions and 11 deletions
+1 -1
View File
@@ -1 +1 @@
Version 2.9.5-trunk+timestamp.2014.07.03.11.54.34 Version 2.9.5-trunk+timestamp.2014.07.03.12.21.52
+20 -10
View File
@@ -74,16 +74,26 @@ class Collection(object):
href = URL(args=field._tablename,scheme=True)+'?%s={id}' % field.name href = URL(args=field._tablename,scheme=True)+'?%s={id}' % field.name
links.append({'rel':'current','href':href,'prompt':str(field), links.append({'rel':'current','href':href,'prompt':str(field),
'type':'children'}) 'type':'children'})
fields = self.table_policy.get('fields', table.fields) if row:
for fieldname in fields: fields = self.table_policy.get('fields', table.fields)
field = table[fieldname] for fieldname in fields:
if field.type=='upload' and row[fieldname]: field = table[fieldname]
href = URL('download',args=row[fieldname],scheme=True) if field.type.startswith('reference '):
links.append({'rel':'current','href':href,'prompt':str(field), href = URL(args=field.type[10:],vars={'id':row[fieldname]},
'type':'attachment'}) scheme=True)
# should this be supported? links.append({'rel':'current','href':href,'prompt':str(field),
for rel,build in (self.table_policy.get('links',{}).items()): 'type':'parent'})
links.append({'rel':'current','href':build(row),'prompt':rel})
for fieldname in fields:
field = table[fieldname]
if field.type=='upload' and row[fieldname]:
href = URL('download',args=row[fieldname],scheme=True)
links.append({'rel':'current','href':href,'prompt':str(field),
'type':'attachment'})
# should this be supported?
for rel,build in (self.table_policy.get('links',{}).items()):
links.append({'rel':'current','href':build(row),'prompt':rel})
# not sure # not sure
return links return links