On 8/4/26 4:59 PM, iMark wrote:
(venv) mailman@lon:/home/sysmin$ mailman shell -l [email protected]
Welcome to the GNU Mailman shell
Use commit() to commit changes.
Use abort() to discard changes since the last commit.
Exit with ctrl+D does an implicit commit() but exit() does not.
The variable 'm' is the [email protected] mailing list
from mailman.interfaces.member import DeliveryMode
for member in m.subscribers:
... member.delivery_mode = DeliveryMode.plaintext_digests
...
After the first ellipsis I entered a tab, then "member.delivery_mode =
DeliveryMode.plaintext_digests"
Without the tab, I get the "IndentationError". With the tab, the line
moves on to the next ellipsis.
What does the ellipsis signify ?
In Python, block structure is defined by indentation which is critical.
In interactive mode, a `>>> ` prompt indicates you are at the outer
level and a `... ` prompt indicates you are in a block.
There are a few issues with yours and with Steve's original. From the
original,
```
for member in m.subscribers:
```
is wrong. It needs to be
```
for member in m.subscribers.members:
```
`subscribers` is a roster whose members are all members and nonmembers.
You may want that, although since nonmembers don't get mail it's
probably better to use the `members` roster which is only members and
not nonmembers.
Also, you left out
```
if member.delivery_mode != DeliveryMode.regular:
```
which skips members with regular delivery which you don't want to set to
digest.
The complete interaction should look like
```
>>> for member in m.members.members:
... if member.delivery_mode != DeliveryMode.regular:
... member.delivery_mode = DeliveryMode.plaintext_digests
...
>>> commit()
```
The `from mailman.interfaces.member import DeliveryMode` is not needed n
mailman shell in interactive mode, although it wouldn't hurt.
Note the above indentation which is critical. I've used 4 and 8 spaces,
but 1 and 2 tabs would also work.
--
Mark Sapiro <[email protected]> The highway is for gamblers,
San Francisco Bay Area, California better use your sense - B. Dylan
_______________________________________________
Mailman-users mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://lists.mailman3.org/mailman3/lists/mailman-users.mailman3.org/
Archived at:
https://lists.mailman3.org/archives/list/[email protected]/message/VE5RWEG62C6HAKGRDJPF73DBG3DY6D7Y/
This message sent to [email protected]