Hi,

I'm going through the MiddleKit docs right now... Since I can't really
program, but merely pretend to, I figure my value to the project might be in
documentation suggestions.

So, I've got some. Of course, they may all be wrong, and in fact you may all
justifiably seek my life with a tire iron, but such are the risks of open
source!

I should say that I'm really happy with Webware's docs. Getting into Webware
is so much easier than a lot of other frameworks for this very reason.

Without further ado, I hope this is helpful:

I'm in the Quick Start section...

1. After the docs recommend constructing the "generate" script, it would
help if the docs point out that when executing "generate" your $PWD needs to
be one level above "Videos.mkmodel".

2. You need to run generate from python2, not python, or it'll choke thusly:

[steve@dieter Middle]$ ./generate
Traceback (innermost last):
  File "/usr/local/webware/MiddleKit/Design/Generate.py", line 56, in ?
    FixPathForMiddleKit()
  File "/usr/local/webware/MiddleKit/Design/Generate.py", line 30, in
FixPathForMiddleKit
    if location.lower()=='generate.py':
AttributeError: 'string' object has no attribute 'lower'

3. If you copied the contents of the samples directory
(MiddleKit/Docs/Videos/Middle/Videos.mkmodel/) to your new Videos.mkmodel
directory, make sure you didn't grab Samples.csv too, because it'll confuse
your generate script. The only files that should be present the first time
you run it are Classes.csv and Settings.config.

4. One of the example insets shows Unix users executing generate as
"generate", when it should read "./generate", or "python2 generate".

5. The example of creating the script "create" uses backslashes. Also,
there's no database called "Tables_in_Videos". That should be replaced with
"Videos".

6. The example of creating the script "insert" uses backslashes. Darn them
things. Yes, I realize we need them on *dows, but the examples ought to be
in one format or the other and stick with it. I have a feeling we've got
more *nix users than *dows users, so we probably ought to stick with
slashes.

7. The main.py example won't run under python2, because it expects to import
mx.DateTime, which doesn't come with python2, or at least it doesn't in
RedHat 7.3's distribution.

8. The main.py example won't run under python 1.x either, because it imports
MySQLObjectStore, which has syntax requiring python2.

9. Still in main.py, modifying $pythonpath didn't do the trick for me -- it
couldn't find the MiddleKit modules. So I had to add a line to main.py which
read "sys.path.append('/usr/local/webware')". I expect this is because my
$PWD didn't happen to be where it wanted it. I think relying on the user's
$PWD is a bit too fragile.

I think it'd be better to replace it with...

sys.path.insert(1, '/usr/local/webware')

...and encourage the reader to insert the right directory. Fiddling with
pythonpath and wondering why its contents weren't reflected in sys.path was
irritating and (fortunately) unnecessary, since I didn't know it was
expecting me to cd to a certain directory.

Woo hoo! More to come, I'm sure. I've got to stop now since my main.py won't
run and no one can hear me scream.

BTW, if anybody wants to rewrite main.py for python2, I'd sure appreciate
it, as I can get on with this business. I don't know what python2's
equivalent for 1.x's mx.DateTime is, but I'm sure one of you does! :-)

Here's the code for the terminally lazy who are better at rewriting source
than fetching it from a webpage:

# Gain access to the Middle package
import os, sys
sys.path.insert(1, os.path.abspath(os.pardir))

from mx.DateTime import DateFrom
from MiddleKit.Run.MySQLObjectStore import MySQLObjectStore

def main():
    # Set up the store
    store = MySQLObjectStore(user='user', passwd='password')
    store.readModelFileNamed('../Middle/Videos')

if __name__=='__main__':
    main()

More soon, I'm sure! :-)

Steve


_______________________________________________________________

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm

_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to