David Larlet wrote:
>
> 
> Thanks for your suggestion, I've just done that:
> 
> class FakeObject(object):
>     def __init__(self, url):
>         self.url = url
> 
> class MainSitemap(Sitemap):
>     priority = 0.8
> 
>     def items(self):
>         return [FakeObject('/'),
>             FakeObject('/archives/'),
>             ...
>             ]
> 
>     def location(self, obj):
>         return obj.url
> 
> sitemaps = {
>     'index': MainSitemap(),
>     ...
> }
> 
> Any thoughts about this implementation?

I think you could get rid of FakeObject() completely:

class MainSitemap(Sitemap):
     priority = 0.8

     def items(self):
         return ["/", "/archives/", "/foo/bar/", ...]

     def location(self, obj):
         return obj


OTOH, if your code works now, you could also leave it alone. :-)  And 
FakeObject could be a convenient central container for calculating 
information that the other methods need, if your site grows in complexity.

John


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to