Synchronization of static files with Astakos
[snf-cloudcms] / cloudcms / cms_utils.py
1 from feincms.content.application.models import ApplicationContent
2
3 def get_app_page(model, urlconf_path):
4     """
5     Returns the model entry that has been associated with the application that
6     provides the passed urlconf_path.
7
8     e.g. to retrieve the page associated with
9
10     >>> page = get_app_page(Page, 'cloudcmsblog')
11     >>> print page.get_navigation_url()
12     >>> "/blog/"
13
14     """
15     app_content_type = model.content_type_for(ApplicationContent)
16     try:
17         blog_block = app_content_type.objects.filter(urlconf_path=urlconf_path)[0]
18     except:
19         return None
20     return blog_block.parent
21