Second, there is now an automatic visitor tracking method built into
TurboGears. You'll be handed a cookie with your visit_key (an SHA1
hashed version of datetime.now()) when you make your first request.
And if you're idle for longer than visit.timeout (config variable)
minutes, you'll get a new visit on your next request.
This means the cookie from Identity has gone away. Too many cookies
is fattening. And once I figure out exactly how to piggyback on the
CherryPy session cookie, I'll use that if the session filter is enabled.
You can also add plugins that handle visit events (new_visit and
record_request) via an EntryPoint in the turbogears.visit section.
Currently, Identity is the only visit tracking plugin.
You can also access the current visit ID via
turbogears.visit.current_id(). This can be helpful when you want to
link the current visit to events (like viewing a product).
Third, I simplified the Identity framework a bit by removing the
model folder and rolling the classes into the soprovider file. Plus I
moved soprovider up into the identity folder.
So, if you have the following in your model.py file:
from turbogears.identity.model.somodel import *
Change that to:
from turbogears.identity.soprovider import *
or from turbogears.identity.soprovider import TG_User, TG_Group,
TG_Permission
Finally, I'm thinking of adding a default login controller and
templates to the quickstart project. Does anyone have any objections?
--
Jeff Watkins
http://newburyportion.com/
In the USDA study [of the meat packing industry conducted in 1996]
78.6 percent of the ground beef contained microbes that are spread
primarily by fecal material. The medical literature on the causes of
food poisoning is full of euphemisms and dry scientific terms:
coliform levels, aerobic plate counts, sorbitol, MacConkey agar, and
so on. Behind them lies a simple explanation for why eating a
hamburger can now make you seriously ill: There is shit in the meat.
-- Eric Schlosser, Fast Food Nation
OperationalError: (1054, "Unknown column 'tg_user.child_name' in 'field
list'")
Shouldn't that be 'TG_User' rather than 'tg_user'?
+1
Cheers
Ronald
> --
> Jeff Watkins
> http://newburyportion.com/
>
> In the USDA study [of the meat packing industry conducted in 1996]
> 78.6 percent of the ground beef contained microbes that are spread
> primarily by fecal material. The medical literature on the causes
> of food poisoning is full of euphemisms and dry scientific terms:
> coliform levels, aerobic plate counts, sorbitol, MacConkey agar,
> and so on. Behind them lies a simple explanation for why eating a
> hamburger can now make you seriously ill: There is shit in the meat.
> -- Eric Schlosser, Fast Food Nation
>
>
________________________________
Ronald Jaramillo
mail: ronald AT checkandshare DOT com
blog: http://www.checkandshare.com/blog
--
Jeff Watkins
Computers, they're just a fad.
Finally, I'm thinking of adding a default login controller and templates to the quickstart project. Does anyone have any objections?
+1
Cheers
Ronald
--
Jeff Watkins
"Advertising directed at children is inherently deceptive and exploits children under eight years of age."
-- American Academy of Pediatrics
100% of all respondents agreed: adding Identity support to quickstart is +1. Therefore, starting with revision 478, you get methods for login and logout in your root controller and a login.kid template.Identity still isn't enabled by default. So you'll want to change identity.on to True in your config file. Then create a user using CatWalk. Then login.
With a quickstarted project I now get:
--
Jeff Watkins
"Not everything that can be counted counts, and not everything that counts can be counted."
-- Albert Einstein
> What DB are you using?
From File
"/home/dstanek/vpython/lib/python2.4/site-packages/sqlite/main.py", line
503, in _begin
self.db.execute("BEGIN")
I guess sqlite.
Dave
I guess sqlite.
--
Jeff Watkins
"Daddy, I want a purple iMac. And I want ice cream!"
-- Unidentified 7-year-old to his father.
To reproduce is easy:
1. tg-admin quickstart a project
2. Change the dev.cfg to use a sqlite db
3. tg-admin sql create
4. Start the app
5. Hit it in the browser and get a traceback
Why would you be using the database at all for me. I have identity off, which is the default.
--
Jeff Watkins
Democracy n: A country where the newspapers are pro-American.
On 8 Jan, 2006, at 11:49 am, David Stanek wrote:
Why would you be using the database at all for me. I have identity off, which is the default.The visit tracking hits the database. To create and then update the expiration of the visit.
Please, stabilize this soon as I'm on the edge of a nervous
breakdown...
Just exagerating a bit, keep it up...
Alberto
Hi Jeff,
I also have the same problem, and have some other information:
dev.cfg:
sqlobject.dburi="sqlite:///tmp/wiki.sqlite"
Instead of launching App, you can launch toolbox from tg-admin, it
will also give you the traceback.
Interesting point: you said it creates tables automatically, but it
doesn't. running:
sqlite /tmp/wiki.sqlite
sqlite> .tables
show just my tables (created with tg-admin sql create). Maybe the
problem is that you acquire the lock, try to insert items and it fails
(raises exception), then you ignore the exception but doesn't free the
lock. That's my guess.. I didn't check the code to see if it's true.
--
Gustavo Sverzut Barbieri
--------------------------------------
Computer Engineer 2001 - UNICAMP
Mobile: +55 (19) 9165 8010
Phone: +1 (347) 624 6296; 0812...@sip.stanaphone.com
Jabber: gsbar...@jabber.org
ICQ#: 17249123
MSN: barb...@gmail.com
GPG: 0xB640E1A2 @ wwwkeys.pgp.net
You are using unreleased, ultra-alpha, in-mega-development code, this are
the rules =)
--
Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/
.------------------------------------------------------------------------,
\ GPG: 5F5A8D05 // F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05 /
'--------------------------------------------------------------------'
Karma police
arrest this girl,
her Hitler hairdo
is making me feel ill
and we have crashed her party.
What about doing it optional? Like tg-admin quickstart --with-identity
--
Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/
.------------------------------------------------------------------------,
\ GPG: 5F5A8D05 // F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05 /
'--------------------------------------------------------------------'
Bald men with no jobs and no money who live with their parents don't approach
strange women.
-- George Constanza
Interesting point: you said it creates tables automatically, but itdoesn't. running:sqlite /tmp/wiki.sqlitesqlite> .tables
--
Jeff Watkins
Getting an education was a bit like a communicable sexual disease. It made you unsuitable for a lot of jobs and then you had the urge to pass it on.
-- (Terry Pratchett, Hogfather)
<tester.tar.gz>
$ sqlite -version
2.8.16
I also have sqlite3 in parallel, it cannot open /tmp/wiki.sqlite
("Error: file is encrypted or is not a database").
I think python-sqlite was compiled against sqlite2, there is any
problem? I'm recompiling it with v3 to ensure it's not the problem.
On 1/8/06, Jeff Watkins <je...@newburyportion.com> wrote:Are you using sqlite2 or sqlite3?$ sqlite -version2.8.16I also have sqlite3 in parallel, it cannot open /tmp/wiki.sqlite("Error: file is encrypted or is not a database").I think python-sqlite was compiled against sqlite2, there is anyproblem? I'm recompiling it with v3 to ensure it's not the problem.
--
Jeff Watkins
tg-admin quickstart --advanced
> do you need identity (Y/N) y
> do you need some other feature (Y/N n
--
cheers
elvelind grandin
Updated to sqlite 3.2.1 an pysqlite 2.0.5 and it works.
Updated to sqlite 3.2.1 an pysqlite 2.0.5 and it works.
--
Jeff Watkins
A quickstarted project should be kept barely simple IHMO.
What I would really like (more than an advanced option for tg-admin) is
a set of command that you can use even after you quickstarted the
project, like Rails generate scripts.
I mean, tg-admin ATM helps you only at the beginning (app skeleton) but
it would be nice to use it even for others commons tasks you have to do
during development like:
- a new controller
- identity support
- a new widget
- a new template that extends your master.kid
- a unit test for your controller
- a template to customize a widget
...
What do you think?
Ciao
Michele
Same error here.
I was going to test your fix for the NoneType error. :-(
Ciao
Michele
Same error here.
I was going to test your fix for the NoneType error. :-(
> +1
>
> A quickstarted project should be kept barely simple IHMO.
>
> What I would really like (more than an advanced option for tg-admin) is
> a set of command that you can use even after you quickstarted the
> project, like Rails generate scripts.
>
> I mean, tg-admin ATM helps you only at the beginning (app skeleton) but
> it would be nice to use it even for others commons tasks you have to do
> during development like:
> - a new controller
> - identity support
> - a new widget
> - a new template that extends your master.kid
> - a unit test for your controller
> - a template to customize a widget
> ...
>
> What do you think?
I agree with you, Michele. It would be really helpful. But too many options
is also bad... What I see is that tg-admin is "app wide". It shouldn't be
used to deal with widgets and customizing them, for example. Getting a new
controller, getting identity, helping with unit test (big +1 here!) is OK to
me.
For the other activities maybe a tg-extend or something like that.
--
Jorge Godoy <jgo...@gmail.com>
I think it could be very hard (and potentially danger) to modify a project
after it's created, and you have to use convention (as ruby does) or too
much configuration (so you can tell the code generating scripts where to
put the generating stuff). I think is much more easy to do this things in
the quickstart command, so you can start with a nice skeleton...
I mean, is not that I don't think is a good idea, but I think I could be
too much trouble compared to the benefits you get from it.
--
Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/
.------------------------------------------------------------------------,
\ GPG: 5F5A8D05 // F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05 /
'--------------------------------------------------------------------'
<muBarder> Y vos, Nw2o? A vos no te conozco pero debes ser flor de bala!
<Nw2o> hijo de un polvo callejero
Thanks Jeff, problem solved after using SQLite3.
Some nitpicks:
Why the error with SQLite2?
On ubuntu (where pysqlite uses sqlite2) at least *everyone* that tries
tg will get this error, he should ask why, he should install a new
package, find it (it's named python-pysqlite2) and try again.
That's not a good first impression IMHO.
Now that visit is in you can't start your project if you don't make a
db, I think that's really annoying (1 more step). It seems that this
happens even after disabling it (but I'm sure that I'm probably doing
something wrong).
The log is full of
...
2006-01-09 01:21:29,265 turbogears.visit DEBUG sending updates...
You should use
raise turbogears.redirect("/")
or
turbogears.redirect("/")
instead of
raise cherrypy.HTTPRedirect(turbogears.url("/"))
There is whitespace incosticency betwenn your new code and the previous
(for example look at expose decorators). :P
Again I think we shouldn't put identity on a quickstarted project.
At first sight less is better and easy to learn, at least in my
opinion.
Moreover identity is not required by every user and when you quickstart
a project if you never used TG you start wondering what it's happening
inside login and logout with this big dict and cherrypy internals
exposed.
Anyway keep up the great work. ;-)
Ciao
Michele
> Why the error with SQLite2?
> On ubuntu (where pysqlite uses sqlite2) at least *everyone* that tries
> tg will get this error, he should ask why, he should install a new
> package, find it (it's named python-pysqlite2) and try again.
> That's not a good first impression IMHO.
I don't know what's causing the error. I'm using SQLObject as per the
documentation. Perhaps there's a bug in the SQLObject code with
regard to SQLite2 (although someone indicated some MySQL users were
seeing the same problem).
> Now that visit is in you can't start your project if you don't make a
> db, I think that's really annoying (1 more step). It seems that this
> happens even after disabling it (but I'm sure that I'm probably doing
> something wrong).
That seems weird. Naturally, if you have Visit tracking enabled and
you don't have a DB that's going to cause trouble, but if Visit
tracking is disabled, it shouldn't complain...
Ah. Found it. I create the table in the constructor for the
VisitFilter, which is before I check whether Visit Tracking is
enabled... I should fix that or trap the exception...
> The log is full of
> ...
> 2006-01-09 01:21:29,265 turbogears.visit DEBUG sending updates...
Removed. That was more for my testing purposes (I'd not used threads
with Python yet).
> Again I think we shouldn't put identity on a quickstarted project.
> At first sight less is better and easy to learn, at least in my
> opinion.
> Moreover identity is not required by every user and when you
> quickstart
> a project if you never used TG you start wondering what it's happening
> inside login and logout with this big dict and cherrypy internals
> exposed.
I disagree (obviously). Per a recent thread, adding support for
features after quickstart is problematic and basically too hard to do
right. So having all the goodies there is important.
On the otherhand, I agree that there's a lot of exposed nastiness
that can be improved. I was thinking of adding a controller to handle
login and logout which would hide most of the pipes and wires
currently exposed.
> You should use
> raise turbogears.redirect("/")
> or
> turbogears.redirect("/")
Cool. I remember seeing this bandied about, but didn't realise it was
in yet.
> Anyway keep up the great work. ;-)
Actually, one of the features I *CAN'T* add to TurboGears is
aggregated identity from multiple sources (DB, LDAP, IMAP, etc)
because it would be considered a Single Sign On solution and my
employer (an SSO provider) would own it. Not good.
--
Jeff Watkins
http://newburyportion.com/
"Computers are like Old Testament gods; lots of rules and no mercy."
-- Joseph Campbell
If someone is still having problems, could you try this latest code
(r485) and tell me if it helps? I'm just grasping at straws here...
On 8 Jan, 2006, at 9:22 pm, Jeff Watkins wrote:
> I don't know what's causing the error. I'm using SQLObject as per
> the documentation. Perhaps there's a bug in the SQLObject code with
> regard to SQLite2 (although someone indicated some MySQL users were
> seeing the same problem).
--
Jeff Watkins
http://newburyportion.com/
Computers, they're just a fad.
So how is this supposed to work exactly? I've "from
turbogears.identity.soprovider import *" in my model.py file. I can
only get it to create the tg_* tables by modifying my sqlobject.txt file.
- jmj
Too bad. :-(
Ciao
Michele
So how is this supposed to work exactly? I've "from turbogears.identity.soprovider import *" in my model.py file. I can only get it to create the tg_* tables by modifying my sqlobject.txt file.
--
Jeff Watkins
'I know about people who talk about suffering for the common good. It's never bloody them! When you hear a man shouting "Forward, brave comrades!" you'll see he's the one behind the bloody big rock and the one wearing the only really arrow-proof helmet!'
-- Rincewind gives a speech on politics. (Terry Pratchett, Interesting Times)