Re: [Evolution-hackers] Attachments?



On Fri, 2011-06-24 at 06:59 -0400, Adam Tauno Williams wrote:
> On Thu, 2011-06-23 at 22:00 -0400, Adam Tauno Williams wrote:
> > On Thu, 2011-06-23 at 11:23 -0400, Adam Tauno Williams wrote:
> > > Are attachments for tasks related to a CalDAV task list supposed to be
> > > functional?
> > > If the attachment is encoded as a link [and the site requires
> > > authentication] Evolution presents a "HTTP authentication required"
> > > error dialog and drops the attachment;  it doesn't ask for
> > > authentication or attempt to use the credentials used for the CalDAV
> > > server
> > > If the attachment is encoded as binary [present in the VTODO] it simply
> > > fails with an "operation not supported" message
> > > Evolution 2.32.1
> > I've managed to encode the attachments in such a way that they do not
> > raise any error when the task is viewed in Evolution;  however the
> > attachments simply do not appear.  I've verified in wireshark that the
> > attachments are received by Evolution.
> Progress!  Sort of.  I upgraded to Evolution 3.0.2 [openSUSE 11.4 x64
> using the GNOME  repo].
> With this version the attachments appear, with names.  Looks great.  But
> the contents of the attachment when I open it are.... base64 text.
> Evolution is not decoding from base64 back to the files actual content?
> I dug the X-EVOLUTION-CALDAV-ATTACHMENT-NAME property out of the
> Evolution source code.

It works!  Now whenever users upload an attachment to a workorder/task I
can access the file directly from my Evolution To-Do list.  The trick(s)
were to upgrade to the latest Evolution [3.0.x] and that Vobject
automatically base64 encodes the attachment value [so if you do it
yourself you end up with base64 encoded base64 encoded data].

The vobject code to pull this off, and make a happy Evolution client,
looks like:

    # ATTACHMENTS
    if task.attachments:
      for attachment in task.attachments:
        print attachment
        handle = ctx.run_command('attachment::get-handle',
attachment=attachment)
        if handle:
          data = handle.read()
          attach = todo.add('attach')
          attach.encoding_param = 'BASE64'
          attach.value_param = 'BINARY'
          if attachment.webdav_uid:
            attach.x_oracle_filename_param = attachment.webdav_uid
            attach.x_coils_filename_param = attachment.webdav_uid
            attach.x_evolution_caldav_attachment_name_param =
attachment.webdav_uid
            attach.x_coils_attachment_uuid_param = attachment.uuid
            attach.x_coils_attachment_size_param = str(attachment.size)
            attach.fmttype_param = attachment.mimetype
            attach.value = data

Since I could find this information no where I figured it was worth
posting somewhere.
<http://vobject.skyhouseconsulting.com/>
<https://sourceforge.net/projects/coils/>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]