Not all types have code associated to them. Thus 'viewcode' type actions wont do anything useful. For nodes like this the place where code is found is under the relevent display page for type X.

Lets use sourcecodesection as an example. These nodes are "dumb" in the sense that they dont have evaluatable code associated to them. However they do have an overriden display page: sourcecodesection display page and it is there that you would look to change how such a nodetype behaves. Some node types have many overriden display types, some only a few. All inherit a large number of display modes from the node type heirarchy. A good place to inspect this info in a holistic way is via the type tree and more specifically via the types own page.

Incidentally all of this can be seen in the pmdev nodelet. At the top of the nodelet it will say something like

#11911 = strangedoc via strangedoc display page
. When the viewcode link isnt available normally you will want to look at the page indicated by the 'via' link.

This node is a response to a question i received via /msg that I figured would be useful to others. Cheers.

---
demerphq

  • Comment on Why doesn't 'viewcode' work for type X?

Replies are listed 'Best First'.
Re: Why doesn't 'viewcode' work for type X?
by tye (Sage) on Dec 28, 2004 at 03:49 UTC

    I think I've already run into cases where displaytypes or such were made too DWIM and I've regretting it because a more sensible action became available (and you can replace an error with a good new behavior but backward compat prevents you from easily replacing an ill-advised DWIM action with a more consistent action).

    But perhaps a good compromise would be to have node viewcode page include the above link along with the error text so that you could still easily get to the somewhat related "code for the node" but in a way that wouldn't confuse people into thinking that the code actually is part of the node they requested and that could be changed down the road.

    - tye        

      Yeah, I've argued for a smarter "viewcode" logic in the past but I think ive come around to your view that this is unnecessary DWIM. Anyway, I thought your point about a better error message is good, and I've now linked in get_display_types as well. I think that should do nicely. Eg: sample sourcecodesection viewcode

      ---
      demerphq