keylget does not like embedded dashes

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf keylget does not like embedded dashes

  • Creator
    Topic
  • #54753
    Peter Heggie
    Participant

      I’m sure I’m doing something wrong, but when I use a keylget when the key has embedded dashes, I get an error. This only happens when the code is executed in a translate thread. At the tcl command line, it works fine.

      example –

      Code:

      set headers {{content-transfer-encoding 7bit} {content-type text/plain;rntcharset=”iso-8859-1″}}
      set criteria content-transfer-encoding
      keylget headers $criteria

      returns “7bit”.

      However when I run this in a translate tps (pre-proc), I get this error:

      [tcl :out :INFO/0:RHIO_inbound_xlate:07/08/2015 09:22:08] RHIO_inbound_USR:  search_criteria: content-transfer-encoding,content-disposition,content-type

      [tcl :out :INFO/0:RHIO_inbound_xlate:07/08/2015 09:22:08] RHIO_inbound_USR:  criteriaList: content-transfer-encoding content-disposition content-type

      [tcl :out :INFO/0:RHIO_inbound_xlate:07/08/2015 09:22:08] RHIO_inbound_USR:  criteria_count: 3

      [tcl :out :INFO/0:RHIO_inbound_xlate:07/08/2015 09:22:08] RHIO_inbound_USR:  attachment att_number: 0

      [tcl :out :INFO/0:RHIO_inbound_xlate:07/08/2015 09:22:08] RHIO_inbound_USR:  attachment 0 headers: headers {{content-transfer-encoding 7bit} {content-type text/plain;rntcharset=”iso-8859-1″}}

      [tcl :out :INFO/0:RHIO_inbound_xlate:07/08/2015 09:22:08] RHIO_inbound_USR:  attachment 0 header_keys: content-transfer-encoding content-type

      [tcl :out :INFO/0:RHIO_inbound_xlate:07/08/2015 09:22:08] RHIO_inbound_USR:  attachment 0 checking criteria content-transfer-encoding

      [xlt :xlat:ERR /0:RHIO_inbound_xlate:07/08/2015 09:22:08] Tcl error:

      [xlt :xlat:ERR /0:RHIO_inbound_xlate:–/–/—- –:–:–] msgId = message0

      [xlt :xlat:ERR /0:RHIO_inbound_xlate:–/–/—- –:–:–] proc = ‘RHIO_inbound_USR’

      [xlt :xlat:ERR /0:RHIO_inbound_xlate:–/–/—- –:–:–] args = ”

      [xlt :xlat:ERR /0:RHIO_inbound_xlate:–/–/—- –:–:–] result = ”

      [xlt :xlat:ERR /0:RHIO_inbound_xlate:–/–/—- –:–:–] errorInfo: ‘

      [xlt :xlat:ERR /0:RHIO_inbound_xlate:–/–/—- –:–:–] keyed list entry must be a valid, 2 element list, got “headers”

      [xlt :xlat:ERR /0:RHIO_inbound_xlate:–/–/—- –:–:–]     while executing

      [xlt :xlat:ERR /0:RHIO_inbound_xlate:–/–/—- –:–:–] “keylget headers “$criteria””

      It is not the keyed list ($headers) that is the problem, it is the key. When I change the criteria to use underscores instead of dashes, it works.

      Has anyone seen this?

      Peter

      Peter Heggie
      PeterHeggie@crouse.org

    Viewing 0 reply threads
    • Author
      Replies
      • #82847
        Peter Heggie
        Participant

          I answered my own question – I surrounded the variable with curly braces, and also fixed my key list values:

          Code:

          set headers [lindex $att_data 0]
          if {$debug > 1} {echo “$module attachment $att_number headers: $headers”}
          set headers [string range “$headers” 9 end-1]
          if {$debug > 1} {echo “$module attachment $att_number headers: $headers”}

          Code:

          set found [keylget headers ${criteria} value]
          if {$debug > 1} {echo “$module attachment $att_number header $criteria found: $found value: $value”}

          [tcl :out :INFO/0:RHIO_inbound_xlate:07/08/2015 10:36:09] RHIO_inbound_USR:  attachment 0 headers: headers {{content-transfer-encoding 7bit} {content-type text/plain;rntcharset=”iso-8859-1″}}

          [tcl :out :INFO/0:RHIO_inbound_xlate:07/08/2015 10:36:09] RHIO_inbound_USR:  attachment 0 headers: {content-transfer-encoding 7bit} {content-type text/plain;rntcharset=”iso-8859-1″}

          [tcl :out :INFO/0:RHIO_inbound_xlate:07/08/2015 10:36:09] RHIO_inbound_USR:  attachment 0 header content-transfer-encoding found: 1 value: 7bit

          Peter Heggie
          PeterHeggie@crouse.org

      Viewing 0 reply threads
      • The forum ‘Cloverleaf’ is closed to new topics and replies.