google-code-export / django-hotclub

Automatically exported from code.google.com/p/django-hotclub
MIT License
0 stars 0 forks source link

sitemap.xml support #147

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Here are some diffs to add support for sitemap.xml generation.  I had
to hand massage the diffs since they were based on my custom project,
not complete_project, and my custom project has stuff you don't really
want.  I might have made some typos in the diffs, but I think any errors 
should be easy to clear up.

In a couple places I had to relax @login_required restrictions.  It
doesn't make sense to advertise a page in the sitemap if an anonymous
web crawler can't get to the page.  (If anyone knows how to properly
authenticate AdSense to login to a pinax site I'd love to hear it.
I haven't been able to manage it.)

For the most part in the pinax apps, the authenticated login check is
done in the template.  If you're an anonymous user, it just hides some
of the create/edit/delete links.  Some pages put the checks in views.py
and completely disable viewing the page if you aren't logged in.  Unless
the data truly needs to be secure (in which case you don't want to list
it in the sitemap), I think the first approach is better.

Due to a recent change in the vendor branch, I wasn't able to cleanly
isolate a change I had to make in photos/views.py.  I haven't analyzed
it yet, but the recent change might allow for unathenticated users to
view the public images (which is what we want for sitemap purposes).
I did something like:
    if request.user.is_authenticated():
        other_user = get_object_or_404(User, 
username=request.user.username)
        tribes = Tribe.objects.filter(members=request.user)
        projects = Project.objects.filter(members__user=request.user)
    else:
        other_user = None
        tribes = None
        projects = None

I think that's the only change that isn't in the patch, but I'm not
100% certain.  I haven't sitemap'd all the apps, so some additional
work is required anyway.

mike

Original issue reported on code.google.com by mike.dur...@gmail.com on 15 Jan 2009 at 4:29

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by pyDanny on 13 Mar 2009 at 4:17

GoogleCodeExporter commented 9 years ago

Original comment by pyDanny on 31 Mar 2009 at 4:19