Re: External required resources for custom Deform widget

51 views
Skip to first unread message

renier de bruyn

unread,
Sep 1, 2014, 4:01:34 AM9/1/14
to pylons-...@googlegroups.com
Have you found a solution to this?  I am also now working a project which requires me to use deform and the Google Maps API

On Saturday, 2 March 2013 04:51:48 UTC+2, ji...@hatchd.com.au wrote:
I'm developing a custom widget for Deform that requires the use of the Google Maps API (and another JS requirement that I have written) and I want to set this as a required resource for developers using the widget. This is simple enough:

class CustomWidget(Widget): 
    requirements = ( ('maptack', None), ('googlemaps-api', '3.0'))

The user is required to specify the JS resources similar to the following in their project (I'd also love a way around this -- seems very non-modular and puts a lot of expectations of someone using the widget):

registry = ResourceRegistry(use_defaults=True)
registry.set_js_resources('googlemaps-api', '3.0', 'http://maps.googleapis.com/maps/api/js?sensor=false')

The issue I am facing is set_js_resources expects a relative asset (which may or may not be packaged within my widget) which is usually output to the <head> of their HTML file by using Deform.Form.get_widget_resources(). I have been unable to find any examples of this problem being solved nor any references to it within the documentation. Has anyone had experience with this, or have a good solution? Any example widgets that use resources which are not included in Deform by default would be much appreciated.

Reply all
Reply to author
Forward
0 new messages