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

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

Add url_for_self function to User.

  • mediagoblin/db/models.py

    diff --git a/mediagoblin/db/models.py b/mediagoblin/db/models.py
    index 826d47b..3edd811 100644
    a b class User(Base, UserMixin):  
    104104        super(User, self).delete(**kwargs)
    105105        _log.info('Deleted user "{0}" account'.format(self.username))
    106106
     107    def url_for_self(self, urlgen, **kwargs):
     108        """Generate a URL for this User's home page."""
     109
     110        return urlgen(
     111            'mediagoblin.user_pages.user_home',
     112            user=self.username,
     113            **kwargs)
     114
    107115
    108116class MediaEntry(Base, MediaEntryMixin):
    109117    """