I kind of wanted this to serve as an intermediate-advanced introduction to
web.py incorporating features and edge cases that we encounter in real-world
usage but might not be immediately obvious by reading the basic tutorial [1]
or by browsing the disparate cookbook recipes. It always bugged me that,
given the expressiveness of Python, the first (and only?) tutorial that new
devs see is code broken into 3-4 line chunks w/ *paragraphs* of text
between.

As for the names I chose to include simple URL validation via the regex in
the paths:

([a-z])-([a-z]{3,})

I've known at least a Li and a Ko personally so I shouldn't have been so
naive in my *last name must be greater than three characters in length*pattern.
**fixed**

Maybe I've typecast this solution as simply a recipe for DB testing when I
was trying to demonstrate an idiomatic method to overall testing in web.py.

That said, I wanted to use external templates to make proper use of
renderbut I won't be able to upload a tarball to the wiki — another
problem I've
encountered in the past.

And now I'm beginning to see a bigger problem. http://webpy.org/tutorial3and
http://webpy.org/tutorial3.en seem to have started in the same place (?) and
have diverged.

tl;dr Is it just me or could the community benefit from some guidance in the
form of idiomatic web.py? I know the goal of web.py was to be flexible in
the face of competition.. I just can't help but think at times:

There should be one-- and preferably only one --obvious way to do it. [2]


[1] http://webpy.org/tutorial3.en
[2] http://www.python.org/dev/peps/pep-0020/

On Sat, Sep 19, 2009 at 3:24 PM, Adrián Navarro <[email protected]> wrote:

>
> little bug: doesn't handles "short" names:
> for example, "Test Database" will work, but "Test Me" won't (one
> generates "t-database" slug and the other one "t-me", maybe too short)
>
> On Sat, Sep 19, 2009 at 11:36 PM, Angelo Gladding <[email protected]>
> wrote:
> > Oh and I'll leave http://angelo.gladding.name:10000/mathematicians up
> for as
> > long as need be.
> >
> > On Sat, Sep 19, 2009 at 2:33 PM, Angelo Gladding <[email protected]>
> > wrote:
> >>
> >> Testing is hard. I think that the comments so far are representative of
> >> lack of specificity in your question. I thought about it last night and
> put
> >> together a draft of a RESTful approach to testing that could test both
> >> webapp and database at the same time. I believe paste and nose [1] can
> do
> >> something similar but I feel like web.py has all of the functionality
> >> already built-in.
> >>
> >> So without further ado I'd like to request for comment on RESTful
> >> doctesting using request [2]. Notice that I've commented out RDBMS code
> in
> >> favor of a dictionary. I did so in order to make the RESTful aspect
> easily
> >> testable on other systems. The next step, of course, is to pull SQL into
> the
> >> loop. I wanted to get others' opinions on the matter. The obvious,
> easiest
> >> solution would be to keep an up-to-date dump of your DB schema on hand
> to
> >> setup and teardown a `_test` DB just before and after the
> >> `doctest.testmod()` line third from last.
> >>
> >> Any thoughts on extending this for exemplary purposes or is this more or
> >> less just one of very many ways to accomplish the task?
> >>
> >> * Focus on the doctest and walking through the CRUD operations. This can
> >> be extended to maintain session state (e.g. setup, user creation, user
> >> verification, user login, resource creation, .., teardown). Lastly, keep
> in
> >> mind the possibility of using a key-value based DB rather than a
> SQL-based
> >> RDBMS, the former modeled more like to the code as is.
> >>
> >> Sean, is this along the lines of what you were looking for?
> >>
> >> [1] http://webpy.org/cookbook/testing_with_paste_and_nose
> >> [2] http://webpy.org/cookbook/restful_doctesting_using_request
> >>
> >> On Fri, Sep 18, 2009 at 2:59 PM, Sean <[email protected]> wrote:
> >>>
> >>> Hi,
> >>>
> >>> I'm trying to test my web.py app, including its database
> >>> functionality.  I would like to use a test database for this purpose,
> >>> but it seems like the standard web.py way of doing things is to
> >>> hardcode the database connection in something like a config.py file.
> >>>
> >>> What's the best way to test a web.py app, including its database?  How
> >>> do others do this?
> >>>
> >>> Thanks!
> >>> Sean
> >>>
> >>>
> >>
> >>
> >>
> >> --
> >> Angelo Gladding
> >> [email protected]
> >> http://angelo.gladding.name/
> >> E69E 47E8 5C3A 96E5 C70F
> >> D931 F35C ACBA 6F39 9611
> >
> >
> >
> > --
> > Angelo Gladding
> > [email protected]
> > http://angelo.gladding.name/
> > E69E 47E8 5C3A 96E5 C70F
> > D931 F35C ACBA 6F39 9611
> >
> > >
> >
>
>
>
> --
> Adrián Navarro (+34.644443433, http://adrian.navarro.at, [email protected]
> )
>
> >
>


-- 
Angelo Gladding
[email protected]
http://angelo.gladding.name/
E69E 47E8 5C3A 96E5 C70F
D931 F35C ACBA 6F39 9611

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to