Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

i build a feed like its described in in the docs: https://docs.djangoproject.com/en/1.3/ref/contrib/syndication/#a-complex-example

My feed class:

class UserRssFeed(Feed):
    def get_object(self, request, username = None, public_key = None):
        kwargs = {'username': username, 'profile__public_key': public_key}
        return get_object_or_404(User, **kwargs)

    def title(self, obj):
        return obj.username

    def link(self, obj):
        return 'http://safd/'

    def items(self, obj):
        return UserFeed.objects.filter(user = obj).get_entries()

    def item_title(self, item):
        return '[' + item.feed.name + '] ' + item.title

url.py:

from feedreader.models import UserRssFeed

urlpatterns = patterns('',
    # bla
    (r'^ownfeed/rss/(?P<username>[a-zA-Z0-9]+)/$', UserRssFeed()),
)

I get this error:

Traceback:
File "C:\Python27\lib\site-packages\django\core\handlers\base.py" in get_response
  101.                             request.path_info)
File "C:\Python27\lib\site-packages\django\core\urlresolvers.py" in resolve
  252.                     sub_match = pattern.resolve(new_path)
File "C:\Python27\lib\site-packages\django\core\urlresolvers.py" in resolve
  158.             return ResolverMatch(self.callback, args, kwargs, self.name)
File "C:\Python27\lib\site-packages\django\core\urlresolvers.py" in _get_callback
  169.             mod_name, func_name = get_mod_func(self._callback_str)
File "C:\Python27\lib\site-packages\django\core\urlresolvers.py" in get_mod_func
  113.         dot = callback.rindex('.')

Exception Type: AttributeError at /ownfeed/rss/adsf/
Exception Value: 'UserRssFeed' object has no attribute 'rindex'

Django version is 1.3.1

share|improve this question
    
just a guess in the blue, but could this be related to your public key? It always seems to be None, because it isnt provided. So why use it? –  Jingo Mar 22 '12 at 21:08
1  
Wasnt my public key. The problem was, that i had a model with the name Feed, so my UserRssFeed-class didnt inherit from the Feed class of Django... –  Ahsous Mar 27 '12 at 15:47

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.