mozilla / django-tidings Goto Github PK
View Code? Open in Web Editor NEWLibrary for watching and rolling up events and sending email notifications in response
License: BSD 3-Clause "New" or "Revised" License
Library for watching and rolling up events and sending email notifications in response
License: BSD 3-Clause "New" or "Revised" License
Python 2.7 is no longer supported, and Django 1.11 leaves extended support in April 2020. django-tidings
should drop support for both in the next major release.
django-tidings
has two known users:
With django-tidings 2.0, calling EventUnion.fire
raised an exception when loaded by Celery:
TypeError: __protected_call__() got multiple values for keyword argument 'self'
File "celery/app/trace.py", line 240, in trace_task
R = retval = fun(*args, **kwargs)
File "newrelic/hooks/application_celery.py", line 84, in wrapper
return wrapped(*args, **kwargs)
This appears to be caused by passing self
in the kwargs
, but self
is implied as a class member:
{
'exclude': <User: username>,
'self': <tidings.events.EventUnion object at 0xdeadbeef>
}
…rather than just inside some other Django app.
As of January 1 2019, Mozilla requires that all GitHub projects include this CODE_OF_CONDUCT.md file in the project root. The file has two parts:
If you have any questions about this file, or Code of Conduct policies and procedures, please reach out to [email protected].
(Message COC001)
Jingo, an adapter for using Jinja2 templates in Django, is deprecated and will not support Django 1.9 or above. I see a few options. Here they are ordered from my top to bottom preference:
jinja2
folder, .html
extension)templates/
folder with .jinja
extension).I also like django-allauth's solution (partially implemented?) of a ACCOUNT_TEMPLATE_EXTENSION, which will allow users change the templates to .jinja2
, .j2
, etc. This would make it easier to support django-jinja
in different configurations without rewriting the unsubscribe
view.
For instance, on support.mozilla.com, we need to be able to exclude both the revision creator and the approver from the wiki-revision-approved notification. (The creator gets notified separately and regardless of whether he had an applicable Watch or not.)
We're using the users() test helper at the moment.
I would like to be able to release the current master to PyPI. I need an existing owner of django-tidings on PyPI to add John.Whitlock to the owners or maintainers lists.
My plans are:
We're opening this issue because your project has used Travis CI within the last 6 months. If you have already migrated off it, you can close and ignore this issue.
Travis CI is ending free builds on public repositories. travis-ci.com stopped providingthem in early November, and travis-ci.org will stop after December 31, 2020. To avoid disruptions to your workflows, you must migrate to another CI service.
For production use cases, we recommend switching to CircleCI. This service is already widely used within Mozilla. There is a guide to migrating from Travis CI to CircleCI available here.
For non production use cases, we recommend either CircleCI or Github Actions. There is a guide to migrating from Travis CI to Github Actions available here. Github Actions usage within Mozilla is new, and you will have to work with our github administrators to enable specific actions following this process.
If you have any questions, reach out in #github-admin:mozilla.org
on matrix.
The documentation is no longer updating on merges to master:
https://django-tidings.readthedocs.io/en/latest/
A RTD admin needs to enable the integration:
and then a GitHub admin needs to setup the web hook.
The maximum email length is 254:
http://stackoverflow.com/questions/386294/what-is-the-maximum-length-of-a-valid-email-address
Since Django 1.8, the EmailField defaults to 254:
It would be nice to be able to prune old watches, and to have that we need a created column, or some other method. We could just make the management command take an ID, and prune all the unconfirmed watches below that.
Atm, docs, LICENSE, and README aren't getting included in the egg. Fix that.
Stick a metaclass on Events to register them. Then we can move things like Event.description_of_watch(watch) onto Watch itself, a more natural spelling. It also gives us a more natural way to test what Event a Watch coming out of an EventUnion refers to.
It appears that something changed in the order of the fields/columns in the results for SQL queries.
Event._users_watching_by_filter
does a query that starts with SELECT u.*, w.* ...
. That query gets passed to multi_raw
which returns the users with the field values all scrambled. For example:
ipdb> user.__dict__
{'username': u'[email protected]', 'first_name': u'sha256$f538347e82$5098e89186fd307d4bb6fe29ac476e72cf96175617fa933a9bd6b3d89a8b0946', 'last_name': 1, 'is_active': datetime.datetime(2014, 1, 13, 13, 4, 8), '_state': <django.db.models.base.ModelState object at 0x10ded8e10>, 'email': 1, 'is_superuser': u'', 'is_staff': 1, 'last_login': u'', 'password': u'rrosario', 'id': 179845L, 'date_joined': datetime.datetime(2010, 6, 9, 11, 4, 8)}
Having them inside the app means using even a clueful testrunner like django-nose will run tidings' tests unnecessarily when it's installed as part of a larger project.
This codebase was primarily used by two Mozilla projects:
It appears in several branches, which all appear to be forks of kuma
or kitsune
.
That way, the confirmation email can say "Really start watching all English edits?" without running a dictionary attack against the hash of "en-US". :-)
Kuma is updating to Django 1.11, and django-tidings
needs an update to support it. Here's my plan for the next django-tidings
release:
EmailField
(see #26)jingo
and convert the unsubscribe
templates to Django-style templates (see #32)django-celery
, and add new task functions that can be serialized with JSON (see #33)TEMPLATE_DEBUG
into TEMPLATES
, drop patterns
, etc.).on_delete
strategiesUser.is_anonymous
as a property instead of a function.I'm new to semantic versioning, so I'm not sure if that is a point release to 1.3 or a breaking 2.0 release. My inclination is 1.3. Update: I'm convinced, it will be a 2.0 release
Tidings imports collections.Sequence
instead of collections.abc.Sequence
, which raises a DeprecationWarning
/usr/local/lib/python3.8/site-packages/tidings/events.py:1: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.9 it will stop working
I'll toss a PR your way later today.
...rather than just an arbitrary one after the deduplication. 2 motivations:
Celery 4.x has a lot of changes. The ones that impact this project:
celery upgrade settings proj/settings.py --django
can automatically update CELERY_ALWAYS_EAGER
to CELERY_TASK_ALWAYS_EAGER
, etc.pickle
as the default serializer. pickle
is still supported, but requires enabling it (CELERY_TASK_SERIALIZER
, CELERY_RESULT_SERIALIZER
, CELERY_ACCEPT_CONTENT
). Switching away from pickle
will require moving from class methods like Event.fire
to a separate task function like fire_event
, and adding serialization / deserialization methods.My proposal is to break this into two releases:
django-celery
, and provides both the class-based pickle
-using tasks, and new task functions that use JSON. Add deprecation warnings when the pickle
versions are used. Users can update to this version, and convert their code to use the new task functions.Somewhere we can pass a callable or something to, in our case, notify statsd that we've sent out notifications.
It would be very useful to be able to search for notifications in the admin by username or email address.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.