markqvist/LXMF

LXMessage SetX functions (was: SetSource/Destination) not functioning as intended

faragher opened this issue · 3 comments

When attempting to set a message's source or destination, for example (L is an LXMessage):

  L.set_destination(lxmf_destination)
  L.set_source(self.server_lxmf_delivery)

then attempting to use handle_outbound(L) results in the following:

  [Error] Error occurred while handling request. The contained exception was: 'LXMessage' object has no attribute 'destination'

Setting them improperly, eg:

  L.destination = lxmf_destination
  L.source = self.server_lxmf_delivery

avoids this error (but fails elsewhere with a nonetype not having hash). It seems likely this is related to the destination vs __destination discussion I saw elsewhere.

Is this an issue with a rarely used function or am I missing a step? It won't send or pack and the way the exceptions are wrapped means I'll have to walk through the code to find the specific error line or further troubleshoot.

Similar, likely related strangeness:

     LN = LXMF.LXMessage(
        lxmf_destination, 
        self.server_lxmf_delivery, 
        "",  
        fields = L.fields,
        desired_method=LXMF.LXMessage.DIRECT
      )
      print(L.content)
      print(L.title)
      LN.set_content_from_bytes = L.content
      LN.set_title_from_bytes = L.title
      LN.pack()
      print(LN.content)
      print(LN.title)

results in:

b'This is a POPR test message'
b'Hello, there'
b''
b''

Removing the pack() call results in the same. Message sends properly but does not contain any title or content. Looking at LXMessage, I'm not sure why this doesn't seem to work. The packing doesn't raise an error, so it doesn't appear to be already packed.

      LN.content = L.content
      LN.title = L.title

successfully transfers the data and sends correctly.

Confirmed, there is an inconsistency here because a @property was not properly declared. Thanks for finding and reporting it! Will have it fixed shortly!