GithubHelp home page GithubHelp logo

prologin / django-massmailer Goto Github PK

View Code? Open in Web Editor NEW
17.0 17.0 2.0 1.26 MB

A standalone Django app to send templated emails in batch. Features a custom query engine and template editor with preview

Home Page: https://gitlab.com/prologin/tech/packages/django-massmailer

License: GNU General Public License v3.0

Python 66.82% CSS 1.24% JavaScript 11.37% HTML 19.54% Shell 0.57% Makefile 0.46%

django-massmailer's People

Contributors

audebert avatar cafehaine avatar cc618 avatar fnareoh avatar remi-dupre avatar seirl avatar zopieux avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

ne018 cc618

django-massmailer's Issues

Tests show `warn_ungrouped_named_tokens_in_collection` warnings

django-massmailer/massmailer/query_parser.py:307: UserWarning: warn_ungrouped_named_tokens_in_collection: setting results name '=' on And expression collides with 'value' on contained expression
  equality = (field + p.Suppress('=') + value).setResultsName('=')
django-massmailer/massmailer/query_parser.py:308: UserWarning: warn_ungrouped_named_tokens_in_collection: setting results name '!=' on And expression collides with 'value' on contained expression
  inequality = (field + p.Suppress('!=') + value).setResultsName('!=')
django-massmailer/massmailer/query_parser.py:309: UserWarning: warn_ungrouped_named_tokens_in_collection: setting results name '<' on And expression collides with 'value' on contained expression
  lt = (field + p.Suppress('<') + value).setResultsName('<')
django-massmailer/massmailer/query_parser.py:310: UserWarning: warn_ungrouped_named_tokens_in_collection: setting results name '<=' on And expression collides with 'value' on contained expression
  lte = (field + p.Suppress('<=') + value).setResultsName('<=')
django-massmailer/massmailer/query_parser.py:311: UserWarning: warn_ungrouped_named_tokens_in_collection: setting results name '>' on And expression collides with 'value' on contained expression
  gt = (field + p.Suppress('>') + value).setResultsName('>')
django-massmailer/massmailer/query_parser.py:312: UserWarning: warn_ungrouped_named_tokens_in_collection: setting results name '>=' on And expression collides with 'value' on contained expression
  gte = (field + p.Suppress('>=') + value).setResultsName('>=')
django-massmailer/massmailer/query_parser.py:322: UserWarning: warn_ungrouped_named_tokens_in_collection: setting results name 'value' on And expression collides with 'nocase' on contained expression
  + string.setResultsName('value')
django-massmailer/massmailer/query_parser.py:322: UserWarning: warn_ungrouped_named_tokens_in_collection: setting results name 'value' on And expression collides with 'string' on contained expression
  + string.setResultsName('value')
django-massmailer/massmailer/query_parser.py:323: UserWarning: warn_ungrouped_named_tokens_in_collection: setting results name 'contains' on And expression collides with 'value' on contained expression
  ).setResultsName('contains')
django-massmailer/massmailer/query_parser.py:328: UserWarning: warn_ungrouped_named_tokens_in_collection: setting results name 'value' on And expression collides with 'nocase' on contained expression
  + string.setResultsName('value')
django-massmailer/massmailer/query_parser.py:328: UserWarning: warn_ungrouped_named_tokens_in_collection: setting results name 'value' on And expression collides with 'string' on contained expression
  + string.setResultsName('value')
django-massmailer/massmailer/query_parser.py:329: UserWarning: warn_ungrouped_named_tokens_in_collection: setting results name 'startswith' on And expression collides with 'value' on contained expression
  ).setResultsName('startswith')
django-massmailer/massmailer/query_parser.py:334: UserWarning: warn_ungrouped_named_tokens_in_collection: setting results name 'value' on And expression collides with 'nocase' on contained expression
  + string.setResultsName('value')
django-massmailer/massmailer/query_parser.py:334: UserWarning: warn_ungrouped_named_tokens_in_collection: setting results name 'value' on And expression collides with 'string' on contained expression
  + string.setResultsName('value')
django-massmailer/massmailer/query_parser.py:335: UserWarning: warn_ungrouped_named_tokens_in_collection: setting results name 'endswith' on And expression collides with 'value' on contained expression
  ).setResultsName('endswith')
django-massmailer/massmailer/query_parser.py:340: UserWarning: warn_ungrouped_named_tokens_in_collection: setting results name 'value' on And expression collides with 'nocase' on contained expression
  + string.setResultsName('value')
django-massmailer/massmailer/query_parser.py:340: UserWarning: warn_ungrouped_named_tokens_in_collection: setting results name 'value' on And expression collides with 'string' on contained expression
  + string.setResultsName('value')
django-massmailer/massmailer/query_parser.py:341: UserWarning: warn_ungrouped_named_tokens_in_collection: setting results name 'matches' on And expression collides with 'value' on contained expression
  ).setResultsName('matches')
django-massmailer/massmailer/query_parser.py:349: UserWarning: warn_ungrouped_named_tokens_in_collection: setting results name 'between' on And expression collides with 'max' on contained expression
  ).setResultsName('between')
django-massmailer/.venv/lib/python3.7/site-packages/pyparsing.py:1474: UserWarning: warn_ungrouped_named_tokens_in_collection: setting results name 'comparison' on MatchFirst expression collides with 'matches' on contained expression
  return self._setResultsName(name, listAllMatches)

Proper handling of permissions

We can't just assume everyone will want the same rules.py. I think we should remove the django-rules dependency, and do everything with standard Django permissions (like massmailer.edit_batch etc). Then in our websites we can define these permissions through django-rules.

Celery error when using rabbitmq as broker

[2020-10-30 18:02:56,696: INFO/ForkPoolWorker-2] Task massmailer.tasks.send_email[massmailer-aeaa2e15-a1b6-4e78-8317-253a7f21654a] retry: Retry in 60s: TypeError("Object of type 'UUID' is not JSON serializable",)
[2020-10-30 18:02:56,698: INFO/MainProcess] Received task: massmailer.tasks.send_email[massmailer-aeaa2e15-a1b6-4e78-8317-253a7f21654a]  ETA:[2020-10-30 18:03:56.694045+00:00] 
[2020-10-30 18:03:56,843: WARNING/ForkPoolWorker-2] Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: Hi [email protected]
From: webmaster@localhost
To: [email protected]
Date: Fri, 30 Oct 2020 18:03:56 -0000
Message-ID: <160408103684.2439.2899414189599422213@ubuntu-bionic>
X-MID: aeaa2e15-a1b6-4e78-8317-253a7f21654a

Hello this is a test
[2020-10-30 18:03:56,843: WARNING/ForkPoolWorker-2] -------------------------------------------------------------------------------
[2020-10-30 18:03:56,861: ERROR/ForkPoolWorker-2] Task massmailer.tasks.send_email[massmailer-aeaa2e15-a1b6-4e78-8317-253a7f21654a] raised unexpected: TypeError("Object of type 'UUID' is not JSON serializable",)
Traceback (most recent call last):
  File "/home/vagrant/.local/lib/python3.6/site-packages/celery/app/trace.py", line 409, in trace_task
    R = retval = fun(*args, **kwargs)
  File "/home/vagrant/.local/lib/python3.6/site-packages/celery/app/trace.py", line 701, in __protected_call__
    return self.run(*args, **kwargs)
  File "/home/vagrant/.local/lib/python3.6/site-packages/massmailer/tasks.py", line 51, in send_email
    raise self.retry(exc=exc)
  File "/home/vagrant/.local/lib/python3.6/site-packages/celery/app/task.py", line 701, in retry
    raise_with_context(exc)
  File "/home/vagrant/.local/lib/python3.6/site-packages/massmailer/tasks.py", line 39, in send_email
    ret = python_mail.send(fail_silently=False)
  File "/home/vagrant/.local/lib/python3.6/site-packages/django/core/mail/message.py", line 284, in send
    return self.get_connection(fail_silently).send_messages([self])
  File "/home/vagrant/.local/lib/python3.6/site-packages/sendgrid_backend/mail.py", line 129, in send_messages
    resp = self.sg.client.mail.send.post(request_body=data)
  File "/home/vagrant/.local/lib/python3.6/site-packages/python_http_client/client.py", line 257, in http_request
    data = json.dumps(request_body).encode('utf-8')
  File "/usr/lib/python3.6/json/__init__.py", line 231, in dumps
    return _default_encoder.encode(obj)
  File "/usr/lib/python3.6/json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib/python3.6/json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File "/usr/lib/python3.6/json/encoder.py", line 180, in default
    o.__class__.__name__)
TypeError: Object of type 'UUID' is not JSON serializable

It's working when im using simple custom task with send_mail but when sending batch mail from massmailer, it persist.

Preview not working

I'm currently using Django version 3.1.2,

and i want to integrate the django-massmailer but Preview not working in creating template. Please help.

Add more unit tests

  • query_parser
  • adding, editing a template
  • adding, editing a query
  • template rendering
  • query execution
  • sending a batch
  • actual batch mail sending with Celery & SMTP
  • batch mail retry with Celery & SMTP

django-massmailer==0.6 incompatible to jinja2==3.1.2 (no attribute contextfilter)

When running site/prologin/manage.py runserver with django-massmailer==0.6 and jinja2==3.1.2.
An error is thrown when importing django :

    from massmailer.utils import get_attr_rec, get_field_rec, filters as mfilters
  File "/prologin/site/.venv/lib/python3.10/site-packages/massmailer/utils/filters.py", line 11, in <module>
    @jinja2.contextfilter
AttributeError: module 'jinja2' has no attribute 'contextfilter'

Due to contextfilter which as been renamed to pass_context in newer jinja2 versions.
Note that a newer version of django-massmailer exists but the error is still present.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.