Hi, so I have created my own deform widget which is an updated select2 
(with help from this group) and rather than copy the .js and the .cs into 
the deform folder I would like to be able to serve them from elsewhere. I 
am using pyramid. and have several includes as well as my main pyramid 
app. bds.theme is one of those includes.

In the definition of my widget I have:

class Select2RemoteDataWidget(deform.widget.Select2Widget):
>
>     template = 'bds.theme:templates/remotedataselect2-1.pt'
>
>     requirements = (('deform', None), ('select2', '4.0.3'))
>
>     readonly_template = 'bds.theme:templates/remotedataselect2-1-ro.pt
>
>     url = ''
>
>
With just this I get a value error as there is no such requirement to be 
found in deform.

Then I added to the requirements in the init file of my pyramid application

    registry = deform.widget.ResourceRegistry(use_defaults=True)
>
>     registry.set_js_resources('select2', '4.0.3', 
>> 'bds.theme:static/select2/select2-4.0.3.js')
>
>     registry.set_css_resources('select2', '4.0.3', 
>> 'bds.theme:static/select2/select2-4.0.3.cs')
>
>
Form.set_default_resource_registry(registry) 


 I have also set up a static route but it doesn't seem to have any effect.

config.add_static_view(bds.theme:static,,bds.theme:static, 
>> cache_max_age=86400)
>
>     
>
> I no longer get the value error with this  setup but instead I get a 401 
error if I try and look for the file referred to. 
It says the file is found at:

src="http://localhost:6543/static/select2/select2-4.0.3.js";


What am I missing in my setup? Do the js files have to be in the deform 
folders?

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/8f452050-5a66-461b-baba-e52dac861959%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to