Changeset - f9bc28c44f30
[Not reviewed]
default
0 19 0
Mads Kiilerich - 11 years ago 2014-08-12 13:08:23
madski@unity3d.com
urls: introduce canonical_url config setting

All URLs that are shown or persisted or emailed will use this instead of the
current url.

This is convenient when the server has multiple names - for instance when
transitioning from one protocol or domain or hostname to another.
19 files changed with 99 insertions and 101 deletions:
0 comments (0 inline, 0 general)
kallithea/controllers/feed.py
Show inline comments
 
@@ -28,7 +28,7 @@ Original author and date, and relevant c
 

	
 
import logging
 

	
 
from pylons import url, response, tmpl_context as c
 
from pylons import response, tmpl_context as c
 
from pylons.i18n.translation import _
 

	
 
from beaker.cache import cache_region, region_invalidate
 
@@ -102,8 +102,8 @@ class FeedController(BaseRepoController)
 
            desc_msg.append('tag: %s<br/>' % tag)
 
        diff_processor, changes = self.__changes(cs)
 
        # rev link
 
        _url = url('changeset_home', repo_name=c.db_repo.repo_name,
 
                   revision=cs.raw_id, qualified=True)
 
        _url = h.canonical_url('changeset_home', repo_name=c.db_repo.repo_name,
 
                   revision=cs.raw_id)
 
        desc_msg.append('changeset: <a href="%s">%s</a>' % (_url, cs.raw_id[:8]))
 

	
 
        desc_msg.append('<pre>')
 
@@ -123,8 +123,7 @@ class FeedController(BaseRepoController)
 
        def _get_feed_from_cache(key, kind):
 
            feed = Atom1Feed(
 
                 title=self.title % repo_name,
 
                 link=url('summary_home', repo_name=repo_name,
 
                          qualified=True),
 
                 link=h.canonical_url('summary_home', repo_name=repo_name),
 
                 description=self.description % repo_name,
 
                 language=self.language,
 
                 ttl=self.ttl
 
@@ -132,8 +131,8 @@ class FeedController(BaseRepoController)
 

	
 
            for cs in reversed(list(c.db_repo_scm_instance[-self.feed_nr:])):
 
                feed.add_item(title=self._get_title(cs),
 
                              link=url('changeset_home', repo_name=repo_name,
 
                                       revision=cs.raw_id, qualified=True),
 
                              link=h.canonical_url('changeset_home', repo_name=repo_name,
 
                                       revision=cs.raw_id),
 
                              author_name=cs.author,
 
                              description=''.join(self.__get_desc(cs)),
 
                              pubdate=cs.date,
 
@@ -155,8 +154,7 @@ class FeedController(BaseRepoController)
 
        def _get_feed_from_cache(key, kind):
 
            feed = Rss201rev2Feed(
 
                title=self.title % repo_name,
 
                link=url('summary_home', repo_name=repo_name,
 
                         qualified=True),
 
                link=h.canonical_url('summary_home', repo_name=repo_name),
 
                description=self.description % repo_name,
 
                language=self.language,
 
                ttl=self.ttl
 
@@ -164,8 +162,8 @@ class FeedController(BaseRepoController)
 

	
 
            for cs in reversed(list(c.db_repo_scm_instance[-self.feed_nr:])):
 
                feed.add_item(title=self._get_title(cs),
 
                              link=url('changeset_home', repo_name=repo_name,
 
                                       revision=cs.raw_id, qualified=True),
 
                              link=h.canonical_url('changeset_home', repo_name=repo_name,
 
                                       revision=cs.raw_id),
 
                              author_name=cs.author,
 
                              description=''.join(self.__get_desc(cs)),
 
                              pubdate=cs.date,
kallithea/controllers/journal.py
Show inline comments
 
@@ -110,11 +110,11 @@ class JournalController(BaseController):
 
    def _atom_feed(self, repos, public=True):
 
        journal = self._get_journal_data(repos)
 
        if public:
 
            _link = url('public_journal_atom', qualified=True)
 
            _link = h.canonical_url('public_journal_atom')
 
            _desc = '%s %s %s' % (c.site_name, _('public journal'),
 
                                  'atom feed')
 
        else:
 
            _link = url('journal_atom', qualified=True)
 
            _link = h.canonical_url('journal_atom')
 
            _desc = '%s %s %s' % (c.site_name, _('journal'), 'atom feed')
 

	
 
        feed = Atom1Feed(title=_desc,
 
@@ -136,13 +136,12 @@ class JournalController(BaseController):
 
            desc = action_extra()
 
            _url = None
 
            if entry.repository is not None:
 
                _url = url('changelog_home',
 
                           repo_name=entry.repository.repo_name,
 
                           qualified=True)
 
                _url = h.canonical_url('changelog_home',
 
                           repo_name=entry.repository.repo_name)
 

	
 
            feed.add_item(title=title,
 
                          pubdate=entry.action_date,
 
                          link=_url or url('', qualified=True),
 
                          link=_url or h.canonical_url(''),
 
                          author_email=user.email,
 
                          author_name=user.full_contact,
 
                          description=desc)
 
@@ -153,11 +152,11 @@ class JournalController(BaseController):
 
    def _rss_feed(self, repos, public=True):
 
        journal = self._get_journal_data(repos)
 
        if public:
 
            _link = url('public_journal_atom', qualified=True)
 
            _link = h.canonical_url('public_journal_atom')
 
            _desc = '%s %s %s' % (c.site_name, _('public journal'),
 
                                  'rss feed')
 
        else:
 
            _link = url('journal_atom', qualified=True)
 
            _link = h.canonical_url('journal_atom')
 
            _desc = '%s %s %s' % (c.site_name, _('journal'), 'rss feed')
 

	
 
        feed = Rss201rev2Feed(title=_desc,
 
@@ -179,13 +178,12 @@ class JournalController(BaseController):
 
            desc = action_extra()
 
            _url = None
 
            if entry.repository is not None:
 
                _url = url('changelog_home',
 
                           repo_name=entry.repository.repo_name,
 
                           qualified=True)
 
                _url = h.canonical_url('changelog_home',
 
                           repo_name=entry.repository.repo_name)
 

	
 
            feed.add_item(title=title,
 
                          pubdate=entry.action_date,
 
                          link=_url or url('', qualified=True),
 
                          link=_url or h.canonical_url(''),
 
                          author_email=user.email,
 
                          author_name=user.full_contact,
 
                          description=desc)
kallithea/controllers/pullrequests.py
Show inline comments
 
@@ -497,8 +497,8 @@ class PullrequestsController(BaseRepoCon
 
        lost = old_revisions.difference(revisions)
 

	
 
        infos = ['','', 'This is an update of %s "%s".' %
 
                 (url('pullrequest_show', repo_name=old_pull_request.other_repo.repo_name,
 
                      pull_request_id=pull_request_id, qualified=True),
 
                 (h.canonical_url('pullrequest_show', repo_name=old_pull_request.other_repo.repo_name,
 
                      pull_request_id=pull_request_id),
 
                  old_pull_request.title)]
 

	
 
        if lost:
 
@@ -517,11 +517,11 @@ class PullrequestsController(BaseRepoCon
 

	
 
            if ancestor_rev == other_rev:
 
                infos.append(_("Ancestor didn't change - show diff since previous version: %s .") %
 
                             url('compare_url',
 
                             h.canonical_url('compare_url',
 
                                 repo_name=org_repo.repo_name, # other_repo is always same as repo_name
 
                                 org_ref_type='rev', org_ref_name=h.short_id(org_rev), # use old org_rev as base
 
                                 other_ref_type='rev', other_ref_name=h.short_id(new_org_rev),
 
                                 qualified=True)) # note: linear diff, merge or not doesn't matter
 
                                 )) # note: linear diff, merge or not doesn't matter
 
            else:
 
                infos.append(_('This pull request uses another merge ancestor than the previous version and they are not directly comparable.'))
 
        else:
 
@@ -559,10 +559,9 @@ class PullrequestsController(BaseRepoCon
 
                                pull_request_id=pull_request_id))
 

	
 
        ChangesetCommentsModel().create(
 
            text=_('Closed, replaced by %s .') % url('pullrequest_show',
 
            text=_('Closed, replaced by %s .') % h.canonical_url('pullrequest_show',
 
                                                   repo_name=old_pull_request.other_repo.repo_name,
 
                                                   pull_request_id=pull_request.pull_request_id,
 
                                                   qualified=True),
 
                                                   pull_request_id=pull_request.pull_request_id),
 
            repo=old_pull_request.other_repo.repo_id,
 
            user=c.authuser.user_id,
 
            pull_request=pull_request_id,
kallithea/lib/dbmigrate/schema/db_1_5_2.py
Show inline comments
 
@@ -936,10 +936,10 @@ class Repository(Base, BaseModel):
 
        return self.updated_on
 

	
 
    def clone_url(self, **override):
 
        from pylons import url
 
        import kallithea.lib.helpers as h
 
        from urlparse import urlparse
 
        import urllib
 
        parsed_url = urlparse(url('home', qualified=True))
 
        parsed_url = urlparse(h.canonical_url('home'))
 
        default_clone_uri = '%(scheme)s://%(user)s%(pass)s%(netloc)s%(prefix)s%(path)s'
 
        decoded_path = safe_unicode(urllib.unquote(parsed_url.path))
 
        args = {
kallithea/lib/dbmigrate/schema/db_1_6_0.py
Show inline comments
 
@@ -1006,10 +1006,10 @@ class Repository(Base, BaseModel):
 
        return self.updated_on
 

	
 
    def clone_url(self, **override):
 
        from pylons import url
 
        import kallithea.lib.helpers as h
 
        from urlparse import urlparse
 
        import urllib
 
        parsed_url = urlparse(url('home', qualified=True))
 
        parsed_url = urlparse(h.canonical_url('home'))
 
        default_clone_uri = '%(scheme)s://%(user)s%(pass)s%(netloc)s%(prefix)s%(path)s'
 
        decoded_path = safe_unicode(urllib.unquote(parsed_url.path))
 
        args = {
kallithea/lib/dbmigrate/schema/db_1_7_0.py
Show inline comments
 
@@ -1037,10 +1037,10 @@ class Repository(Base, BaseModel):
 
        return self.updated_on
 

	
 
    def clone_url(self, **override):
 
        from pylons import url
 
        import kallithea.lib.helpers as h
 
        from urlparse import urlparse
 
        import urllib
 
        parsed_url = urlparse(url('home', qualified=True))
 
        parsed_url = urlparse(h.canonical_url('home'))
 
        default_clone_uri = '%(scheme)s://%(user)s%(pass)s%(netloc)s%(prefix)s%(path)s'
 
        decoded_path = safe_unicode(urllib.unquote(parsed_url.path))
 
        args = {
 
@@ -2168,8 +2168,8 @@ class Gist(Base, BaseModel):
 
        if alias_url:
 
            return alias_url.replace('{gistid}', self.gist_access_id)
 

	
 
        from pylons import url
 
        return url('gist', gist_id=self.gist_access_id, qualified=True)
 
        import kallithea.lib.helpers as h
 
        return h.canonical_url('gist', gist_id=self.gist_access_id)
 

	
 
    @classmethod
 
    def base_path(cls):
kallithea/lib/dbmigrate/schema/db_1_8_0.py
Show inline comments
 
@@ -1067,10 +1067,10 @@ class Repository(Base, BaseModel):
 
        return self.updated_on
 

	
 
    def clone_url(self, **override):
 
        from pylons import url
 
        import kallithea.lib.helpers as h
 
        from urlparse import urlparse
 
        import urllib
 
        parsed_url = urlparse(url('home', qualified=True))
 
        parsed_url = urlparse(h.canonical_url('home'))
 
        default_clone_uri = '%(scheme)s://%(user)s%(pass)s%(netloc)s%(prefix)s%(path)s'
 
        decoded_path = safe_unicode(urllib.unquote(parsed_url.path))
 
        args = {
 
@@ -2215,8 +2215,8 @@ class Gist(Base, BaseModel):
 
        if alias_url:
 
            return alias_url.replace('{gistid}', self.gist_access_id)
 

	
 
        from pylons import url
 
        return url('gist', gist_id=self.gist_access_id, qualified=True)
 
        import kallithea.lib.helpers as h
 
        return h.canonical_url('gist', gist_id=self.gist_access_id)
 

	
 
    @classmethod
 
    def base_path(cls):
kallithea/lib/dbmigrate/schema/db_2_0_0.py
Show inline comments
 
@@ -1124,10 +1124,10 @@ class Repository(Base, BaseModel):
 
        return self.updated_on
 

	
 
    def clone_url(self, **override):
 
        from pylons import url
 
        import kallithea.lib.helpers as h
 
        from urlparse import urlparse
 
        import urllib
 
        parsed_url = urlparse(url('home', qualified=True))
 
        parsed_url = urlparse(h.canonical_url('home'))
 
        default_clone_uri = '%(scheme)s://%(user)s%(pass)s%(netloc)s%(prefix)s%(path)s'
 
        decoded_path = safe_unicode(urllib.unquote(parsed_url.path))
 
        args = {
 
@@ -2275,8 +2275,8 @@ class Gist(Base, BaseModel):
 
        if alias_url:
 
            return alias_url.replace('{gistid}', self.gist_access_id)
 

	
 
        from pylons import url
 
        return url('gist', gist_id=self.gist_access_id, qualified=True)
 
        import kallithea.lib.helpers as h
 
        return h.canonical_url('gist', gist_id=self.gist_access_id)
 

	
 
    @classmethod
 
    def base_path(cls):
kallithea/lib/dbmigrate/schema/db_2_0_1.py
Show inline comments
 
@@ -1123,10 +1123,10 @@ class Repository(Base, BaseModel):
 
        return self.updated_on
 

	
 
    def clone_url(self, **override):
 
        from pylons import url
 
        import kallithea.lib.helpers as h
 
        from urlparse import urlparse
 
        import urllib
 
        parsed_url = urlparse(url('home', qualified=True))
 
        parsed_url = urlparse(h.canonical_url('home'))
 
        default_clone_uri = '%(scheme)s://%(user)s%(pass)s%(netloc)s%(prefix)s%(path)s'
 
        decoded_path = safe_unicode(urllib.unquote(parsed_url.path))
 
        args = {
 
@@ -2276,8 +2276,8 @@ class Gist(Base, BaseModel):
 
        if alias_url:
 
            return alias_url.replace('{gistid}', self.gist_access_id)
 

	
 
        from pylons import url
 
        return url('gist', gist_id=self.gist_access_id, qualified=True)
 
        import kallithea.lib.helpers as h
 
        return h.canonical_url('gist', gist_id=self.gist_access_id)
 

	
 
    @classmethod
 
    def base_path(cls):
kallithea/lib/dbmigrate/schema/db_2_0_2.py
Show inline comments
 
@@ -1140,10 +1140,10 @@ class Repository(Base, BaseModel):
 
        return self.updated_on
 

	
 
    def clone_url(self, **override):
 
        from pylons import url
 
        import kallithea.lib.helpers as h
 
        from urlparse import urlparse
 
        import urllib
 
        parsed_url = urlparse(url('home', qualified=True))
 
        parsed_url = urlparse(h.canonical_url('home'))
 
        default_clone_uri = '%(scheme)s://%(user)s%(pass)s%(netloc)s%(prefix)s%(path)s'
 
        decoded_path = safe_unicode(urllib.unquote(parsed_url.path))
 
        args = {
 
@@ -2297,8 +2297,8 @@ class Gist(Base, BaseModel):
 
        if alias_url:
 
            return alias_url.replace('{gistid}', self.gist_access_id)
 

	
 
        from pylons import url
 
        return url('gist', gist_id=self.gist_access_id, qualified=True)
 
        import kallithea.lib.helpers as h
 
        return h.canonical_url('gist', gist_id=self.gist_access_id)
 

	
 
    @classmethod
 
    def base_path(cls):
kallithea/lib/dbmigrate/schema/db_2_1_0.py
Show inline comments
 
@@ -1179,10 +1179,10 @@ class Repository(Base, BaseModel):
 
        return self.updated_on
 

	
 
    def clone_url(self, **override):
 
        from pylons import url
 
        import kallithea.lib.helpers as h
 
        from urlparse import urlparse
 
        import urllib
 
        parsed_url = urlparse(url('home', qualified=True))
 
        parsed_url = urlparse(h.canonical_url('home'))
 
        default_clone_uri = '%(scheme)s://%(user)s%(pass)s%(netloc)s%(prefix)s%(path)s'
 
        decoded_path = safe_unicode(urllib.unquote(parsed_url.path))
 
        args = {
 
@@ -2336,8 +2336,8 @@ class Gist(Base, BaseModel):
 
        if alias_url:
 
            return alias_url.replace('{gistid}', self.gist_access_id)
 

	
 
        from pylons import url
 
        return url('gist', gist_id=self.gist_access_id, qualified=True)
 
        import kallithea.lib.helpers as h
 
        return h.canonical_url('gist', gist_id=self.gist_access_id)
 

	
 
    @classmethod
 
    def base_path(cls):
kallithea/lib/dbmigrate/schema/db_2_2_0.py
Show inline comments
 
@@ -1219,8 +1219,8 @@ class Repository(Base, BaseModel):
 
        return self.updated_on
 

	
 
    def clone_url(self, **override):
 
        from pylons import url
 
        qualified_home_url = url('home', qualified=True)
 
        import kallithea.lib.helpers as h
 
        qualified_home_url = h.canonical_url('home')
 

	
 
        uri_tmpl = None
 
        if 'uri_tmpl' in override:
 
@@ -2393,8 +2393,8 @@ class Gist(Base, BaseModel):
 
        if alias_url:
 
            return alias_url.replace('{gistid}', self.gist_access_id)
 

	
 
        from pylons import url
 
        return url('gist', gist_id=self.gist_access_id, qualified=True)
 
        import kallithea.lib.helpers as h
 
        return h.canonical_url('gist', gist_id=self.gist_access_id)
 

	
 
    @classmethod
 
    def base_path(cls):
kallithea/lib/dbmigrate/schema/db_2_2_3.py
Show inline comments
 
@@ -1239,8 +1239,8 @@ class Repository(Base, BaseModel):
 
        return self.updated_on
 

	
 
    def clone_url(self, **override):
 
        from pylons import url
 
        qualified_home_url = url('home', qualified=True)
 
        import kallithea.lib.helpers as h
 
        qualified_home_url = h.canonical_url('home')
 

	
 
        uri_tmpl = None
 
        if 'with_id' in override:
 
@@ -2439,8 +2439,8 @@ class Gist(Base, BaseModel):
 
        if alias_url:
 
            return alias_url.replace('{gistid}', self.gist_access_id)
 

	
 
        from pylons import url
 
        return url('gist', gist_id=self.gist_access_id, qualified=True)
 
        import kallithea.lib.helpers as h
 
        return h.canonical_url('gist', gist_id=self.gist_access_id)
 

	
 
    @classmethod
 
    def base_path(cls):
kallithea/lib/helpers.py
Show inline comments
 
@@ -67,6 +67,18 @@ from kallithea.model.db import URL_SEP, 
 
log = logging.getLogger(__name__)
 

	
 

	
 
def canonical_url(*args, **kargs):
 
    '''Like url(x, qualified=True), but returns url that not only is qualified
 
    but also canonical, as configured in canonical_url'''
 
    from kallithea import CONFIG
 
    try:
 
        parts = CONFIG.get('canonical_url', '').split('://', 1)
 
        kargs['host'] = parts[1].split('/', 1)[0]
 
        kargs['protocol'] = parts[0]
 
    except IndexError:
 
        kargs['qualified'] = True
 
    return url(*args, **kargs)
 

	
 
def html_escape(text, html_escape_table=None):
 
    """Produce entities within text."""
 
    if not html_escape_table:
kallithea/model/comment.py
Show inline comments
 
@@ -81,16 +81,13 @@ class ChangesetCommentsModel(BaseModel):
 
            cs = repo.scm_instance.get_changeset(revision)
 
            desc = "%s" % (cs.short_id)
 

	
 
            revision_url = h.url('changeset_home',
 
            revision_url = h.canonical_url('changeset_home',
 
                repo_name=repo.repo_name,
 
                revision=revision)
 
            comment_url = h.canonical_url('changeset_home',
 
                repo_name=repo.repo_name,
 
                revision=revision,
 
                qualified=True,)
 
            comment_url = h.url('changeset_home',
 
                repo_name=repo.repo_name,
 
                revision=revision,
 
                anchor='comment-%s' % comment.comment_id,
 
                qualified=True,
 
            )
 
                anchor='comment-%s' % comment.comment_id)
 
            subj = safe_unicode(
 
                h.link_to('Re changeset: %(desc)s %(line)s' % \
 
                          {'desc': desc, 'line': line},
 
@@ -107,8 +104,7 @@ class ChangesetCommentsModel(BaseModel):
 
            email_kwargs = {
 
                'status_change': status_change,
 
                'cs_comment_user': h.person(user),
 
                'cs_target_repo': h.url('summary_home', repo_name=repo.repo_name,
 
                                        qualified=True),
 
                'cs_target_repo': h.canonical_url('summary_home', repo_name=repo.repo_name),
 
                'cs_comment_url': comment_url,
 
                'raw_id': revision,
 
                'message': cs.message,
 
@@ -123,16 +119,13 @@ class ChangesetCommentsModel(BaseModel):
 
            notification_type = Notification.TYPE_PULL_REQUEST_COMMENT
 
            desc = comment.pull_request.title
 
            _org_ref_type, org_ref_name, _org_rev = comment.pull_request.org_ref.split(':')
 
            pr_url = h.url('pullrequest_show',
 
            pr_url = h.canonical_url('pullrequest_show',
 
                repo_name=pull_request.other_repo.repo_name,
 
                pull_request_id=pull_request.pull_request_id)
 
            comment_url = h.canonical_url('pullrequest_show',
 
                repo_name=pull_request.other_repo.repo_name,
 
                pull_request_id=pull_request.pull_request_id,
 
                qualified=True,)
 
            comment_url = h.url('pullrequest_show',
 
                repo_name=pull_request.other_repo.repo_name,
 
                pull_request_id=pull_request.pull_request_id,
 
                anchor='comment-%s' % comment.comment_id,
 
                qualified=True,
 
            )
 
                anchor='comment-%s' % comment.comment_id)
 
            subj = safe_unicode(
 
                h.link_to('Re pull request #%(pr_id)s: %(desc)s %(line)s' % \
 
                          {'desc': desc,
 
@@ -157,9 +150,8 @@ class ChangesetCommentsModel(BaseModel):
 
                'closing_pr': closing_pr,
 
                'pr_comment_url': comment_url,
 
                'pr_comment_user': h.person(user),
 
                'pr_target_repo': h.url('summary_home',
 
                                   repo_name=pull_request.other_repo.repo_name,
 
                                   qualified=True),
 
                'pr_target_repo': h.canonical_url('summary_home',
 
                                   repo_name=pull_request.other_repo.repo_name),
 
                'repo_name': pull_request.other_repo.repo_name,
 
                'ref': org_ref_name,
 
                'comment_username': user.username,
kallithea/model/db.py
Show inline comments
 
@@ -1248,8 +1248,8 @@ class Repository(Base, BaseModel):
 
        return clone_uri
 

	
 
    def clone_url(self, **override):
 
        from pylons import url
 
        qualified_home_url = url('home', qualified=True)
 
        import kallithea.lib.helpers as h
 
        qualified_home_url = h.canonical_url('home')
 

	
 
        uri_tmpl = None
 
        if 'with_id' in override:
 
@@ -2447,8 +2447,8 @@ class Gist(Base, BaseModel):
 
        if alias_url:
 
            return alias_url.replace('{gistid}', self.gist_access_id)
 

	
 
        from pylons import url
 
        return url('gist', gist_id=self.gist_access_id, qualified=True)
 
        import kallithea.lib.helpers as h
 
        return h.canonical_url('gist', gist_id=self.gist_access_id)
 

	
 
    @classmethod
 
    def base_path(cls):
kallithea/model/pull_request.py
Show inline comments
 
@@ -124,9 +124,8 @@ class PullRequestModel(BaseModel):
 
                         for x in map(pr.org_repo.get_changeset, pr.revisions)]
 

	
 
        #notification to reviewers
 
        pr_url = h.url('pullrequest_show', repo_name=pr.other_repo.repo_name,
 
                       pull_request_id=pr.pull_request_id,
 
                       qualified=True)
 
        pr_url = h.canonical_url('pullrequest_show', repo_name=pr.other_repo.repo_name,
 
                       pull_request_id=pr.pull_request_id)
 
        subject = safe_unicode(
 
            h.link_to(
 
              _('%(user)s wants you to review pull request #%(pr_id)s: %(pr_title)s') % \
 
@@ -140,8 +139,7 @@ class PullRequestModel(BaseModel):
 
        email_kwargs = {
 
            'pr_title': pr.title,
 
            'pr_user_created': h.person(pr.author),
 
            'pr_repo_url': h.url('summary_home', repo_name=pr.other_repo.repo_name,
 
                                 qualified=True,),
 
            'pr_repo_url': h.canonical_url('summary_home', repo_name=pr.other_repo.repo_name),
 
            'pr_url': pr_url,
 
            'pr_revisions': revision_data,
 
            'repo_name': pr.other_repo.repo_name,
kallithea/model/user.py
Show inline comments
 
@@ -28,7 +28,6 @@ Original author and date, and relevant c
 

	
 
import logging
 
import traceback
 
from pylons import url
 
from pylons.i18n.translation import _
 

	
 
from sqlalchemy.exc import DatabaseError
 
@@ -184,6 +183,7 @@ class UserModel(BaseModel):
 

	
 
    def create_registration(self, form_data):
 
        from kallithea.model.notification import NotificationModel
 
        import kallithea.lib.helpers as h
 

	
 
        try:
 
            form_data['admin'] = False
 
@@ -202,7 +202,7 @@ class UserModel(BaseModel):
 
                    '- Full Name: %s\n'
 
                    '- Email: %s\n')
 
            body = body % (new_user.username, new_user.full_name, new_user.email)
 
            edit_url = url('edit_user', id=new_user.user_id, qualified=True)
 
            edit_url = h.canonical_url('edit_user', id=new_user.user_id)
 
            email_kwargs = {'registered_user_url': edit_url, 'new_username': new_user.username}
 
            NotificationModel().create(created_by=new_user, subject=subject,
 
                                       body=body, recipients=None,
 
@@ -287,13 +287,14 @@ class UserModel(BaseModel):
 
    def reset_password_link(self, data):
 
        from kallithea.lib.celerylib import tasks, run_task
 
        from kallithea.model.notification import EmailNotificationModel
 
        import kallithea.lib.helpers as h
 

	
 
        user_email = data['email']
 
        try:
 
            user = User.get_by_email(user_email)
 
            if user:
 
                log.debug('password reset user found %s' % user)
 
                link = url('reset_password_confirmation', key=user.api_key,
 
                           qualified=True)
 
                link = h.canonical_url('reset_password_confirmation', key=user.api_key)
 
                reg_type = EmailNotificationModel.TYPE_PASSWORD_RESET
 
                body = EmailNotificationModel().get_email_tmpl(reg_type,
 
                                                               user=user.short_contact,
kallithea/templates/base/base.html
Show inline comments
 
@@ -46,7 +46,7 @@
 
                   <a href="${h.url('kallithea_project_url')}" target="_blank">Kallithea</a>,
 
               %endif
 
               which is
 
               <a href="${h.url('about')}#copyright">&copy; 2010&ndash;2014 by various authors &amp; licensed under GPLv3</a>.
 
               <a href="${h.canonical_url('about')}#copyright">&copy; 2010&ndash;2014 by various authors &amp; licensed under GPLv3</a>.
 
               %if c.issues_url:
 
                   &ndash; <a href="${c.issues_url}" target="_blank">${_('Support')}</a>
 
               %endif
0 comments (0 inline, 0 general)