louking / contracts

1 stars 2 forks source link

nightly tasks tries to send email to services which don't need it #494

Open louking opened 1 month ago

louking commented 1 month ago

Maybe service definition should allow inclusion of automatic tagging to inhibit emails rather than code like https://github.com/louking/contracts/blob/8d9c6e2400ca088e871c87af1eac4ab2ede13e10/scripts/contract_tasks.py#L108

Traceback (most recent call last):
  File "/var/www/[www.contracts.loutilities.com/venv/bin/flask](http://www.contracts.loutilities.com/venv/bin/flask)", line 8, in <module>
    sys.exit(main())
  File "/var/www/[www.contracts.loutilities.com/venv/lib/python3.9/site-packages/flask/cli.py](http://www.contracts.loutilities.com/venv/lib/python3.9/site-packages/flask/cli.py)", line 1105, in main
    cli.main()
  File "/var/www/[www.contracts.loutilities.com/venv/lib/python3.9/site-packages/click/core.py](http://www.contracts.loutilities.com/venv/lib/python3.9/site-packages/click/core.py)", line 1055, in main
    rv = self.invoke(ctx)
  File "/var/www/[www.contracts.loutilities.com/venv/lib/python3.9/site-packages/click/core.py](http://www.contracts.loutilities.com/venv/lib/python3.9/site-packages/click/core.py)", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/var/www/[www.contracts.loutilities.com/venv/lib/python3.9/site-packages/click/core.py](http://www.contracts.loutilities.com/venv/lib/python3.9/site-packages/click/core.py)", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/var/www/[www.contracts.loutilities.com/venv/lib/python3.9/site-packages/click/core.py](http://www.contracts.loutilities.com/venv/lib/python3.9/site-packages/click/core.py)", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/var/www/[www.contracts.loutilities.com/venv/lib/python3.9/site-packages/click/decorators.py](http://www.contracts.loutilities.com/venv/lib/python3.9/site-packages/click/decorators.py)", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/var/www/[www.contracts.loutilities.com/venv/lib/python3.9/site-packages/flask/cli.py](http://www.contracts.loutilities.com/venv/lib/python3.9/site-packages/flask/cli.py)", line 386, in decorator
    return ctx.invoke(f, *args, **kwargs)
  File "/var/www/[www.contracts.loutilities.com/venv/lib/python3.9/site-packages/click/core.py](http://www.contracts.loutilities.com/venv/lib/python3.9/site-packages/click/core.py)", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/var/www/[www.contracts.loutilities.com/contracts/contracts/scripts/contract_tasks.py](http://www.contracts.loutilities.com/contracts/contracts/scripts/contract_tasks.py)", line 137, in preraceemail
    cclist = app.config['CONTRACTS_CC'] + [event.lead.email]
AttributeError: 'NoneType' object has no attribute 'email'

also

Traceback (most recent call last):
  File "/var/www/[www.contracts.loutilities.com/venv/bin/flask](http://www.contracts.loutilities.com/venv/bin/flask)", line 8, in <module>
    sys.exit(main())
  File "/var/www/[www.contracts.loutilities.com/venv/lib/python3.9/site-packages/flask/cli.py](http://www.contracts.loutilities.com/venv/lib/python3.9/site-packages/flask/cli.py)", line 1105, in main
    cli.main()
  File "/var/www/[www.contracts.loutilities.com/venv/lib/python3.9/site-packages/click/core.py](http://www.contracts.loutilities.com/venv/lib/python3.9/site-packages/click/core.py)", line 1055, in main
    rv = self.invoke(ctx)
  File "/var/www/[www.contracts.loutilities.com/venv/lib/python3.9/site-packages/click/core.py](http://www.contracts.loutilities.com/venv/lib/python3.9/site-packages/click/core.py)", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/var/www/[www.contracts.loutilities.com/venv/lib/python3.9/site-packages/click/core.py](http://www.contracts.loutilities.com/venv/lib/python3.9/site-packages/click/core.py)", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/var/www/[www.contracts.loutilities.com/venv/lib/python3.9/site-packages/click/core.py](http://www.contracts.loutilities.com/venv/lib/python3.9/site-packages/click/core.py)", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/var/www/[www.contracts.loutilities.com/venv/lib/python3.9/site-packages/click/decorators.py](http://www.contracts.loutilities.com/venv/lib/python3.9/site-packages/click/decorators.py)", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/var/www/[www.contracts.loutilities.com/venv/lib/python3.9/site-packages/flask/cli.py](http://www.contracts.loutilities.com/venv/lib/python3.9/site-packages/flask/cli.py)", line 386, in decorator
    return ctx.invoke(f, *args, **kwargs)
  File "/var/www/[www.contracts.loutilities.com/venv/lib/python3.9/site-packages/click/core.py](http://www.contracts.loutilities.com/venv/lib/python3.9/site-packages/click/core.py)", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/var/www/[www.contracts.loutilities.com/contracts/contracts/scripts/contract_tasks.py](http://www.contracts.loutilities.com/contracts/contracts/scripts/contract_tasks.py)", line 217, in leademail
    tolist = event.lead.email
AttributeError: 'NoneType' object has no attribute 'email'