# Path: lfc/feeds.py
# class PageTagFeed(Feed):
#     """Provides a feed for a given object restricted by given tags url, e.g.
# 
#     http://www.lfcproject.com/rss/<path/to/obj>[?tags=python]
#     """
#     def get_object(self, request, url):
#         self.request = request
#         return lfc.utils.traverse_object(request, url)
# 
#     def title(self, obj):
#         portal = lfc.utils.get_portal()
#         return "%s - %s" % (portal.title, obj.title)
# 
#     def link(self, obj):
#         return obj.get_absolute_url()
# 
#     def description(self, obj):
#         return obj.description
# 
#     def items(self, obj):
#         paths_objs = obj.get_descendants()
# 
#         tags = self.request.GET.getlist("tags")
#         if not tags:
#             return paths_objs
#         else:
#             objs = []
#             tagged_objs = ModelTaggedItemManager().with_all(tags, BaseContent.objects.all())
#             for obj in tagged_objs:
#                 if obj.get_content_object() in paths_objs:
#                     objs.append(obj.get_content_object())
#             return objs
# 
# Path: lfc/sitemap.py
# class PageSitemap(Sitemap):
#     """Google's XML sitemap for pages.
#     """
#     changefreq = "daily"
#     priority = 0.5
# 
#     def items(self):
#         anon = AnonymousUser()
#         objects = []
#         for obj in BaseContent.objects.all():
#             if obj.get_content_object().has_permission(anon, "view"):
#                 objects.append(obj)
# 
#         return objects
# 
#     def lastmod(self, obj):
#         return obj.modification_date


from django.conf.urls import include, patterns, url
from django.views.generic import TemplateView
from lfc.feeds import PageTagFeed
from lfc.sitemap import PageSitemap
# django imports


# lfc imports

# Tags
urlpatterns = patterns("lfc.views",
    url(r'tag/(?P<slug>[-\w]+)/(?P<tag>[^/]+)/$', "lfc_tagged_object_list", name="page_tag_detail"),
)

# Comments
urlpatterns += patterns("",
    (r'^comments/', include('django_comments.urls')),
)

# Login / Logout
urlpatterns += patterns('django.contrib.auth.views',
    url('^login/?$', "login", {"template_name": "lfc/login.html"}, name='lfc_login'),
    url('^logout/?$', "logout", {"template_name": "lfc/logged_out.html"}, name='lfc_logout'),
)


# Path: lfc/feeds.py
# class PageTagFeed(Feed):
#     """Provides a feed for a given object restricted by given tags url, e.g.
# 
#     http://www.lfcproject.com/rss/<path/to/obj>[?tags=python]
#     """
#     def get_object(self, request, url):
#         self.request = request
#         return lfc.utils.traverse_object(request, url)
# 
#     def title(self, obj):
#         portal = lfc.utils.get_portal()
#         return "%s - %s" % (portal.title, obj.title)
# 
#     def link(self, obj):
#         return obj.get_absolute_url()
# 
#     def description(self, obj):
#         return obj.description
# 
#     def items(self, obj):
#         paths_objs = obj.get_descendants()
# 
#         tags = self.request.GET.getlist("tags")
#         if not tags:
#             return paths_objs
#         else:
#             objs = []
#             tagged_objs = ModelTaggedItemManager().with_all(tags, BaseContent.objects.all())
#             for obj in tagged_objs:
#                 if obj.get_content_object() in paths_objs:
#                     objs.append(obj.get_content_object())
#             return objs
# 
# Path: lfc/sitemap.py
# class PageSitemap(Sitemap):
#     """Google's XML sitemap for pages.
#     """
#     changefreq = "daily"
#     priority = 0.5
# 
#     def items(self):
#         anon = AnonymousUser()
#         objects = []
#         for obj in BaseContent.objects.all():
#             if obj.get_content_object().has_permission(anon, "view"):
#                 objects.append(obj)
# 
#         return objects
# 
#     def lastmod(self, obj):
#         return obj.modification_date


# Path: lfc/urls.py
from django.conf.urls import include, patterns, url
from django.views.generic import TemplateView
from lfc.feeds import PageTagFeed
from lfc.sitemap import PageSitemap

# django imports


# lfc imports

# Tags
urlpatterns = patterns("lfc.views",
    url(r'tag/(?P<slug>[-\w]+)/(?P<tag>[^/]+)/$', "lfc_tagged_object_list", name="page_tag_detail"),
)

# Comments
urlpatterns += patterns("",
    (r'^comments/', include('django_comments.urls')),
)

# Login / Logout
urlpatterns += patterns('django.contrib.auth.views',
    url('^login/?$', "login", {"template_name": "lfc/login.html"}, name='lfc_login'),
    url('^logout/?$', "logout", {"template_name": "lfc/logged_out.html"}, name='lfc_logout'),
)


urlpatterns += patterns('',