Commit b4041d26 authored by Anthony Monthe's avatar Anthony Monthe

1st commit

parents
tellme_trello.egg-info/
*.py[co]
*.sw[pon]
=============
Tellme Trello
=============
Plugin to send django-tellme notification as Trello card.
#!/usr/bin/env python
from setuptools import setup, find_packages
import tellme_trello
def read_file(name):
with open(name) as fd:
return fd.read()
keywords = ['django', 'web', 'html']
setup(
name='tellme-trello',
version=tellme_trello.__version__,
description=tellme_trello.__doc__,
long_description=read_file('README.rst'),
author=tellme_trello.__author__,
author_email=tellme_trello.__email__,
license=tellme_trello.__license__,
url=tellme_trello.__url__,
keywords=keywords,
packages=find_packages(exclude=[]),
include_package_data=True,
classifiers=[
'Development Status :: 4 - Beta',
'Environment :: Web Environment',
'Environment :: Console',
'Framework :: Django',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
],
)
"""Trello plugin-in for django-tellme"""
VERSION = (0, 1)
__version__ = '.'.join([str(i) for i in VERSION])
__author__ = 'Anthony Monthe (ZuluPro)'
__email__ = 'anthony.monthe@gmail.com'
__license__ = 'BSD'
__url__ = 'https://gitlab.com/ZuluPro/tellme-trello'
from trello import TrelloClient
from tellme_trello import settings
def get_client():
client = TrelloClient(
api_key=settings.API_KEY,
api_secret=settings.API_SECRET,
token=settings.TOKEN,
token_secret=settings.TOKEN_SECRET)
return client
import warnings
from django.template.defaultfilters import truncatechars
from django.utils.translation import ugettext_lazy as _
from tellme_trello import settings
from tellme_trello.client import get_client
def create_ticket(request, feedback, fail_silently=True):
try:
client = get_client()
list_ = client.get_list(settings.LIST_ID)
card = list_.add_card(
name=truncatechars(feedback.comment, 200),
desc=feedback.comment)
card.attach(
name='screenshot.png',
mimeType='image/png',
file=feedback.screenshot.file)
except Exception as err:
if not fail_silently:
raise
warnings.warn("Trello notification doesn't work: %s" % err)
from django.conf import settings, ImproperlyConfigured
def get(setting, default=None):
key = 'TELLME_%s' % setting
value = getattr(settings, key, default)
return value
API_KEY = get('API_KEY')
API_SECRET = get('API_SECRET')
TOKEN = get('TOKEN')
TOKEN_SECRET = get('TOKEN_SECRET')
LIST_ID = get('LIST_ID')
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