Changeset - 2bd2c02967d9
[Not reviewed]
default
0 2 0
Dennis Fink - 11 years ago 2014-07-15 19:52:46
dennis.fink@c3l.lu
Really fix mail send and version bump
2 files changed with 2 insertions and 2 deletions:
0 comments (0 inline, 0 general)
ennstatus/status/functions.py
Show inline comments
 
@@ -39,49 +39,49 @@ def _check_server(data):
 
    filename = os.path.join('data', '.'.join([server_name.lower(), 'json']))
 

	
 
    date = datetime.strptime(last_updated, '%d-%m-%Y %H:%M:%S')
 
    now = datetime.utcnow()
 
    delta = now - date
 

	
 
    if delta.days >= 7:
 
        os.remove(filename)
 
        current_app.logger.error('%s was removed!' % server_name)
 
        return False
 
    elif data['server_status'] == 'Offline':
 
        return data
 

	
 
    if delta.seconds >= 3600:
 
        status = 'Offline'
 
    elif delta.seconds >= 1200:
 
        status = 'Unknown'
 
    else:
 
        status = None
 

	
 
    if status is not None:
 
        current_app.logger.error('%s is set to %s' % (server_name,
 
                                 status))
 

	
 
        if data['server_status'] != 'Unknown' and status != 'Offline':
 
        if data['server_status'] == 'Unknown' and status == 'Offline':
 
            _send_mail(server_name, status, last_updated)
 

	
 
        for key in ('server_status', 'tor_status'):
 
            data[key] = status
 

	
 
        with open(filename, mode='w', encoding='utf-8') as file_object:
 
            json.dump(data, file_object)
 

	
 
    return data
 

	
 

	
 
def _load_single_server(filename):
 

	
 
    try:
 
        with open(filename, encoding='utf-8') as f:
 
            server = json.load(f)
 
    except IOError:
 
        return False
 

	
 
    server = _check_server(server)
 
    return server
 

	
 

	
 
def single_server(name):
setup.py
Show inline comments
 
from setuptools import setup, find_packages
 

	
 

	
 
def _get_requirements():
 

	
 
    with open('requirements.in', encoding='utf-8') as f:
 
        lines = f.readlines()
 

	
 
    lines = [line[:-1] for line in lines if not line.startswith('#')]
 
    return lines
 

	
 

	
 
setup(name='Ennstatus',
 
      version='4.1.2',
 
      version='4.1.3',
 
      description=('Ennstatus provides the user with vital information about '
 
                   'the status of the organizations Tor servers.'),
 
      author='Frënn vun der Ënn',
 
      author_email='info@enn.lu',
 
      url='https://bitbucket.org/fvde/ennstatus',
 
      license='GPLv3+',
 
      packages=find_packages(),
 
      package_data={'ennstatus': ['static/css/*.css',
 
                                  'static/css/flags/img/png/*.png',
 
                                  'static/css/flags/img/gif/*.gif',
 
                                  'static/css/flags/*.css',
 
                                  'static/files/*',
 
                                  'static/images/*',
 
                                  'static/videos/*',
 
                                  'templates/*.html',
 
                                  'templates/api/export/xml/*.xml',
 
                                  'templates/donate/*.html',
 
                                  'templates/root/*.html',
 
                                  'templates/status/*.html',
 
                                  'templates/stats/*.html',
 
                                  'templates/errorpages/*.html',
 
                                  ]},
 
      install_requires=_get_requirements(),
 
      classifiers=['Development Status :: 5 - Production/Stable',
0 comments (0 inline, 0 general)