hapi-server / uri-templates

Repository of tools for URI templates
Apache License 2.0
2 stars 0 forks source link

Support /tmp/ap/$(x;name=sc;len=6;pad=_).dat #22

Closed jbfaden closed 1 month ago

jbfaden commented 10 months ago

It doesn't look like len and pad work with x for formatting, even though the interface allows values to be passed in. For example, this Autoplot script should work:

from java.util import HashMap
import sys
addToSearchPath( sys.path,
     'https://cottagesystems.com/hapi/uri_templates/dist/UriTemplatesJava.jar',
     monitor )

from org.hapiserver import URITemplate

urit = URITemplate('/tmp/ap/$(x;name=sc;len=6;pad=_).dat')
m= HashMap()
m.put('sc','Apple')
print urit.format(None,None,m)
m.put('sc','Boy')
print urit.format(None,None,m)
jbfaden commented 1 month ago

Also I get a NullPointerException when running this, because something is assuming there is a time. An initial scan could detect that times aren't needed for this template. With Autoplot these get an implicit time range of 1000-9000 (A.D.) and these are useful.

jbfaden commented 1 month ago

I notice the docs don't point out pad in $x, and this should be added.

jbfaden commented 1 month ago

This is done.