Ticket #686: trac#686-usermixin.url_for_self.diff

File trac#686-usermixin.url_for_self.diff, 560 bytes (added by Ben Sturmfels, 11 years ago)

Add url_for_self function to UserMixin.

  • mediagoblin/db/mixin.py

    diff --git a/mediagoblin/db/mixin.py b/mediagoblin/db/mixin.py
    index 57b27d8..7e21673 100644
    a b class UserMixin(object):  
    4646    def bio_html(self):
    4747        return cleaned_markdown_conversion(self.bio)
    4848
     49    def url_for_self(self, urlgen, **kwargs):
     50        """Generate a URL for this User's home page."""
     51
     52        return urlgen(
     53            'mediagoblin.user_pages.user_home',
     54            user=self.username,
     55            **kwargs)
     56
    4957
    5058class GenerateSlugMixin(object):
    5159    """