By default, scripted classes will inherit from NSObject unless they are in
the context of a component (i.e. named the same as a component
directory)-- in that case, from WOComponent. I may be completely wrong
about the NSObject part.
Regardless, you need to:
@interface DirectAction: WODirectAction
@end
@implementation DirectAction
.... your code here ....
@end
In the DirectAction.wos script file. (move the ivars into the @interface
block, of course).
If *that* doesn't fix or isn't the problem, set a breakpoint on
-[NSException raise] in gdb and send me the backtrace.
Basically, _scope is an attribute of the internals of the WebScript
interpreter. It sounds like teh interpreter is becoming quite confused in
that your direct action instance isn't acting like a "normal" scripted
object.
It may also be possible that you have implemented one of the various
methods that sort of act like reserved words-- see the WODirectAction
class and make sure that you haven't accidentally overridden anything in
that. (this is the reason why action names translate to fooAction... the
postpended Action means that you can never have an action method that
accidentally blows away some required functionality of the class).
b.bum
On Wed, 24 Feb 1999, matt kangas wrote:
> this seems like such a simple thing, but it's not working. could anybody
> please explain to me what's going on here? i'd be most grateful...
>
> * take an otherwise healthy WebScript/ObjC WO4 app named Foo.woa running
> on Solaris
> * replace DirectAction.m with DirectAction.wos on disk & in the project,
> do make/make install
> * restart the app
>
> DirectAction.wos looks like this
>
> - defaultAction {
> return [self pageWithName:@"Main"];
> }
>
> (exactly what DirectAction.m looked like in its @implementation)
>
> * try to access this with
> http://localhost/cgi-bin/WebObjects/Foo.woa/wa/
>
> the result is:
>
> Application: Foo
> Error: NSInvalidArgumentException
> Reason: *** -[DirectAction _scope]: selector not recognized
>
> is something missing from DirectAction.wos? presumably yes, but i can't
> find any examples of DAs implemented in webscript. (c.f. previous gripe
> about InfoCenter)
>
> merci.
>
> --
> \7\3\d\e\k\b\8\u\o\x\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \
> \m\a\t\t\.\k\a\n\g\a\s\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \
> m\a\t\t\@\k\a\n\g\a\s\.\o\r\g\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \
>
>