Back to index

plone3  3.1.7
getSelectableViews.py
Go to the documentation of this file.
00001 ## Script (Python) "getSelectableViews"
00002 ##title=Get the view templates available from IBrowserDefault on the context
00003 ##bind container=container
00004 ##bind context=context
00005 ##bind namespace=
00006 ##bind script=script
00007 ##bind subpath=traverse_subpath
00008 ##parameters=
00009 
00010 if not context.canSetLayout():
00011     return None
00012 
00013 # If there is only one template to select and we can't set a default page,
00014 # it's not interesting to show the menu, so return None
00015 try:
00016     layouts = context.getAvailableLayouts()
00017 except AttributeError:
00018     # Might happen if FTI has not been migrated
00019     layouts = ()
00020     
00021 if len(layouts) <= 1 and not context.canSetDefaultPage():
00022     return None
00023 else:
00024     return layouts