[Dojo-interest] Re: namespace bug in 0.4?

Andrew Scott andrew.scott at aegeon.com.au
Mon Nov 13 14:29:56 MST 2006


Aaron I am not sure Dojo dictates your name space.

This line as far as I know dictates your name space

dojo.registerModulePath("mycompany", "../mycompany/widget");

If you remove the widget I doubt you will have any more problems, I posted
it with that because all my modules are named underneath there.

So if you have

| myNS
| - widget
| - - Module 1
| - - Module 2

you access them as myns:module1.widgetname or myns:module2.widgetname


You would be good to go

| myNS
| - Module 1
| - Module 2


the you need to reference them as myNS.Module1:widgetname



On 11/14/06, Aaron Evans <aaronmevans at gmail.com> wrote:
>
> Right, so you just *shouldn't* use:
>
> mycompany.widget.module1
>
> Instead, you have to use:
>
> mycompany.module1.widget.
>
> Thanks for the tip (was actually about to try that).
>
> But I think it is rather rediculous that dojo dictates my package
> structure...
>
>
>
> On 11/13/06, Anand Krishnan <Anand.Krishnan at artstor.org> wrote:
> > Hi Aaron
> >
> > Regarding the deprecated warning you got with respect to my suggestion,
> > it is because that it could not find the widget at <namespace>/widget
> > directory.
> >
> > For example
> > You need to specify <div dojoType="mycompany:MyWidget"></div> if you
> > have your widgets at mycompany/widget directory.
> >
> > And
> >
> > You need to specify <div dojoType="mycompany.module1:MyWidget"></div> if
> > you have your widgets at mycompany/module1/widget directory.
> >
> > Anand
> >
> > -----Original Message-----
> > From: dojo-interest-bounces at dojotoolkit.org
> > [mailto:dojo-interest-bounces at dojotoolkit.org] On Behalf Of Aaron Evans
> > Sent: Monday, November 13, 2006 3:51 PM
> > To: dojo-interest at dojotoolkit.org
> > Subject: Re: [Dojo-interest] Re: namespace bug in 0.4?
> >
> > Shane,
> > perhaps then you can explain to me the *proper* way to do what I want to
> > do.
> >
> > I have widgets in:
> >
> > mycompany.widget
> > mycompany.widget.module1
> > mycompany.widget.module2
> >
> > What is the proper way (where I won't get deprecation warnings, etc)
> > to namespace my widgets in my HTML source.
> >
> > If I use Anand's suggestion:
> >
> > <div dojoType="mycompany.widget.module1:MyWidget"></div>
> >
> > Then I get warnings like:
> > DEBUG: DEPRECATED: dojo.widget.Manager.getImplementationName Could not
> > locate widget implementation for "mywidget" in
> > "mycompany.widget.module1.widget" registered to namespace
> > "mycompany.widget.module1". Developers must specify correct namespaces
> > for all non-Dojo widgets -- will be removed in version: 0.5
> >
> > If I use Andrew's suggestion:
> > ...
> > dojo.registerModulePath("mycompany", "../mycompany/widget");
> > ...
> > <div dojoType="mycompany:module1.MyWidget"></div>
> >
> > Then it can't find any of the widgets that are just in mycompany.widget!
> >
> > And if I change the module path to just ../mycompany, then the widgets
> > in mycompany.widget.module1 do not work!
> >
> > Please can you answer my initial question and tell me how to
> > accomplish this because all this stuff worked great pre-namespace
> > stuff...
> >
> > -aaron
> >
> >
> > On 11/10/06, Shane O'Sullivan <shaneosullivan1 at gmail.com> wrote:
> > > As to what the third argument "myns" is for, it is intended to be the
> > > fully qulified name of your namespace, similar to XML, so it should
> > > really be specified as something like
> > > "http://dojotoolkit.org/namespaces/myns".  At the moment it's not
> > > being used, but the intention is that it could possibly be
> > > auto-inserted into the <html> tag to make the proper XHTML namespacing
> > > work in IE
> > >
> > > Shane
> > >
> > > On 09/11/06, Aaron Evans <aaronmevans at gmail.com> wrote:
> > > > I think that what makes it confusing is mainly the documentation and
> > > > the fact that I've been widgeting since before 0.3 and they keep
> > > > changing the API for this stuff.
> > > >
> > > > I was using dojo.setModulePrefix("myNameSpace","../myNameSpace")
> > > > whereas I guess now we ought to be using dojo.registerModulePath.
> > > >
> > > > If you take a look at:
> > > >
> > > > http://dojo.jot.com/WikiHome/Modules%20%26%20Namespaces?revision=19
> > > >
> > > > The documentation also says to use dojo.registerNamespaceResolver
> > but
> > > > it looks like no one really does that (and it didn't help me). Not
> > to
> > > > mention it is poorly documented and overly confusing.
> > > >
> > > > Here's the example that comes with the distribution (which again
> > > > introduces a variation in the API call!):
> > > >
> > > > dojo.registerNamespaceManifest("myns",
> > "tests/widget/namespaces/myns",
> > > > "myns", "myns.widget",
> > > >         function(name){
> > > >                 var module =
> > "myns.widget."+dojo.string.capitalize(name);
> > > >                 dojo.debug("resolver returning '"+module+"' for
> > '"+name+"'");
> > > >                 return module;
> > > >         }
> > > > );
> > > >
> > > > Quick:  without referring to the source code what does the third
> > > > argument ("myns") refer to?
> > > >
> > > > Furthermore, if you don't specify (at least with setModulePrefix)
> > the
> > > > /widget in the path, it would still find your stuff under
> > > > myNameSpace/widget which would make you think that if you specified
> > > > something like "myNameSpace/mypackage" as the path, that it would
> > > > search "myNameSpace/mypackage/widget", or in your case, you would
> > > > think that "myNameSpace/widget" would look in
> > > > "myNameSpace/widget/widget".
> > > >
> > > > And if it searches the widget directory under myNameSpace
> > > > automatically, why wouldn't it then look under sub-packages of
> > widget
> > > > automatically!  Incidentally, prior to 0.3.1 (the namespace release)
> > > > *it did*.  So why would it stop all of a sudden.
> > > >
> > > > I tried many permutations of name spaces and paths to no avail.  I
> > > > guess I just didn't try the one you are using.
> > > >
> > > > And it does look stupid when you have several nested packages.  Eg.
> > > > mycompany.widget.package1.package2.package3.MyWidget
> > > >
> > > > becomes
> > > >
> > > > mycompany:package1.package2.package3.MyWidget
> > > >
> > > > Again, why not just include the entire package name!?!
> > > >
> > > > And finally, I really wish I had gotten this info before I totally
> > > > refactored all my stuff but when none of your stuff that was working
> > > > before upgrading stops working, you take drastic measures.
> > > >
> > > > Anyhow, thanks for the tip all the same.  I'm just worked up because
> > > > I've been spinning my wheels upgrading for the past 2 days...
> > > >
> > > >
> > > >
> > > > On 11/9/06, Andrew Scott <andrew.scott at aegeon.com.au> wrote:
> > > > > Actually dojo 0.4 uses xml style namespace correctly.
> > > > >
> > > > > As you were told and I do this myself.
> > > > >
> > > > >
> > > > >
> > > > > <script type="text/javascript" >
> > > > > dojo.registerModulePath(myNameSpace', 'myNameSpace/widget');
> > > > > dojo.require("myNameSpace.HelloWorld");
> > > > >  dojo.hostenv.writeIncludes();
> > > > > </script>
> > > > > Now I have above done the following, I have set the namespace
> > myNameSpace to
> > > > > point to dojoroot/myNameSpace/widget. Now under widget I have all
> > my
> > > > > packages so when I want to reference these I do this.
> > > > >
> > > > >
> > > > >
> > > > > <div dojoType="myNameSpace:package1.HelloWorld" />
> > > > > <div dojoType="myNameSpace:package2.HelloWorld" />
> > > > > <div dojoType="myNameSpace:package3.HelloWorld" />
> > > > >
> > > > > How simple is that:-)
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > _______________________________________________
> > > > > Dojo FAQ: http://dojo.jot.com/FAQ
> > > > > Dojo Book: http://manual.dojotoolkit.org/DojoDotBook
> > > > > Dojo-interest at dojotoolkit.org
> > > > > http://dojotoolkit.org/mailman/listinfo/dojo-interest
> > > > >
> > > > >
> > > > >
> > > > _______________________________________________
> > > > Dojo FAQ: http://dojo.jot.com/FAQ
> > > > Dojo Book: http://manual.dojotoolkit.org/DojoDotBook
> > > > Dojo-interest at dojotoolkit.org
> > > > http://dojotoolkit.org/mailman/listinfo/dojo-interest
> > > >
> > > _______________________________________________
> > > Dojo FAQ: http://dojo.jot.com/FAQ
> > > Dojo Book: http://manual.dojotoolkit.org/DojoDotBook
> > > Dojo-interest at dojotoolkit.org
> > > http://dojotoolkit.org/mailman/listinfo/dojo-interest
> > >
> > _______________________________________________
> > Dojo FAQ: http://dojo.jot.com/FAQ
> > Dojo Book: http://manual.dojotoolkit.org/DojoDotBook
> > Dojo-interest at dojotoolkit.org
> > http://dojotoolkit.org/mailman/listinfo/dojo-interest
> > _______________________________________________
> > Dojo FAQ: http://dojo.jot.com/FAQ
> > Dojo Book: http://manual.dojotoolkit.org/DojoDotBook
> > Dojo-interest at dojotoolkit.org
> > http://dojotoolkit.org/mailman/listinfo/dojo-interest
> >
> _______________________________________________
> Dojo FAQ: http://dojo.jot.com/FAQ
> Dojo Book: http://manual.dojotoolkit.org/DojoDotBook
> Dojo-interest at dojotoolkit.org
> http://dojotoolkit.org/mailman/listinfo/dojo-interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://dojotoolkit.org/pipermail/dojo-interest/attachments/20061113/858a8c35/attachment.html


More information about the Dojo-interest mailing list