ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> pyxpcom
pyxpcom
Re: [pyxpcom] Mixture of Python and Javascript
by Mark Hammond other posts by this author
Jul 23 2007 10:17PM messages near this date
view in the new Beta List Site
[pyxpcom] Mixture of Python and Javascript | Re: [pyxpcom] Mixture of Python and Javascript
>  In the current XULRunner/Firefox builds, with python support enabled,
>  to what extent can python code and javascript code be "mixed," ie:
>  calls to functions/methods from both languages, and variables shared
>  within the same XUL/HTML/XML/etc... document)  Is there a good source
>  of reference material on this topic? (Or on the use of python as a
>  script-type in general?)

I'm afraid its currently not possible to share namespaces between languages
yet.  I've a patch that went a long way towards that, but its suffering from
a lack of interest - as a track record develops of people using the DOM work
and then complaining about the lack of shared namespaces, it should become
easier :)

Note that it is only "custom" objects that can't be shared - but DOM nodes
etc are shared.  Basically, any attributes provided internally should work
fine, but if your JS code says "windows.foo = bar" (where 'foo' isn't an
internal attribute), Python will not be able to see foo.  However, there
*is* a hack you can use to have Python peek into a JS namespace - the _nsdom
module provides a JSExec function - something like 'str_val, is_undef =
JSExec(window, "foo")' might let you share strings.

I'm afraid the only docs are what you can find in the Wiki.

Cheers,

Mark

_______________________________________________
pyxpcom mailing list
pyxpcom@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Ryan Sturmer
Mark Hammond
Mark Hammond

Privacy Policy | Email Opt-out | Feedback | Syndication
© 2004 ActiveState, a division of Sophos All rights reserved