durusmail: quixote-users: Where in the URL is Component San Diego?
Where in the URL is Component San Diego?
2003-01-30
2003-01-30
2003-01-30
2003-01-30
2003-01-31
2003-01-31
2003-02-05
2003-02-06
Where in the URL is Component San Diego?
Titus Brown
2003-01-31
-> >I'm very confused by your code ;).
->
-> Sorry about that. :^)

Oh, it's not your fault...  ;)

-> >I'd do something like:  (dir/package structure)
-> >
-> >config/__init__.py -- contains _q_index with all config commands, and
-> >    'users' func;
-> >
-> >config/user/__init__.py -- contains _q_index with general user commands,
-> >    exports 'add' func and _q_getname func that returns UserCommands
-> >    object for 'username'
->
-> Currently all config objects are in a single *file*, and you want me to put
-> them in different *packages*?!? :^)

Yes.  My directory tree for Cartwheel is pretty extensive: 22 different
directories.  It's one of the great things about Quixote, for me -- it
encourages one to divvy up the source tree in an intelligent way, unlike
CGI.

-> >UserCommands object: loads username, exports 'modify', 'delete'.
-> >
-> >What am I missing?  I'd probably put 'validate' on UserCommands, too.
->
-> It was done this way before, in place of your UserCommands object I have a
-> UserForm(Form) object. Then I realized that I need to instantiate a new
-> UserForm object every time an "add" or "modify" path was traversed, and that
-> obviously can only be done before calling such an object, by something else
-> outside it.

Perhaps I am beginning to understand... but I'm still not sure it's
insoluble.  I run into a similar problem with Cartwheel: I have a
number of different analyses, each of which presents a different form,
but the user specifies which one s/he will create first.  The creation is done
by a POST to an 'add' URL, at which point an analysis is created and a
redirect is issued to something that understands how to load the various
objects and present the analysis-specific forms.

In your case, I'd move the 'validate' function underneath the
UserForm object, and have 'add' take a username, create
an otherwise empty User, and redirect to [username]/modify.

-> >Keeping track of the current URL "level" is a bad thing, because it reduces
-> >modularity...
->
-> Not sure what you're aiming at, in this case.

Err, simply that I like to be able to move code around without thought
for its immediate context.  That makes it a heck of a lot more usable.

--titus

reply