view sat_website/utils.py @ 11:f23fba993dd6

typos fixes
author Goffi <goffi@goffi.org>
date Sun, 24 Feb 2013 23:33:40 +0100
parents a49aa1b823f6
children 31d196cf3b34
line wrap: on
line source

#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
SàT website: Salut à Toi's presentation website
Copyright (C) 2012  Jérôme Poisson (goffi@goffi.org)

This file is part of SàT website.

SàT website is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Foobar is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
"""

from os.path import basename,realpath,join
from django.conf import settings

def get_latest_sat():
    """Return a tuple with download path of latest SàT version, and version number"""
    try:
        path = settings.SAT_LINK_PATH
        real_path = realpath(path)
        filename = basename(real_path)
        version = filename[4:-8] #filename must be in the form of sat-version.tar.bz2
        if hasattr(settings, "SAT_DL_PATH"):
            dl_path = settings.SAT_DL_PATH
        else:
            dl_path = join(settings.SAT_DL_PREFIX, filename)
    except AttributeError:
        return (None, None)
    
    return (dl_path, version)