gvacommon/gvacommon/celeryrouters.py
Jan Dittberner 8dda40a363 Make gvacommon distributable
This commit performs a lot of changes to make gvacommon properly
distributable:

- add a setup.py
- move code into a module directory
- add a __version__
- add a README.rst and AGPLv3 license file (COPYING)
- specify the licensing in file headers
- move tests into a submodule of gvacommon and split tests for different
  modules into separate test modules
- get rid of django-braces dependency
- adapt setup.cfg to the new directory structure
- ignore build and dist directories
2016-01-29 13:40:12 +01:00

32 lines
1.1 KiB
Python

#
# gvacommon - common parts of gnuviechadmin
# Copyright (C) 2015-2016 Jan Dittberner
#
# This program 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.
#
# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
#
from __future__ import unicode_literals
class GvaRouter(object):
def route_for_task(self, task, args=None, kwargs=None):
for route in ['ldap', 'file', 'mysql', 'pgsql', 'web']:
if route in task:
return {
'exchange': route,
'exchange_type': 'direct',
'queue': route,
}
return None