Skip to content

Commit

Permalink
add sentry 10 support
Browse files Browse the repository at this point in the history
  • Loading branch information
tsl0922 committed Jul 23, 2020
1 parent e716b68 commit 9a43391
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 8 deletions.
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ Plugin for [Sentry](https://github.com/getsentry/sentry) which allows sending no

## Installation

> NOTE: sentry > 9.1.2 is not supported.
### Prepare

Install the plugin:
Expand All @@ -24,15 +22,15 @@ On (Legacy) Integrations page, find `WeChat Work`, enable and configure it.

Add the following settings to your `sentry.conf.py`:

```
```python
WXWORK_CORP_ID = ''
WXWORK_SECRET = ''
WXWORK_AGENT_ID = ''
```

or, if you prefer setting it via environment variables:

```
```python
if 'WXWORK_CORP_ID' in os.environ:
WXWORK_CORP_ID = env('WXWORK_CORP_ID')
WXWORK_SECRET = env('WXWORK_SECRET')
Expand Down
10 changes: 7 additions & 3 deletions auth_wxwork/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@
"""
from __future__ import absolute_import

from sentry.auth import register
from django import VERSION as DJANGO_VERSION

from .provider import WxWorkAuthProvider
if DJANGO_VERSION >= (1, 7):
default_app_config = "auth_wxwork.apps.Config"
else:
from sentry.auth import register
from .provider import WxWorkAuthProvider

register('wxwork', WxWorkAuthProvider)
register('wxwork', WxWorkAuthProvider)
13 changes: 13 additions & 0 deletions auth_wxwork/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from __future__ import absolute_import

from django.apps import AppConfig

class Config(AppConfig):
name = "sentry_wxwork"

def ready(self):
from sentry.auth import register

from .provider import WxWorkAuthProvider

register("wxwork", WxWorkAuthProvider)
2 changes: 1 addition & 1 deletion sentry_wxwork/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class WxworkNotificationsOptionsForm(notify.NotificationConfigurationForm):
widget=forms.Textarea(attrs={'class': 'span4'}),
help_text=_('Set in standard python\'s {}-format convention, available names are: '
'{project_name}, {url}, {title}, {message}, {tag[%your_tag%]}'),
initial='**{project_name}** [{tag[level]}: {title}]({url})\n\n> {message}'
initial='**[{project_name}]** [{tag[level]}: {title}]({url})\n\n> {message}'
)

class WxworkNotificationsPlugin(notify.NotificationPlugin):
Expand Down

0 comments on commit 9a43391

Please sign in to comment.