Exemplo n.º 1
0
def release_detail(request, slug):
    r = get_object_or_404(Release, slug=slug)

    if not r.enabled or not r.project.enabled:
        if r.project.is_maintainer(request.user):
            if not r.project.enabled:
                messages.info(request, message=_('This project is disabled. Only maintainers can view it.'))
            else:
                messages.info(request, message=_('This release is disabled. Only project maintainers can view it.'))
        else:
            raise Http403
    
    stats = POFile.objects.by_release_total(r)

    logfile = get_build_log_file(r.project.slug, r.slug)
    if not os.path.exists(logfile):
        logfile = False
    
    if request.user.is_authenticated():
        is_coord = request.user.team_coordinator.filter(project=r.project).count()>0
    else:
        is_coord = False
        
    return render_to_response("releases/release_detail.html",
                              {'release': r,
                               'stats': stats,
                               'build_log': logfile,
                               'is_coord': is_coord},
                              context_instance = RequestContext(request))
Exemplo n.º 2
0
def build_log(request, project, release):

    logfile = get_build_log_file(project, release)
    if not os.path.exists(logfile):
        raise Http404
    
    release = Release.objects.get(slug=release)
    
    if request.method == 'POST':
        res = {}
        offset = request.POST.get('offset')
        try:
            f = file(logfile)
            f.seek(long(offset))
            res['text_HTML'] = f.read().replace('\n','<br/>')
            res['offset'] = f.tell()
        except EOFError:
            res['offset']=offset
        finally:
            f.close()
            
        try:
            b = BuildCache.objects.get_locked(release=release)
            logger.debug("Locks count: %s" % b.count())
            if b.count()==0:
                res['offset']='END'   
        except Exception, e:
            logger.error(e)
            res['offset']='END'
            
        if res['offset']=='END':
            res['text_HTML'] += '<br/><< EOF >>' 
        return XMLResponse(res)
Exemplo n.º 3
0
def __build_repo(project, release, user):
    
    logfile = get_build_log_file(project.slug, release.slug)

    if os.path.exists(logfile):
        try:
            os.unlink(logfile)
        except Exception, u:
            logger.error("Unable to remove current logfile [%s]." % logfile)