Changeset - 72f008ed9b18
[Not reviewed]
beta
0 6 0
Marcin Kuzminski - 15 years ago 2011-01-26 18:37:42
marcin@python-works.com
implemented #84 downloads can be enabled/disabled per each repository from now.
6 files changed with 21 insertions and 0 deletions:
0 comments (0 inline, 0 general)
rhodecode/controllers/files.py
Show inline comments
 
@@ -164,6 +164,10 @@ class FilesController(BaseController):
 

	
 
        try:
 
            repo = ScmModel().get_repo(repo_name)
 

	
 
            if repo.dbrepo.enable_downloads is False:
 
                return _('downloads disabled')
 

	
 
            cs = repo.get_changeset(revision)
 
            content_type = ARCHIVE_SPECS[fileformat][0]
 
        except ChangesetDoesNotExistError:
rhodecode/controllers/summary.py
Show inline comments
 
@@ -142,6 +142,8 @@ class SummaryController(BaseController):
 
            c.trending_languages = json.dumps({})
 
            c.no_data = True
 

	
 
        c.enable_downloads = c.repo_info.dbrepo.enable_downloads
 
        if c.enable_downloads:
 
        c.download_options = self._get_download_links(c.repo_info)
 

	
 
        return render('summary/summary.html')
rhodecode/model/db.py
Show inline comments
 
@@ -184,6 +184,7 @@ class Repository(Base, BaseModel):
 
    user_id = Column("user_id", Integer(), ForeignKey('users.user_id'), nullable=False, unique=False, default=None)
 
    private = Column("private", Boolean(), nullable=True, unique=None, default=None)
 
    enable_statistics = Column("statistics", Boolean(), nullable=True, unique=None, default=True)
 
    enable_downloads = Column("downloads", Boolean(), nullable=True, unique=None, default=True)
 
    description = Column("description", String(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
 
    fork_id = Column("fork_id", Integer(), ForeignKey('repositories.repo_id'), nullable=True, unique=False, default=None)
 
    group_id = Column("group_id", Integer(), ForeignKey('groups.group_id'), nullable=True, unique=False, default=None)
rhodecode/model/forms.py
Show inline comments
 
@@ -447,6 +447,7 @@ def RepoForm(edit=False, old_data={}, su
 
        description = UnicodeString(strip=True, min=1, not_empty=True)
 
        private = StringBoolean(if_missing=False)
 
        enable_statistics = StringBoolean(if_missing=False)
 
        enable_downloads = StringBoolean(if_missing=False)
 
        repo_type = OneOf(supported_backends)
 
        if edit:
 
            user = All(Int(not_empty=True), ValidRepoUser)
rhodecode/templates/admin/repos/repo_edit.html
Show inline comments
 
@@ -69,6 +69,14 @@
 
                </div>
 
            </div>             
 
            <div class="field">
 
                <div class="label label-checkbox">
 
                    <label for="enable_downloads">${_('Enable downloads')}:</label>
 
                </div>
 
                <div class="checkboxes">
 
                    ${h.checkbox('enable_downloads',value="True")}
 
                </div>
 
            </div>                      
 
            <div class="field">
 
                <div class="label">
 
                    <label for="user">${_('Owner')}:</label>
 
                </div>
rhodecode/templates/summary/summary.html
Show inline comments
 
@@ -130,6 +130,11 @@
 
			  <div class="input-short">
 
		        %if len(c.repo_info.revisions) == 0:
 
		          ${_('There are no downloads yet')}
 
		        %elif c.enable_downloads is False:
 
		          ${_('Downloads are disabled for this repository')}
 
                    %if h.HasPermissionAll('hg.admin')('enable stats on from summary'):
 
                        [${h.link_to(_('enable'),h.url('edit_repo',repo_name=c.repo_name))}]
 
                    %endif  		          
 
		        %else:
 
			        ${h.select('download_options',c.repo_info.get_changeset().raw_id,c.download_options)}
 
			        %for cnt,archive in enumerate(c.repo_info._get_archives()):
0 comments (0 inline, 0 general)