LPgenerator/django-db-mailer

Positional argument after keyword argument ?

Closed this issue · 2 comments

send_db_mail( slug='welcome', recipient='user1@example.com', { 'username': request.user.username, 'full_name': request.user.get_full_name(), 'signup_date': request.user.date_joined }, MyModel.objects.get(pk=1) )

The above code should be replaced by below one:

send_db_mail({ 'username': request.user.username, 'full_name': request.user.get_full_name(), 'signup_date': request.user.date_joined }, slug='welcome', recipient='user1@example.com',, MyModel.objects.get(pk=1) )

But gives the error like
db_sender() got multiple values for keyword argument 'slug'

I am using 'os x el capitan

Environment:

Request Method: POST
Request URL: http://127.0.0.1:8000/api_v1/gateways/p/codrequest/

Django Version: 1.8.2
Python Version: 2.7.10

Traceback:
File "/Users/sagar/pvirtualenv/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response

  1.                 response = wrapped_callback(request, _callback_args, *_callback_kwargs)
    
    File "/Users/sagar/pvirtualenv/lib/python2.7/site-packages/django/views/decorators/csrf.py" in wrapped_view
  2.     return view_func(_args, *_kwargs)
    
    File "/Users/sagar/pvirtualenv/lib/python2.7/site-packages/rest_framework/viewsets.py" in view
  3.         return self.dispatch(request, _args, *_kwargs)
    
    File "/Users/sagar/pvirtualenv/lib/python2.7/site-packages/rest_framework/views.py" in dispatch
  4.         response = self.handle_exception(exc)
    
    File "/Users/sagar/pvirtualenv/lib/python2.7/site-packages/rest_framework/views.py" in dispatch
  5.         response = handler(request, _args, *_kwargs)
    
    File "/Users/sagar/pvirtualenv/lib/python2.7/site-packages/rest_framework/mixins.py" in create
  6.     self.perform_create(serializer)
    
    File "/Users/sagar/pvirtualenv/lib/python2.7/site-packages/rest_framework/mixins.py" in perform_create
  7.     serializer.save()
    
    File "/Users/sagar/pvirtualenv/lib/python2.7/site-packages/rest_framework/serializers.py" in save
  8.         self.instance = self.create(validated_data)
    
    File "/Users/sagar/p/p_api/api_v1/serializers.py" in create
  9.         slug='welcome2', recipient='sagarg.1988@gmail.com, sagar.gavli@p.co.in')
    
    File "/Users/sagar/pvirtualenv/lib/python2.7/site-packages/dbmail/init.py" in send_db_mail
  10. return db_sender(_args, *_kwargs)
    

Exception Type: TypeError at /api_v1/gateways/p/codrequest/
Exception Value: db_sender() got multiple values for keyword argument 'slug'

I have given the stack trace above.
Please let me know the solution

All information about non-keyword arg after keyword arg was found here #5

Thanks , Got the issue