Verified Commit 2c740477 authored by Mattia Rizzolo's avatar Mattia Rizzolo

Merge branch 'unify' of salsa.debian.org:lyknode-guest/debexpo into live

Fixes: #5
MR: !41Signed-off-by: Mattia Rizzolo's avatarMattia Rizzolo <mattia@debian.org>
parents 64b5c581 13cebc35
Pipeline #36278 passed with stage
in 3 minutes and 9 seconds
# -*- coding: utf-8 -*-
#
# debexpo-importer — executable script to import new packages
# user_importer.py — executable script to import new users
#
# This file is part of debexpo - https://salsa.debian.org/mentors.debian.net-team/debexpo
#
......@@ -24,7 +24,7 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
""" Executable script to import new packages. """
""" Executable script to import new users. """
__author__ = 'Asheesh Laroia'
__copyright__ = 'Copyright © 2011 Asheesh Laroia'
......
......@@ -97,7 +97,10 @@ class UploadController(BaseController):
log.critical('debexpo.upload.incoming is not writable')
abort(500, 'The incoming directory has not been set up')
save_path = os.path.join(os.path.join(config['debexpo.upload.incoming'], "pub"), filename)
incoming_dir = os.path.join(config['debexpo.upload.incoming'], 'pub')
if not os.path.isdir(incoming_dir):
os.mkdir(incoming_dir)
save_path = os.path.join(incoming_dir, filename)
log.debug('Saving uploaded file to: %s', save_path)
if os.path.exists(save_path):
log.debug("Aborting. File already exists")
......
......@@ -80,6 +80,10 @@ class Email(object):
"""
self.template = template
self.server = pylons.config['global_conf']['smtp_server']
if 'smtp_port' in pylons.config['global_conf']:
self.port = pylons.config['global_conf']['smtp_port']
else:
self.port = smtplib.SMTP_PORT
self.auth = None
# Look whether auth is required.
......@@ -157,8 +161,8 @@ class Email(object):
email.write(message)
def _send_as_mail(self, recipients, message):
log.debug('Starting SMTP session to %s' % self.server)
session = smtplib.SMTP(self.server)
log.debug('Starting SMTP session to %s:%s' % (self.server, self.port))
session = smtplib.SMTP(self.server, self.port)
if self.auth:
log.debug('Authentication requested; logging in')
......
from debexpo.model.data_store import DataStore
DATA_STORE_INIT_OBJECTS = (
DataStore(namespace='_remove_uploads_', code='gmane.linux.debian.devel.changes.unstable', value='249200'),
DataStore(namespace='_remove_uploads_', code='gmane.linux.debian.devel.changes.stable', value='5500'),
DataStore(namespace='_remove_uploads_', code='gmane.linux.debian.backports.changes', value='14000'),
DataStore(namespace='_remove_uploads_', code='gmane.linux.debian.devel.changes.unstable', value='527427'),
DataStore(namespace='_remove_uploads_', code='gmane.linux.debian.devel.changes.stable', value='10836'),
DataStore(namespace='_remove_uploads_', code='gmane.linux.debian.backports.changes', value='37694'),
)
......@@ -79,7 +79,7 @@ tool.
Version : 3.1-4
%endif
Upstream Author : [fill in name and email of upstream]
* URL : [fill in URL of upstreams web site]
* URL : [fill in URL of upstream's web site]
* License : [fill in]
%if c.package:
Section : ${ c.package.package_versions[-1].section }
......
......@@ -4,7 +4,7 @@
Writing cronjobs
================
Writing cronjobs works similar to plugins. The invokation and arguments
Writing cronjobs works similar to plugins. The invocation and arguments
passed are different though.
A minimal cronjob looks like this::
......@@ -29,18 +29,18 @@ The architecture
================
A cronjob should be subclassed from BaseCronjob. That ensure API compliant
invokation. A worker thread runs your jobs cyclically, persistence is guaranteed
invocation. A worker thread runs your jobs cyclically, persistence is guaranteed
for the object runtime. Technically, you ``must`` define two objects in your
module.
Invokation::
Invocation::
cronjob = ImportUpload
schedule = datetime.timedelta(seconds = 10)
The 'cronjob' attribute is an object reference which should be instantiated upon
cronjob invokation. The 'schedule' attribute defines how often your cronjob should
cronjob invocation. The 'schedule' attribute defines how often your cronjob should
invoke your worker method. This must be a datetime.timedelta object. This is a soft
guarantee. The Worker thread will gurantee you not to run the job more often than you
guarantee. The Worker thread will guarantee you not to run the job more often than you
specified, but it will not invoke it precisely for every delta. Your cronjob will not
be invoked if another cronjob is still pending or running once your delta expires.
Additionally the Worker thread does not execute the worker queue more often than every
......@@ -76,7 +76,7 @@ The destructor
Similarly to the constructor, don't override the destructor. Use the `teardown`
method instead
The worker method invokation
The worker method invocation
============================
Implement the `invoke` method as your working horse. It will be called regularly
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment