Re: [Mailman-Developers] REST returns 405 to PATCH in development environment.

2016-10-19 Thread Barry Warsaw
On Oct 18, 2016, at 10:11 PM, Mark Sapiro wrote:

>I get it and I will fix.
>
>I also note that in my production installs (current branch heads)
>Postorius can't edit a domain for the same reason. That's what threw me
>off as I assumed editing a domain worked in general and just not in my
>development environment.
>
>I'll create an issue and a MR to fix it, but probably not until tomorrow
>evening or Thurs.

Cool, no worries.  My huge unsub-workflow branch is nearly ready to land,
which will remove the bottleneck on core.

One thing to keep in mind though is that not all attributes of the domain
resource are writable.  `description` should be of course, and if you look in
the model, domains also have an `owners` attribute that's not currently
included in the GET.  If it were, that should be writable too, as well as your
new `alias_domain` attribute.

But `mail_host` should be read-only.

Cheers,
-Barry
___
Mailman-Developers mailing list
Mailman-Developers@python.org
https://mail.python.org/mailman/listinfo/mailman-developers
Mailman FAQ: http://wiki.list.org/x/AgA3
Searchable Archives: 
http://www.mail-archive.com/mailman-developers%40python.org/
Unsubscribe: 
https://mail.python.org/mailman/options/mailman-developers/archive%40jab.org

Security Policy: http://wiki.list.org/x/QIA9


Re: [Mailman-Developers] REST returns 405 to PATCH in development environment.

2016-10-18 Thread Mark Sapiro
On 10/18/2016 08:02 AM, Barry Warsaw wrote:
> 
> The way Falcon works is that you need an on_() method for every HTTP
> METHOD that a resource implements.  If you look at the ADomain class (or the
> _DomainBase base class), it only implements an on_get() and an on_delete(),
> but no on_put() or on_patch().  So when you try to invoke PUT or PATCH on a
> domain resource, you get a 405, i.e. Method Not Allowed.
> 
> And afaict, your MR doesn't an on_patch().


Thanks Barry,

I get it and I will fix.

I also note that in my production installs (current branch heads)
Postorius can't edit a domain for the same reason. That's what threw me
off as I assumed editing a domain worked in general and just not in my
development environment.

I'll create an issue and a MR to fix it, but probably not until tomorrow
evening or Thurs.

-- 
Mark Sapiro The highway is for gamblers,
San Francisco Bay Area, Californiabetter use your sense - B. Dylan
___
Mailman-Developers mailing list
Mailman-Developers@python.org
https://mail.python.org/mailman/listinfo/mailman-developers
Mailman FAQ: http://wiki.list.org/x/AgA3
Searchable Archives: 
http://www.mail-archive.com/mailman-developers%40python.org/
Unsubscribe: 
https://mail.python.org/mailman/options/mailman-developers/archive%40jab.org

Security Policy: http://wiki.list.org/x/QIA9


Re: [Mailman-Developers] REST returns 405 to PATCH in development environment.

2016-10-18 Thread Barry Warsaw
On Oct 17, 2016, at 07:23 PM, Mark Sapiro wrote:

>It all seems to work except editing. I can create a domain with or
>without an alias_domain, see it all listed and delete the domain, but
>any attempts at editing the domain fail with the core REST server
>returning 405 to the PATCH request. Even if I stash my changes and
>revert to the branch head, edits fail in the same way.

Hi Mark.

The way Falcon works is that you need an on_() method for every HTTP
METHOD that a resource implements.  If you look at the ADomain class (or the
_DomainBase base class), it only implements an on_get() and an on_delete(),
but no on_put() or on_patch().  So when you try to invoke PUT or PATCH on a
domain resource, you get a 405, i.e. Method Not Allowed.

And afaict, your MR doesn't an on_patch().

It's a bit more work to implement PUT and PATCH, so not every resource
currently supports it.  There are several examples in the code though, and
often on_put() and on_patch() differ only in the set of required attributes.
By definition, PUT requires a complete resource and PATCH allows for partial
resources.  Take a look at ListArchivers in rest/lists.py for an example.

Cheers,
-Barry
___
Mailman-Developers mailing list
Mailman-Developers@python.org
https://mail.python.org/mailman/listinfo/mailman-developers
Mailman FAQ: http://wiki.list.org/x/AgA3
Searchable Archives: 
http://www.mail-archive.com/mailman-developers%40python.org/
Unsubscribe: 
https://mail.python.org/mailman/options/mailman-developers/archive%40jab.org

Security Policy: http://wiki.list.org/x/QIA9


[Mailman-Developers] REST returns 405 to PATCH in development environment.

2016-10-17 Thread Mark Sapiro
I'm sure there's something wrong with what I'm doing, but I have the
following issue.

I am developing/testing a change to Postorius to support alias_domain as
implemented by 
and .

I made some changes to

postorius/forms.py
postorius/templates/postorius/domain/index.html
postorius/views/domain.py

to support displaying and setting alias domain. I have a development
environment with Python 2 and Python 3 virtualenvs with all the pieces
installed via 'python setup.py develop' in the appropriate venv.

I am running Mailman core via '.tox/py35/bin/mailman start' with (I
think) an appropriate mailman.cfg and running Postorius in the Python 2
venv via 'example_project/manage.py runserver' and connecting to
Postorius via http://localhost:8000.

It all seems to work except editing. I can create a domain with or
without an alias_domain, see it all listed and delete the domain, but
any attempts at editing the domain fail with the core REST server
returning 405 to the PATCH request. Even if I stash my changes and
revert to the branch head, edits fail in the same way.

Does anyone know what I'm missing/doing wrong?

-- 
Mark Sapiro The highway is for gamblers,
San Francisco Bay Area, Californiabetter use your sense - B. Dylan
___
Mailman-Developers mailing list
Mailman-Developers@python.org
https://mail.python.org/mailman/listinfo/mailman-developers
Mailman FAQ: http://wiki.list.org/x/AgA3
Searchable Archives: 
http://www.mail-archive.com/mailman-developers%40python.org/
Unsubscribe: 
https://mail.python.org/mailman/options/mailman-developers/archive%40jab.org

Security Policy: http://wiki.list.org/x/QIA9