Skip to content

Commit

Permalink
black
Browse files Browse the repository at this point in the history
  • Loading branch information
cekk committed May 14, 2024
1 parent 642c05a commit 34663a7
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 19 deletions.
1 change: 0 additions & 1 deletion src/rer/newsletter/browser/message/messageviewlet.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@


class MessageManagerViewlet(ViewletBase):

def render(self):
return self.index()
4 changes: 1 addition & 3 deletions src/rer/newsletter/browser/message/sendmessageview.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ def channel(self):
@property
@memoize
def active_subscriptions(self):
channel = getMultiAdapter(
(self.channel, self.request), IChannelSubscriptions
)
channel = getMultiAdapter((self.channel, self.request), IChannelSubscriptions)
return channel.active_subscriptions

@button.buttonAndHandler(_("send_sendingview", default="Send"))
Expand Down
1 change: 0 additions & 1 deletion src/rer/newsletter/content/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

@implementer(IChannel)
class Channel(Folder):

def active_subscriptions(self):
channel = getMultiAdapter((self, self.REQUEST), IChannelSubscriptions)
return channel.active_subscriptions
9 changes: 2 additions & 7 deletions src/rer/newsletter/content/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@

@implementer(IMessage)
class Message(Folder):

def get_channel(self):
for parent in aq_chain(self):
if isinstance(parent, Channel):
Expand All @@ -55,9 +54,7 @@ def can_send_message(self):

if api.content.get_state(obj=self) != "published":
return False
return api.user.get_permissions(obj=self).get(
"rer.newsletter: Send Newsletter"
)
return api.user.get_permissions(obj=self).get("rer.newsletter: Send Newsletter")

def message_already_sent(self):
history = ContentHistoryView(self, self.REQUEST).fullHistory()
Expand Down Expand Up @@ -104,9 +101,7 @@ def send_preview(self, email):

sender = compose_sender(channel=channel)

nl_subject = (
" - " + channel.subject_email if channel.subject_email else ""
)
nl_subject = " - " + channel.subject_email if channel.subject_email else ""

subject = "Messaggio di prova - " + self.title + nl_subject
# per mandare la mail non passo per l'utility
Expand Down
8 changes: 2 additions & 6 deletions src/rer/newsletter/restapi/services/message_actions/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ def __call__(self, expand=True):
return {}
result = {
"message-actions": {
"@id": "{}/@message-actions".format(
self.context.absolute_url()
)
"@id": "{}/@message-actions".format(self.context.absolute_url())
}
}

Expand All @@ -33,9 +31,7 @@ def __call__(self, expand=True):

result["message-actions"]["can_manage"] = can_manage
result["message-actions"]["can_send"] = can_send
result["message-actions"][
"already_sent"
] = self.context.message_already_sent()
result["message-actions"]["already_sent"] = self.context.message_already_sent()
result["message-actions"][
"active_subscriptions"
] = self.context.active_subscriptions()
Expand Down
1 change: 0 additions & 1 deletion src/rer/newsletter/restapi/services/message_send/post.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

class MessageSendPost(Service):
def reply(self):

self.validate_token()
# Disable CSRF protection
alsoProvides(self.request, IDisableCSRFProtection)
Expand Down

0 comments on commit 34663a7

Please sign in to comment.