[TurboGears] Re: [spam] 1.6/pts [TurboGears] Need Help to develop a call login systems with less functionality, please help..

2007-04-18 Thread Robin Haswell

Jay wrote:
 Hi,
 
 I am a business computing under graduate student ...
 I haven't done any programming ...
 need to finish this asap


Try:
http://jobsearch.monster.com/Search.aspx?q=mcdonaldsfn=13lid=re=130cy=usJSNONREG=1

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: Debian and services

2007-04-18 Thread Robin Haswell

Try http://www.plope.com/software/supervisor2/

You will need to write your own init script for it though, however you
can simply use /etc/init.d/skeleton as a base.

-Rob

Chris wrote:
 Hi
 
 I have got a turbogears site working fine on my debian etch
 installation,
 What i would like to do is put the site as a service but their doesn't
 seem to be any easy way of doing this can anybody point me in the
 right direct as to how do this?
 
 
 Chris
 
 
  

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: Shouldn't we default to gzip compression on?

2007-02-22 Thread Robin Haswell

Jason Chu wrote:
 RAD means Rapid Application Development.  How does gzip on vs. gzip off
 affect the speed of application development?

Because RAD tools shouldn't cater for the lowest common denominator,
they should cater for the most popular configuration. Not having to set
a bunch of common options each time you make a new project because of
some edge-cases is a good thing.

 Wow... aggressive...

 What benefit do you have turning it on?  The original poster says,
 wouldn't pretty much everyone always want gzip compression?, my
 question is would they?  What do they gain from it being on by default
 vs. needing to be uncommented?

Because administrating webservers and writing web applications is my day
job. Gzip increases responsiveness of a website for users - and if
you're using AJAX (as a lot of TG apps will be) this is extremely
important! I think it should be defaulted on because most people won't
know about the option and probably won't turn it on if they just came
across it.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: How to get value behind # symbol in url?

2007-02-21 Thread Robin Haswell

Just so that future readers of this thread are clear:

There is no way for your server (CherryPy or otherwise) to know what
comes after the # (known as the URL fragment). This is a limitation of
HTTP. The data is just not sent to the server.

Olli Wang wrote:
 Hi, I want to get the value behind # like what Google does, for
 example, if my url is '/testing#123', I want to get '123' in my
 testing exposed method. Is it possible in CherryPy? Thanks.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: Shouldn't we default to gzip compression on?

2007-02-21 Thread Robin Haswell

Richard Harding wrote:
 I have to disagree with your opinion. It's definitely not a great idea 
 while developing as you want everything as transparent as possible.

I really have to disagree with yours, strongly. TG is a RAD tool, this
stuff should be enabled by default. If you can be bothered to dig out
ethereal you can change a config option while you're at it. It's usually
obvious when looking at data if you're observing something that's
compressed.

Given that maybe 1% of people are going to be negatively affected by
defaulting this on, and nearly 100% of that 1% will know instantly
what's wrong and how to turn it off, I am very strongly in favour of
defaulting this on, and I believe all counter points raised in this
thread to be contrived at best.

That's my £0.02

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: Shouldn't we default to gzip compression on?

2007-02-21 Thread Robin Haswell

Gregor Horvath wrote:
 Isn't this increasing the server load dramatically?
 Any experiences or figures on this?

Yeah, on Apache + PHP *enabling* gzip *increases* responsiveness
dramatically. This is extremely noticeable when using phpMyAdmin over a LAN.

The vast majority of web applications are I/O bound on the network, not
processor bound. Decreasing your remote I/O requirements is a very good
thing.

On Apache, gzip is performed by the C library zlib, which is extremely
fast and has almost zero effect on performance.

I believe Python (and CP) utilise zlib also, so is suspect the
performance impact will be immeasurable, especially if you consider that
most of the rest of the HTTP request is handled by Python code.

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: Ticket 1109 - Why hasn't this been fixed?

2007-02-21 Thread Robin Haswell

tsume wrote:
 Why hasn't there been a patch in the repository for this? Sure, users
 could look at the ticket and download the patch, but they'll rather
 just say, aww TurboGears Sucks, I'm going to use something else.

I'd guess, from looking at the ticket, because the patch is non-ideal.
If someone would write a fix that works better for all cases I'm sure
that would be accepted.

Please, feel free.

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: another TurboGears project completed and launched!

2007-02-21 Thread Robin Haswell

Simon Wittber wrote:
 Scouta is a recommendation system for videos, podcasts and other
 media. It is built on Python and TurboGears technology.


Your blog is powered by WordPress, boo!

-1 for defection.

;-)

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: Turbogears Ubuntu dependencies (please read if ur in this platform)

2007-02-06 Thread Robin Haswell

Have you considered using one of the VMWare Player images for future
testing like this?

-Rob

Jorge Vargas wrote:
 lots of stuff about testing in Ubuntu

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: Full-Text Search suggestions

2007-01-31 Thread Robin Haswell

chiangf wrote:
 Has anyone actually employed a full-text search that they like?  I was
 reading another thread and there were many tools listed (hype,

Couldn't make it compile (think)

 pylucene

Barfs on CP threads

 merquery

Again wouldn't compile I think

 , etc.), but it seemed that either no one could get
 it working (hype), didn't like it (pylucene), or it hasn't actually
 started yet (merquery).

I suggest you bite the bullet and use MySQL FULLTEXT search with
handwritten SQL. I stupidly set my app up with InnoDB tables which don't
support FTS, in the end I ended up using PyLucene and a simple XML-RPC
server to access it with. Ridiculous.

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: TurboEntity - ActiveMapper status?

2007-01-25 Thread Robin Haswell

Pleh, the world is too big for conferences.

Seriously though, is it feasible for people in California to just fly to
 DC and attend? What does a cross-country airfare cost you guys? How
long does it take? We don't have a real domestic air service here which
means people in the north of England on a lower/middle-class salary can
find it difficult even to attend conferences in London.

Jonathan LaCour wrote:
 Seriously though, anyone who wants a sneak peek, just come and find
 me at PyCon, and I'll show you what we have so far.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: MySQL encoding trouble

2006-11-14 Thread Robin Haswell

Stefan Meretz wrote:
 test data (edited via phpMyAdmin):

If this means I put in my test data with phpMyAdmin, then I'd guess
there's your trouble. PHP doesn't support Unicode, MySQL doesn't support
Unicode, and in my experience PMA's unicode-awareness is patchy. I'd say
PMA has caused your unicode problem.

-Rob

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: MySQL encoding trouble

2006-11-14 Thread Robin Haswell

Stefan Meretz wrote:
 Both, PMA and MySQL, support Unicode.

Good to hear you fixed your problem, although I'd be wary of how much 
Unicode support MySQL has.

Example:

Create a table with a column defined as varchar(4), with one of the 
Unicode collations.

Insert '' into the column, then select it out again.

You'll find your select result only contains 'öö'. This is because MySQL 
varchar(4) means 4 *bytes*, not characters (and ö is two bytes). It's 
not multibyte character aware.

This can cause lots of exceptions in Python when multibyte characters 
are truncated at the size limit of a column. When Python sees half a 
multibyte character, an exception is raised.

-Rob

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: search by alternate ID fails with MySQL

2006-11-13 Thread Robin Haswell

[EMAIL PROTECTED] wrote:
 Can we please see your class declaration?  This particular feature
 works fine for me, so we're missing something here...


Are you think reserved keyword collision? Because that's what I am :-)

-Rob

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: ActiveMapper

2006-11-10 Thread Robin Haswell

Comments below.

Ilias Lazaridis wrote:
 TurboGears is essentially a toy as long as is cannot rely on a
 industry-standard-compliant (at least a subset) persistency-layer.

You mean like PHP is a toy? PHP only developed a persistency layer
beyond thin wrappers around C DB libraries quite recently, yet it seems
to be doing alright. PEAR::DB is nothing more than a fancy SQL injection
barrier.

I think you're missing the point here.

I'd say most of the time TG has to work in an existing environment. That
probably means MySQL, or Postgres. It's pretty much certain that if TG's
model layer is going to abstract away anything, it'll be abstracting
away an RDBMS.

SO does a pretty good job of it to be honest. If it weren't for the
profound performance problems and stagnant development I'd say SO is
pretty much as good as it can get. What I really think will be the
clincher is SA with an SO API.

TG is aimed at making developers' lives easier. Developers know RDBMS.
That's how they think. TG's aim should be to allow developers to use an
RDBMS exactly how they always did without the sheer tedium of SQL.

 [note to readers:
 Maybe some friend of Mr. Vargas send's hime a private message,
 explaining him that even prefixing the word stop with please keeps
 up a rude tenor. I've see this please stop in context of a newcomer -
 very annoying to see.]

I think he was annoyed that your stupid ideologies are irrelevant and
disruptive. Unfortunately Jorge has to represent TurboGears so he
probably can't be rude. However I've got nothing to do with TG so I can
say pretty much what I like.

Stop being disruptive. If you continue to feel the need to impose your
viewpoints on us please do it with a patch, not rhetoric.

-Rob

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: TurboEntity

2006-11-10 Thread Robin Haswell

Jonathan LaCour wrote:
 Expect an announcement in the next few weeks about TurboEntity and
 ActiveMapper joining forces.  We are in active talks, and the end
 result will likely be slightly different than what is available now.

That sounds great, I really appreciate the work you guys are putting in
on the SA front. I left TG because of SO!

I wonder will there be an oppertunity to request some features? There
are bits of SO that I really liked that I miss, but I don't want to
sound whine-y :-)

Cheers

-Rob

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: Limitation of activemapper?

2006-11-09 Thread Robin Haswell

Goddamn this post helped me so much. I didn't realise I could mix 'n' 
match ActiveMapper and AssignMapper. So glad I didn't have to rewrite my 
entire model because I wanted a complicated join!

SqlAlchemy, I want your babies. And they will be beautiful.

-Rob

Mark Godfrey wrote:
 Chris,
 
 I believe ActiveMapper alone won't do this, but you can leverage the
 rest of SQLAlchemy to do it.
 Below is an example of how I've managed to solve the same problem in my
 current project.
 
 
 # create a many to many join between TestObject and TestObject
 related_items_table = Table('related_items',
 metadata,
 Column('id', Integer, ForeignKey(test_object.id)),
 Column('related_id', Integer, ForeignKey('test_object.id')))
 
 # Our class definition
 class TestObject(ActiveMapper):
 ## class mapping sets up the DB-Object map
 class mapping:
 __table__ = test_object
 ## id stores the unique primary key for this product
 id = column(Integer, primary_key=True)
 ## name gives this product a name
 name = column(Unicode(255))
 ## description gives this product a description
 description = column(Unicode(512))
 
 # Then add a relation to TestObject's mapper instance
 TestObject.mapper.add_property('related', relation(TestObject,
 secondary=related_items_table, uselist=True,
 primaryjoin=TestObject.c.id==related_items_table.c.id,
 
 secondaryjoin=TestObject.c.id==related_items_table.c.related_id,
 foreignkey=TestObject.c.id))
 
 
 This will create a relation called TestObject.related which will
 contain a list of TestObject instances, which is what I think you are
 after.
 I hope this helps you solve your issue.
 
 Regards,
 
 Mark.
 
 On Nov 6, 2:33 pm, percious [EMAIL PROTECTED] wrote:
 Maybe this post wasn't clear.  Basically I have two foreign keys in a
 table which point to the same *other* table.  Active mapper does not
 seem to support this.  Anyone have an idea how I can get around the
 problem?

 -chris
 
 
  

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: ActiveMapper

2006-11-02 Thread Robin Haswell

Perhaps a very quick sub-release containing just this fix would be in
order? It's happened before, and many people will be using SA+Identity.

-Rob

Jorge Vargas wrote:
 please stop asking this.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: trying to meet python/turbogears users in my area

2006-10-30 Thread Robin Haswell

Anyone for United Kingdom, especially Yorkshire-area?

-Rob


Michael Steinfeld wrote:
 Hi,
 
 It's probably a long shot, but I am in Sarasota Florida (hour south of
 Tampa) and would like to form a users group or even just meet for coffee
 with other people interested in TurboGears and Python.
 
 If you are interested please let me know.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Getters and setters with SQLAlchemy

2006-10-28 Thread Robin Haswell



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Getters and setters with SQLAlchemy

2006-10-28 Thread Robin Haswell

Hey guys

In my model I have Post objects, which are a bit like stories on Digg. 
Each story has a stub, which is the URL-friendly form (eg, Hey guys! 
= Hey_guys). With SQLObject I think you could do:

def _set_title(self, value):
self._SO_set_title(value)
stub = self.create_stub(value)
self.stub = stub

Is there an equivalent for SQLAlchemy? I'm using ActiveMapper, if that 
matters.

Thanks

-Rob


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] SQLAlchemy + ActiveMapper: Same-table many_to_many join

2006-10-28 Thread Robin Haswell

Hey guys

In my model I have a Post(ActiveMapper) class, and a table posts_rel(id 
int primary key, parent_post_id int, child_post_id int). I need to be 
able to define two many_many relations on my Post class, one that 
represents:

select post.* from posts, posts_rel where posts_rel.child_post_id = 
post.id and posts_rel.parent_post_id = %s % (self.id)

(ie, all the child posts for this post)

And one that represents:

select post.* from posts, posts_rel where posts_rel.parent_post_id = 
post.id and posts_rel.child_post_id = %s % (self.id)

(ie, all the parent posts - or all the posts for which this post is a child)

With the current many_to_many relations I can't see a way to specify 
which columns to join on, could someone give me a hand please?

Thanks

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: File upload - how to get filename?

2006-10-28 Thread Robin Haswell

Bob Ippolito wrote:
 def upload_form(self, formfile):
 import tempfile
 import shutil
 from pysqlite2 import dbapi2 as sqlite
 
 newfile = tempfile.NamedTemporaryFile()
 shutil.copyfileobj(formfile.file, newfile)
 newfile.flush()
 con = sqlite.connect(newfile.name)

Looks good to me boss, I'll give it a test when I find out how to relate 
my Posts!

Cheers

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: SQLAlchemy + ActiveMapper: Same-table many_to_many join

2006-10-28 Thread Robin Haswell

Karl Guertin wrote:
 This is why I don't use ActiveMapper.

I dislike the idea of 3 separate statements to define a model. I was 
spoiled by SQLObject :'(

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] File upload - how to get filename?

2006-10-27 Thread Robin Haswell

Hey

I need to get the filename of an uploaded file from CherryPy. I can't 
write this to a different (known) file because I don't seem to be able 
to get a filename out of os.tmpfile(). I need the filename to pass to 
pysqlite2 - I'm uploading sqlite databases which need to be read. If 
anyone can let me know how to get the filename of an uploaded file (I 
assume it's some temp file), or any other solution to my problem, it 
would be very much appreciated.

I don't really want my own method of generating temp filenames - I'd 
prefer to leave symlink attack prevention to the professionals.

Cheers

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: Default identity w/ SQLAlchemy - missing relations

2006-10-26 Thread Robin Haswell

[EMAIL PROTECTED] wrote:
 I think we need an optimizing sql compiler for tg.  All my sqlobject
 code is slow there is no turboboost switch.  Its like my included
 batteries are one shots.  I need jumper cables over here.

Sorry mate, SQLObject is slow by design.

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: Default identity w/ SQLAlchemy - missing relations

2006-10-26 Thread Robin Haswell

Steve Holden wrote:
 Perhaps that phrase is a little misleading. Object mappers tend to be 
 slower than hand-crafted SQL because of the additional generality they 
 provide. I'm sure Ian Bicking didn't start out with slowness asa design 
 goal :)


Perhaps. I don't think Ian Bicking envisaged people working with large
datasets in SQLObject - the technique of selecting a list of IDs then
selecting the data for each ID in a seperate query is horrific.
SQLAlchemy seems to perform much better, by selecting all the data it
needs at once then constructing the objects from that dataset, *vastly*
increasing the speed, to a level on a par with user-generated code.

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: MySQL or Postgres for a production site?

2006-10-25 Thread Robin Haswell

Bruno Desthuilliers wrote:
 I would definitively avoid MySQL for transaction-heavy, mission-critical
 stuff. FWIW, no we have SQLite for lightweight, read-fast db, I would
 definitively avoid MySQL, period.

Please do not spread FUD on lists used by people liable to believe it.
Read-heavy applications benefit most from clusters of replicated
servers, something impossible/improbable with SQLite, and something
MySQL is superb at.

FWIW, Google AdWords runs on MySQL. I don't know (obviously) if it uses
transactions, but I'm betting it does. However AdWords is pretty much
the definition of mission-critical. It comprises nearly 100% of
Google's income. Our business uses MySQL exclusively within its Unix
department, and our primary server has been running for nearly two years
and has never failed. MySQL has only ever been restarted for a handful
of security and version updates, resulting in a 2-year downtime of
approximately 20 seconds. It currently handles about 1000
requests/second, mostly transactional.

So I reiterate: Don't spread FUD. MySQL has a niche, and that particular
niche has an absolutely HUGE market.

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: Default identity w/ SQLAlchemy - missing relations

2006-10-24 Thread Robin Haswell

Robin Haswell wrote:
 And my identity code is the one provided by the template, but I'll paste
 it below anyway. I've tried commenting out either the Group.users or
 User.groups line, to no avail. Version info:


I have fixed this! You need to comment out ALL the duplicate relations,
not just the ones interfering with what you're doing. I removed the two
dups from Group as per the changeset Jorge mentioned and everything it
hunky dory. I'll update wiki pages now.

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Default identity w/ SQLAlchemy - missing relations

2006-10-23 Thread Robin Haswell

Hey guys

I'm returning to TG again for a private project, and I'm aiming at using
SQLAlchemy to get over the hideous performance I experience with SQLObject.

Anyway, this issue must have been raised before, but my problem is that
the relations defined with ActiveMapper for identity don't appear. Quick TB:

[EMAIL PROTECTED]:/www/dg-admin$ tg-admin shell
Python 2.4.3 (#2, Oct  6 2006, 07:52:30)
[GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2
Type help, copyright, credits or license for more information.
(CustomShell)
 User.get(1).groups
[2006-10-23 14:40:52,553] [engine]: SELECT tg_user.user_id AS
tg_user_user_id, tg_user.created AS tg_user_created, tg_user.user_name
AS tg_user_user_name, tg_user.display_name AS tg_user_display_name,
tg_user.password AS tg_user_password, tg_user.email_address AS
tg_user_email_address
FROM tg_user
WHERE tg_user.user_id = %s ORDER BY tg_user.user_id
[2006-10-23 14:40:52,553] [engine]: [1]
Traceback (most recent call last):
  File console, line 1, in ?
AttributeError: 'User' object has no attribute 'groups'


And my identity code is the one provided by the template, but I'll paste
it below anyway. I've tried commenting out either the Group.users or
User.groups line, to no avail. Version info:

[EMAIL PROTECTED]:/www/dg-admin$ tg-admin info
TurboGears Complete Version Information

TurboGears requires:

* TurboGears 1.0b1
* nose 0.9.0
* configobj 4.3.2
* RuleDispatch 0.5a0.dev-r2115
* setuptools 0.6c3
* FormEncode 0.6
* cElementTree 1.0.5-20051216
* PasteScript 0.9.8
* elementtree 1.2.6
* simplejson 1.4
* SQLObject 0.7.1
* CherryPy 2.2.1
* TurboKid 0.9.9
* TurboCheetah 0.9.5
* TurboJson 0.9.9
* PyProtocols 1.0a0
* Cheetah 2.0rc7
* PasteDeploy 0.9.6
* Paste 0.9.8.1
* FormEncode 0.6
* kid 0.9.3
* Cheetah 2.0rc7
* elementtree 1.2.6

Identity Providers

* sqlobject (TurboGears 1.0b1)
* sqlalchemy (TurboGears 1.0b1)

Any help would be appreciated.

Code below.

Cheers

-Rob

class Visit(ActiveMapper):
class mapping:
__table__ = visit
visit_key = column(String(40), primary_key=True)
created = column(DateTime, nullable=False, default=datetime.now)
expiry = column(DateTime)

def lookup_visit(cls, visit_key):
return Visit.get(visit_key)
lookup_visit = classmethod(lookup_visit)

# tables for SQLAlchemy identity

user_group = Table(user_group, metadata,
  Column(user_id, Integer,
  ForeignKey(tg_user.user_id),
  primary_key=True),
  Column(group_id, Integer,
  ForeignKey(tg_group.group_id),
  primary_key=True))

group_permission = Table(group_permission, metadata,
Column(group_id, Integer,
ForeignKey(tg_group.group_id),
primary_key=True),
Column(permission_id, Integer,
ForeignKey(permission.permission_id),
primary_key=True))


class VisitIdentity(ActiveMapper):
class mapping:
__table__ = visit_identity
visit_key = column(String(40), # foreign_key=visit.visit_key,
  primary_key=True)
user_id = column(Integer, foreign_key=tg_user.user_id, index=True)


class Group(ActiveMapper):

An ultra-simple group definition.

class mapping:
__table__ = tg_group
group_id = column(Integer, primary_key=True)
group_name = column(Unicode(16), unique=True)
display_name = column(Unicode(255))
created = column(DateTime, default=datetime.now)

users = many_to_many(User, user_group, backref=groups)
permissions = many_to_many(Permission, group_permission,
   backref=groups)


class User(ActiveMapper):

Reasonably basic User definition. Probably would want additional
attributes.

class mapping:
__table__ = tg_user
user_id = column(Integer, primary_key=True)
user_name = column(Unicode(16), unique=True)
email_address = column(Unicode(255), unique=True)
display_name = column(Unicode(255))
password = column(Unicode(40))
created = column(DateTime, default=datetime.now)

groups = many_to_many(Group, user_group, backref=users)

def permissions(self):
perms = set()
for g in self.groups:
perms = perms | set(g.permissions)
return perms
permissions = property(permissions)


class Permission(ActiveMapper):
class mapping:
__table__ = permission
permission_id = column(Integer, primary_key=True)
permission_name = column(Unicode(16), unique=True)
description = column(Unicode(255))

groups = many_to_many(Group, group_permission,
  backref=permissions)


[TurboGears] Re: Default identity w/ SQLAlchemy - missing relations

2006-10-23 Thread Robin Haswell

Lee McFadden wrote:
 Commenting out one or the other of those lines (but not both) is the
 fix for this little bug in the quickstart template.  Did you restart
 tg-admin shell after making the changes to your model.py?

Yes! I'm not that stupid :-P Observe:

[EMAIL PROTECTED]:/www/dg-admin$ tg-admin shell
Python 2.4.3 (#2, Oct  6 2006, 07:52:30)
[GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2
Type help, copyright, credits or license for more information.
(CustomShell)
 User.relations
{'groups': sqlalchemy.ext.activemapper.many_to_many object at 0xb7442aec}
 Group.relations
{'permissions': sqlalchemy.ext.activemapper.many_to_many object at
0xb744252c}
 User.get(1).groups
[2006-10-23 15:51:50,663] [engine]: SELECT tg_user.user_id AS
tg_user_user_id, tg_user.created AS tg_user_created, tg_user.user_name
AS tg_user_user_name, tg_user.display_name AS tg_user_display_name,
tg_user.password AS tg_user_password, tg_user.email_address AS
tg_user_email_address
FROM tg_user
WHERE tg_user.user_id = %s ORDER BY tg_user.user_id
[2006-10-23 15:51:50,664] [engine]: [1]
Traceback (most recent call last):
  File console, line 1, in ?
AttributeError: 'User' object has no attribute 'groups'
 Group.get(1).users
[2006-10-23 15:51:52,196] [engine]: SELECT tg_group.group_name AS
tg_group_group_name, tg_group.group_id AS tg_group_group_id,
tg_group.display_name AS tg_group_display_name, tg_group.created AS
tg_group_created
FROM tg_group
WHERE tg_group.group_id = %s ORDER BY tg_group.group_id
[2006-10-23 15:51:52,196] [engine]: [1]
Traceback (most recent call last):
  File console, line 1, in ?
AttributeError: 'Group' object has no attribute 'users'



Notice how Group.relations doesn't contain the users relation, which
it would if I hadn't commented one of them out.

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: Default identity w/ SQLAlchemy - missing relations

2006-10-23 Thread Robin Haswell

Lee McFadden wrote:
 I'm now getting the same thing, although I wasn't last night when
 helping someone in IRC.  Have you also upgraded to SQLAlchemy 0.3 or
 installed SA since 0.3 was released?
 
 Lee


I was using SA 0.28, which came with TG 1.01b. I have since performed
`sudo easy_install -U -Z SQLAlchemy` to get SA 0.30 and the problem is
still there. I also get a muthaload of debugging output! But no fix.

What's odd though is that my custom objects using one_to_many seem to
work fine. If Jonathan LaCour (sp?) has no clues I'll set up my own
many_to_many and see if it makes a difference.

One thought I had is that I'm using MySQL 5, and although SA seems to
identify its relational columns with a foreign_key attribute (little too
automagic for my liking), MySQL doesn't preserve relations without
manual intervention.

However, starting with a fresh SQLite database yields the same result,
so that last paragraph is now a bit redundant.

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: TG Performance?

2006-10-17 Thread Robin Haswell

Stuart Clarke wrote:
 I remember hearing something a while back, about CherryPy not liking
 multiple concurrent requests from the same browser.  Does this relate to
 sessions specifically?  Or is it a more general problem?
 
 Can anyone comment?

That was me, and I never had a resolution. To this day TG still hangs on
that application.

I've never done any high traffic sites with TG because I get the
distinct impression that I would lose my job if I did. Obviously I can't
afford that.

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Why I'm knocking TG on the head for a bit

2006-08-08 Thread Robin Haswell

Hey guys

I've decided to knock TG on the head for a while and pick up the pace on
PHP a bit, driving more into PHP5 with some of my Python lessons. I
don't have a problem with Python by the way, just not for web
development. Anyway I thought you might be interested in why I'm doing
this, so here are some points:

CherryPy


* It's slow and doesn't allow me the fine-grained control I need for my
web projects.
* No obvious easy way to do URL rewriting. And no controller.default()
doesn't count.
* I think the sluggishness is mostly because it's written in Python.
Also I can't find a good way to let it handle multiple requests at a
time. I wrote an AJAX in-house tool recently. It aggregates data from a
website using BeautifulSoup. There's an option to aggregate lots of data
at the same time, which it achieves by doing lots of XMLHTTP requests.
CherryPy doesn't seem happy with doing more than 2 processes at a time,
even with thread_pool increased. There could also be a locking issue.
I'm pretty sure this isn't related to FF's max connections/server
features - I'm aware of those. I know a similar PHP tool works fine.

SQLObject
=

* I really like SO. Its inteface is great, I wish I could do joins in
such an easy manner with PHP. However it is just so slow and flaky I
can't handle it any more. Selecting a list of IDs then selecting each
row by ID in turn is just unacceptable. REALLY unacceptable. Even my
project manager has noticed a website is slow because of this.
* I can't stand how SO will bomb out on UnicodeErrors causing a DOS on
that page.
* I also can't stand how if you remove a row from the database that has
a reference somewhere, SO will raise SQLObjectNotFound whenever it goes
near that data. My PHP apps don't suffer from this because I write the
complete three-table inner join in SQL, which will ignore missing
references (and is a boatload faster). It makes the DB a little messy
sometimes, but that's nothing compared to DOSing the page with a 500
error. Updating my CRUD methods every time I associate a new object is
*not* fun web development.

I know the last point can be solved with using a DB that supports
foreign key constrains. We use MySQL, there are no PG servers, that's
just the way of it. I could convert my tables to InnoDB - I probably
will in future.

Kid
===

* The NoneType is not callable bug gets old real fast

Documentation
=

Mostly my fault for using 0.9a*, but 0.9a* contains the only features
which attract me. Nevertheless, no docs is no good, and I need to get
stuff done *now*

=

However I will miss some things about TG. Identity is great, top draw on
that one. I'll have to port it to PHP very soon. I also like widgets,
very much, although without accurate documentation right now it's
difficult for me to save time by using them on anything but the most
basic of forms. I'm sure with time this problem will go away as I
remember more of the API.

I'm pretty sure I'll come back, probaly when First Class is ready. As I
understand it, FC will be WSGI (which I think means I can run it under
Apache without too much flakiness). Also SA support should be properly
finished, tested and documented by then, which means I can ditch SO. I
will never use SO until it fixes the way in which it selects data from
the database. Sometimes slow is just too slow.

Actually I'll probably use TG before then. There are certain classes of
sites I think TG would be perfect for, but I'll have to think very hard
about the specific requirements of the site before firing up TG again.

Thanks guys, you're doing a great job.

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: while upload file with tg,it show sucessfully,but actually it don't and dextroy the file

2006-07-31 Thread Robin Haswell

Please don't put questions as subject lines.

I think you need to move the file from its temporary location while the
script is active (somewhere in /tmp) to its new home.

-Rob

Nico wrote:
 why?
 
 
  

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Odd server hang, TB included

2006-07-21 Thread Robin Haswell

Hey guys

My CP server hung badly this morning, so I thought you guys might like
to see the traceback:

ERROR DURING TASK EXECUTION unsubscriptable object
Traceback (most recent call last):
  File
/usr/local/lib/python2.4/site-packages/TurboGears-0.9a6-py2.4.egg/turbogears/scheduler.py,
line 391, in __call__
self.execute()
  File
/usr/local/lib/python2.4/site-packages/TurboGears-0.9a6-py2.4.egg/turbogears/scheduler.py,
line 218, in execute
self.action(*self.args, **self.kw)
  File /var/www/gotoed/gotoed/controllers/news.py, line 139, in get_news
[ f.update() for f in Feed.select() ]
  File /var/www/gotoed/gotoed/model.py, line 85, in update
f.update()
  File /var/www/gotoed/gotoed/model.py, line 134, in update
if len(self.title)  40 and
FeedItem.selectBy(title=self.title).count()  1:
  File
/usr/local/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1675-py2.4.egg/sqlobject/sresults.py,
line 188, in count
count = self.accumulate('COUNT(*)')
  File
/usr/local/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1675-py2.4.egg/sqlobject/sresults.py,
line 172, in accumulate
return conn.accumulateSelect(self, *expressions)
  File
/usr/local/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1675-py2.4.egg/sqlobject/dbconnection.py,
line 383, in accumulateSelect
val = val[0]
TypeError: unsubscriptable object


Exception in thread CPHTTPServer Thread-2:
Traceback (most recent call last):
  File /usr/lib/python2.4/threading.py, line 442, in __bootstrap
  File /usr/lib/python2.4/threading.py, line 422, in run
  File
/usr/local/lib/python2.4/site-packages/CherryPy-2.2.1-py2.4.egg/cherrypy/_cpserver.py,
line 114, in _start_http
  File
/usr/local/lib/python2.4/site-packages/CherryPy-2.2.1-py2.4.egg/cherrypy/_cpwsgiserver.py,
line 319, in start
  File
/usr/local/lib/python2.4/site-packages/CherryPy-2.2.1-py2.4.egg/cherrypy/_cpwsgiserver.py,
line 325, in tick
  File /usr/lib/python2.4/socket.py, line 169, in accept
sock, addr = self._sock.accept()
error: (24, 'Too many open files')

Traceback (most recent call last):
  File /usr/lib/python2.4/logging/__init__.py, line 712, in emit
self.stream.write(fs % msg)
AttributeError: 'str' object has no attribute 'write'
Traceback (most recent call last):
  File /usr/lib/python2.4/logging/__init__.py, line 712, in emit
self.stream.write(fs % msg)
AttributeError: 'str' object has no attribute 'write'
Traceback (most recent call last):
  File /usr/lib/python2.4/logging/__init__.py, line 712, in emit
self.stream.write(fs % msg)
AttributeError: 'str' object has no attribute 'write'
Traceback (most recent call last):
  File /usr/lib/python2.4/logging/__init__.py, line 712, in emit
self.stream.write(fs % msg)
AttributeError: 'str' object has no attribute 'write'
Terminated



Those last logging-related tracebacks happen on every page request
(production), so it served a few files before hanging altogether. I
couldn't stop the server with a KeyboardInterrupt, I had to use pkill
-f prod.cfg

Apparently this is related to too many files being open. lsof tells me I
have 2129 file handles open this morning (after killing the server
though). 303 of which belong to python and a whopping 1176 of which
belong to apache!

Anyway I will monitor python's file handles throughout the day and see
what happens.

Thanks now!

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Website's DVD link has a 404

2006-07-21 Thread Robin Haswell

Hey

I noticed while reading the new changelog that the website's link to the
DVD returns a 404.

I'm clicking The TurboGears Ultimate DVD on the right, which is a link
to http://www.turbogears.org/preview/ultimate.html, which doesn't exist.

Thanks

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: Redirecting 404 and leaving all else

2006-07-12 Thread Robin Haswell

Sylvain Hellegouarch wrote:
 Hello,
 
 Could you not try using a default page handler at the top of your
 controllers tree and catch all those 404 there then simply raise a
 different code?

I don't think the default method propagates down to mounted apps.

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: Unicode problems

2006-07-12 Thread Robin Haswell

Bruno Silva wrote:
 but this
 time the string appears all messed up in all the places. example: the
 word 'cão' appears as 'cão'.

Messed up where? I've found phpMyAdmin doesn't accurately represent
unicode data in the database. If it's messed up when viewing in CatWalk
then you have a problem.

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: Redirecting 404 and leaving all else

2006-07-12 Thread Robin Haswell

Sylvain Hellegouarch wrote:
 As I'm not sure we understand each other, I prefer to clarify my saying.
 
 Say you have a good old tree like this:
 
 forum = Forum()
 forum.topic = Topic()
 forum.topic.message = Message()
 
 If Forum contains a default method, it will be called when a message
 cannot be found. In such case you can totally raise a different HTTP code
 from there.
 
 Now I might miss your point altogether and look stupid :D


Really, while GIYFing this problem I read repeatedly that this was not
the case. The only problem I see is that I utilise default() elsewhere,
although I probably raise cherrypy.NotFound so it might work.

I've moved on to something else now but I'll check it out later and
report back.

Cheers

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: Unicode problems

2006-07-12 Thread Robin Haswell

Bruno Silva wrote:
 I see it messed up in catwalk and a kid template page I made. If I take
 off the use_unicode=1 from the dburi, then I see it right in catwalk and
 in the template.
 But what I can't understand, is why in the controllers.py I do
 p = Project(name=project_name, user=user)
 and it fires an UnicodeEncodeError
 
 and in the webconsole of the toolbox I can do this:
 u = User.get (1)
 p = Project(name=cão, user=u)
 
 with no problems.

I'm going to need a full traceback to answer that question. I need to
see what raised the exception.

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: Unicode problems

2006-07-12 Thread Robin Haswell

Gustavo Noronha Silva wrote:
 Hello,
 
 Take a look at the /etc/python2.4/site.py file (it may have other name
 depending on your GNU/Linux distribution, or on Windows). It probably
 has something like:


I should point out that this solution is *NOT* recommended as it is not
portable and masks other errors in your application. If it was portable
I would recommend it whole-heartedly. In my experience Python is not
Unicode friendly as it tries to coerce to default encoding far, far, far
too often.

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: Redirecting 404 and leaving all else

2006-07-12 Thread Robin Haswell

 I've moved on to something else now but I'll check it out later and
 report back.
 
 Cheers
 
 -Rob


Yeah that worked, now all I have to do is find out how to raise a 301
redirect :-)

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: Redirecting 404 and leaving all else

2006-07-12 Thread Robin Haswell

Sylvain Hellegouarch wrote:
 
Yeah that worked, now all I have to do is find out how to raise a 301
redirect :-)
 
 
 raise cherrypy.HTTPRedirect(url, 301)
 
 But I assume the TG wrapper for redirect doesn't allow it.

Cheers, I'll remember that. I just massaged cherrypy.response.status and
.response.headerMap this time though.

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: Ubuntu Dapper Drake

2006-07-03 Thread Robin Haswell

build-essential, actually :-)

-Rob

Gustavo Noronha Silva wrote:
 Em Sáb, 2006-07-01 às 17:23 +0200, Diez B. Roggisch escreveu:
 
[EMAIL PROTECTED] schrieb:
Install python-dev and built-essentials.
 
  ^
  build-essentials, actually
 
 See you,
 

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: Comet (aka long lived http connections) Ajax in turbogears

2006-06-30 Thread Robin Haswell

Jonathan LaCour wrote:
 There are not really any fundamental throughput problems in asyncore or
 asynchat that I know of, other than the fact that they are a little hard
 to use at first.  I suspect that you were putting long-running  
 operations
 inside your event loop, slowing down your I/O.

That was exactly the case

 An approach that often works well for me is to allow asyncore to do all
 of its work inside its own thread, and queue up the long-running tasks
 into a Queue and process them from a separate thread.  This works great
 for me, and still keeps things relatively simple.

Indeed, I later realised this could have been a good approach, but I
couldn't really bothered to implement it all again when I know that
preforking was a viable and stable solution

Thanks for your advice though, if I get another project to do in this
vain I'll try and get away with writing a library for this.

Cheers

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: Comet (aka long lived http connections) Ajax in turbogears

2006-06-30 Thread Robin Haswell

Kevin Dangoor wrote:
 Why didn't you try Twisted? It certainly seems like it would have  
 applied here...
 
 Kevin

At the time I wasn't aware that Twisted was a viable framework for this,
I only came across it while looking for HTML parsers at a later date.
However I think I would still be of the opinion that Twisted is very
heavyweight more suited to a dedicated service rather than ad-hoc
instances (of which there could be many running at a single time).

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: Comet (aka long lived http connections) Ajax in turbogears

2006-06-29 Thread Robin Haswell

I had big throughput problems with asyncore for non-trivial
applications. I was making an RSS aggregator and needed to pull in lots
of feeds at the same time to get the job done nearly as fast as
necessary. I found the overhead in parsing then storing the responses
caused my app to spend too long processing and not enough time reading
the buffer. The consequence was that there was lots of data waiting for
me on the socket which I couldn't read fast enough, causing the socket
to fill up and reject incoming packets. My throughput dropped to 25% of
my link bandwidth.

I re-implemented this app 4 times, and I concluded that:

asyncore: slow throughput
asynchat: slow throughput (same problem, hadn't worked it out until I
finished this one)
threaded: depressing locking issues - I now hate python's threading
preforked: fastest in both respects but least flexible. It's the
methodolgy I always use these days. My IPC is domain sockets. Chews
memory, cains cPickle, can't pass around SQLObjects.

I don't know if my experience applies to you, however bear in mind that
the most successful implementation of this kind of service has been
Apache, which is preforked or sometimes prethreaded.

-Rob

Arnar Birgisson wrote:
 I will most likely have a look at this soon. I have an upcoming
 project that includes a sort of BLF (busy-lamp-field) for an Asterisk
 PBX which would include phone extension status, employee presence and
 possibly some IM features. I'd like to test Comet instead of polling
 for updates.
 
 Are you talking about using asyncore (which I don't know yet, will
 read up on it after this email :o) and this code from medusa instead
 of Twisted, or as a complement?
 
 Anyways - any pointers would be well appreciated. :o)
 
 Arnar
 
  

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: validator help

2006-06-29 Thread Robin Haswell

False, inline syntax errors show up every time:

[EMAIL PROTECTED]:~$ cat DOC|python
 try:
 there's got to be a f'kin syntax error here somewhere :-)
 except:
 pass
 DOC
  File stdin, line 2
there's got to be a f'kin syntax error here somewhere :-)
 ^
SyntaxError: invalid syntax
[EMAIL PROTECTED]:~$

I think you can only catch syntax errors in eval'd code and code parsed
using the import statement:

[EMAIL PROTECTED]:~$ cat DOC|python
 try:
 eval(there's got to be a f'kin syntax error here somewhere :-))
 print We totally got away with that dude
 except:
 print Boned!
 DOC
Boned!
[EMAIL PROTECTED]:~$

** NOTE: ** I piped this in with bash to illustrate that the interactive
interpreter wasn't being clever.


Your point still stands though :-) If you *ever* type except:,
immediately stop and consider whether you really meant to do that or
not. There are legitimate reasons for catching all exceptions - I catch
all exceptions in my preforked socket-server abstraction, but only to
print them and carry on with the next job - but not a lot.

-Rob

Max Ischenko wrote:
 
 Do not use catch-all try/except block (you may have SyntaxError inside
 byName() method you''ll never see)
 
 
  

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: optimize SQLObject's SelectResults

2006-06-27 Thread Robin Haswell

Yeah I'm well aware, thanks. I'm also well aware that select id from
foo limit 10; select * from foo where id='1'; select * from foo where
id='2'; etc will never be fast. I'm all for saving memory. But most of
the time I just want to output a page in under 5 seconds.

Also this methodology assumes that either your SQL server and webserver
share the same memory or the SQL server is otherwise short of memory. In
my experience this is rarely the case. Even on shared servers the SQL
server is free to have over 80% of the available memory.

-Rob

Joost Moesker wrote:
From the SQLObject documentation:
 
 Select results are generators, which are lazily evaluated. So the SQL
 is only executed when you iterate over the select results, or if you
 use list() to force the result to be executed. When you iterate over
 the select results, rows are fetched one at a time. This way you can
 iterate over large results without keeping the entire result set in
 memory. You can also do things like .reversed() without fetching and
 reversing the entire result -- instead, SQLObject can change the SQL
 that is sent so you get equivalent results.
 
 You can also slice select results. This modifies the SQL query, so
 peeps[:10] will result in LIMIT 10 being added to the end of the SQL
 query. If the slice cannot be performed in the SQL (e.g., peeps[:-10]),
 then the select is executed, and the slice is performed on the list of
 results. This will generally only happen when you use negative
 indexes.
 
 
  

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: book cover

2006-06-09 Thread Robin Haswell

Kevin Dangoor wrote:
 You know that book we've been talking about? This is (roughly) what it
 will look like:
 
 http://www.blueskyonmars.com/2006/06/09/rapid-web-applications-with-turbogears-book-cover/
 
 Kevin

Interesting. Don't O'Reilly have a patent on books with an animal on the
cover?

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: book cover

2006-06-09 Thread Robin Haswell

Yeah, trademark.

http://duncanriley.com/2006/05/31/dogon-tim-oreilly-responds/ (beware
the bloggers)

Why did you go for the lightsaber?

To be honest.. I dunno if I like the cover. I think it looks too much
like a school maths textbook (apart from the saber) and doesn't inspire
me to think Ooh, fun web development which is kinda what TG is about.

Any chance of an image that hasn't been mashed through a
nearest-neighbour rescaler? You took a screenshot of xpdf didn't you :-)
Evince will scale it properly.

-Rob

Karl Guertin wrote:
 On 6/9/06, Robin Haswell [EMAIL PROTECTED] wrote:
 
Interesting. Don't O'Reilly have a patent on books with an animal on the
cover?
 
 
 They might have a trademark on animal covers but I don't think they
 could make a reasonable infringement case here. It's a lightsaber that
 just happens to have a python on it.
 
  

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: Synchronized Requests

2006-06-08 Thread Robin Haswell

Jorge Vargas wrote:
 each TG-db interaction is wrap inside a transaction so this wont be a
 problem.

I doubt that's true when MySQL is involved

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: SQLAlchemy or SQLObject?

2006-06-06 Thread Robin Haswell

I have to say, I have serious problems with SO and heavy-database
projects. The main ones are:

1. Maintaining object references, or rather, removing them if an object
is destroyed. You can't do Object.destroySelf(), you need to remove all
references to it first. This is because SO crashes badly if it comes
across a reference to a non-existant object.

Which leads me on to:

2. SO pulls too much stuff from the database

But also:

3. If SO comes across some bad Unicode data in a database it crashes
badly. It provides no method to catch the exception AND find out where
the bad data is. I was recently tasked with scanning a 4gb database
which I converted to work with SO to find out which of the millions of
records had problems.


I think SO has an excellent API, but the programming is too
unmaintainable and incomplete to make me want to try doing anything with
it in the future.

Bring on the SA compat layer!

-Rob

Max Ischenko wrote:
 For a short-term project (say, a couple of months) SQLObject is
 probably a  better choice - easier to get started, most things you may
 need will work.
 
 For a longer term project I'd seriously consider SQLAlchemy - quality
 of developemnt  docs yields more benefits than SO' familiarity.
 
 Just my opinion,
 Max.
 
 
  

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: Search options: Are there any, should we be considering them?

2006-06-05 Thread Robin Haswell

FWIW the only search solution I managed to get flying after trying all
of the proposals in this thread was a PyLucene based search servce
running on an XML-RPC server (using SimpleXMLRPCServer). This is because
PyLucene doesn't play friendly with threads unless you use this:

from PyLucene import PythonThread
import threading
threading.Thread = PythonThread

However that seemed to make CherryPy go *blort*

-Rob

Ben Lee wrote:
 2 pieces of useful data:
 
 1) http://wiki.apache.org/jakarta-lucene/LucyProposal
 
 Doug Cutting, Dave Balmain, Marvin Humphrey have got ASF approval for a
 C backend to lucene for all dynamic languages (Perl, Ruby, Java, et
 al.)  I expect a Python port to soon follow.
 
 2) generalized inverted indexes are coming to postgresql, which should
 enable much better in database full-text indexes.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: lighttpd and ws/scgi

2006-05-24 Thread Robin Haswell

 I also had lots of problems with flup for SCGI deployment, so we
 wrote our own asyncore-based WSGI/SCGI server.  

Hi,

Mini thread-jack, but I recently wrote a server with asyncore and found 
it to be less than good as I couldn't get full network i/o because of 
the amount of time being spent in my dispatcher.handle methods. How did 
you get this to work? I ended up porting my code to something similar to 
Apache's prefork mpm, based on SocketServer, which works beautifully. 
The only difference is my parent and children talk to each other with 
sockets and not SHM

(My app isn't actually a server - it's feed consumer, but I needed 
multiprocessing to fully utilise my bandwidth)

Cheers

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: small talk

2006-05-24 Thread Robin Haswell

beza1e1 wrote:
 What do you consider the killer features of TurboGears (especially
 compared to rails) ?

1) It's written in Python
2) It's not The darling of the open-source community
3) It doesn't use more magic than Harry Potter

and

4) I can make a website without feeling that I have to use 32pt 
Helvetica in all my input boxes

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: Best way to handle sub-project - creating and mounting

2006-05-24 Thread Robin Haswell

Kevin Dangoor wrote:
 Hi Robin,
 
 This area is the focus of TurboGears 1.1. At the sprint back in
 February, I had TurboGears with PasteDeploy on the front and it was
 pretty cool. But, that's not usable yet, and we haven't really started
 working on 1.1.
 
 There are two big issues when it comes to multiple application
 mounting that you'll have to deal with on your own right now (unless
 you want to help out with 1.1, but you'll probably be able to move
 more quickly if you're just using your own interim solution).

You're right, but I would like to help on 1.1 if I finished my paid 
projects any time soon

 The two
 issues are:
 
 1) configuration
 2) templating
 
 #1 is actually somewhat dealt with by cherrypy.tree.mount (what you
 were remembering). To use that, you just do
 cherrypy.tree.mount(/foo/bar, YourAppRoot())

Is there any way to add a config file to this so I can use a different 
sqlobject.dburi?

 #2 is that there is basically no way to override the master template
 for an app. Your only standard TurboGears route for customization is
 the sitetemplate, which may be enough for you.

Actually as it stands the master templates are all but empty and I 
utilise sitetemplate :-)

 Kevin

Cheers

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Best way to handle sub-project - creating and mounting

2006-05-23 Thread Robin Haswell

Hey guys

I was wondering what the best way of handling sub-projects would be,
both creating and mounting.

In essence I want to create lots of in-house tools with TG (bcoz it
rox), yet keep them as discrete as possible so we could pass them on to
friends/partners. I know you can mount a controller in the method
described for Catwalk, but I really want each one to be able to use a
(possibly) different set of database credentials. I remember someone
mentioning an alternative method of mounting - I think it was
cherrypy.mount or something similar, but I can't remember enough to
get anything out of Google :'(

Also would you recommend quickstarting a sub-project (so it could also
be used standalone), or just creating a directory tree that is suitable?

Could anyone provide some advice please?

Cheers

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: New 0.96a default db in dev.cfg?

2006-05-22 Thread Robin Haswell

I see these messages and I subscribe to TG via a regular IMAP E-mail box.

-Rob

Jorge Godoy wrote:
 Em Segunda 22 Maio 2006 18:05, Jorge Vargas escreveu:
 what you did?
 
 Nothing.  I'm also with the problem.  He asked if he was the only one and I 
 said that he wasn't. 
 

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: TurboGears identity authenticating against /etc/shadow

2006-05-20 Thread Robin Haswell

Hey there

You can use PyPAM from http://www.pangalactic.org/PyPAM/ to authenticate 
against Shadow. There are debian packages. I dunno if you're going to 
have much luck though - TG requests the user data by username and 
compares the password with the supplied value, possibly hashed - with 
PAM you need to know the hashed password before you hash the supplied 
password - because you need to know what the salt that was used is. I 
dunno if TG provides this ability.

But you can always your User model, and then overload the __cmp__ 
property of User.password :-)

-Rob

Andrey Petrov wrote:
 Hi,
 
 We're working on a web application in TurboGears and we came across a
 roadblock:
 
 We need to authenticate users (people who are logging in) against the
 /etc/shadow file on the server, while maintaining a separate (similar
 to the default) model of the users/groups/permissions in TurboGears.
 
 That is,
 A user enters the website, enters his login and password,
 TurboGears passes the call to another C program (or something else) to
 authenticate against /etc/shadow, if returns successfully then
 TurboGears lets the user log in successfully using the corresponding
 object in the User table.
 
 Is this capability already possible? Has anyone done something similar?
 Anyone have any pointers?
 
 Here are some ideas we've explored:
 
 1. Interception:
 We find some way to intercept the data passed in from the user login
 form, do our own authentication, then edit the input data passed in
 from the form to values known to produce a successful login or fail,
 and pass it on to turbogears to process (returning a value we already
 know it will return).
 Problem with this is that we can't find where we can intercept and
 change the values without changing the TurboGears framework code.
 
 2. Change the TurboGears framework code.
 Bad idea for obvious reasons.
 
 3. Write our own identity module instead of using the built in one.
 
 Any thoughts are much appreciated,
 - Andrey
 
 
  
X-Google-Language: ENGLISH,ASCII-7-bit
Received: by 10.54.68.12 with SMTP id q12mr144568wra;
Sat, 20 May 2006 05:32:29 -0700 (PDT)
Return-Path: [EMAIL PROTECTED]
Received: from mtaout03-winn.ispmail.ntl.com (mta09-winn.ispmail.ntl.com 
[81.103.221.49])
by mx.googlegroups.com with ESMTP id v23si368259cwb.2006.05.20.05.32.28;
Sat, 20 May 2006 05:32:29 -0700 (PDT)
Received-SPF: softfail (googlegroups.com: domain of transitioning [EMAIL 
PROTECTED] does not designate 81.103.221.49 as permitted sender)
Received: from aamtaout03-winn.ispmail.ntl.com ([81.103.221.35])
  by mtaout03-winn.ispmail.ntl.com with ESMTP
  id [EMAIL PROTECTED]
  for turbogears@googlegroups.com;
  Sat, 20 May 2006 13:32:27 +0100
Received: from [10.0.0.2] (really [81.96.134.223])
  by aamtaout03-winn.ispmail.ntl.com with ESMTP
  id [EMAIL PROTECTED]
  for turbogears@googlegroups.com;
  Sat, 20 May 2006 13:32:27 +0100
Message-ID: [EMAIL PROTECTED]
Date: Sat, 20 May 2006 13:32:28 +0100
From: Robin Haswell [EMAIL PROTECTED]
User-Agent: Thunderbird 1.5.0.2 (Windows/20060308)
Mime-Version: 1.0
Content-Type: text/plain
To: turbogears@googlegroups.com
Subject: Re: [TurboGears] TurboGears identity authenticating against /etc/shadow
References: [EMAIL PROTECTED]
In-Reply-To: [EMAIL PROTECTED]

Hey there

You can use PyPAM from http://www.pangalactic.org/PyPAM/ to authenticate 
against Shadow. There are debian packages. I dunno if you're going to 
have much luck though - TG requests the user data by username and 
compares the password with the supplied value, possibly hashed - with 
PAM you need to know the hashed password before you hash the supplied 
password - because you need to know what the salt that was used is. I 
dunno if TG provides this ability.

But you can always your User model, and then overload the __cmp__ 
property of User.password :-)

-Rob

Andrey Petrov wrote:
 Hi,
 
 We're working on a web application in TurboGears and we came across a
 roadblock:
 
 We need to authenticate users (people who are logging in) against the
 /etc/shadow file on the server, while maintaining a separate (similar
 to the default) model of the users/groups/permissions in TurboGears.
 
 That is,
 A user enters the website, enters his login and password,
 TurboGears passes the call to another C program (or something else) to
 authenticate against /etc/shadow, if returns successfully then
 TurboGears lets the user log in successfully using the corresponding
 object in the User table.
 
 Is this capability already possible? Has anyone done something similar?
 Anyone have any pointers?
 
 Here are some ideas we've explored:
 
 1. Interception:
 We find some way to intercept the data passed in from the user login
 form, do our own authentication, then edit the input data passed in
 from the form to values known to produce a successful login or fail,
 and pass it on to turbogears to process (returning

[TurboGears] Re: Having problems with last page of wiki20 tutorial

2006-05-20 Thread Robin Haswell
.egg/kid/pull.py,
 line 206, in _coalesce
 for ev, item in stream:
   File
 /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/kid-0.9.1-py2.4.egg/kid/pull.py,
 line 370, in __iter__
 for (ev, stuff) in self._expat_stream():
   File
 /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/kid-0.9.1-py2.4.egg/kid/pull.py,
 line 342, in _expat_stream
 feed(data)
   File
 /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/kid-0.9.1-py2.4.egg/kid/pull.py,
 line 410, in feed
 raise e
 ExpatError: mismatched tag: line 8, column 2
 --
 
 
 And secondly,
 clicking on view the complete list of pages link at the bottom of the
 page does nothing.
 
 
 
 Thirdly,
 opening a browser for this page
 (http://localhost:8080/pagelist?tg_format=json) returnst this error:
 --
 Page handler: bound method Root.pagelist of wiki20.controllers.Root
 object at 0x1397bd0
 Traceback (most recent call last):
   File
 /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/CherryPy-2.2.1-py2.4.egg/cherrypy/_cphttptools.py,
 line 105, in _run
 self.main()
   File
 /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/CherryPy-2.2.1-py2.4.egg/cherrypy/_cphttptools.py,
 line 254, in main
 body = page_handler(*virtual_path, **self.params)
   File string, line 3, in pagelist
   File
 /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/TurboGears-0.9a6-py2.4.egg/turbogears/controllers.py,
 line 273, in expose
 output = database.run_with_transaction(
   File
 /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/TurboGears-0.9a6-py2.4.egg/turbogears/database.py,
 line 221, in run_with_transaction
 retval = func(*args, **kw)
   File string, line 5, in _expose
   File _speedups.pyx, line 376, in
 _speedups.BaseDispatcher.__getitem__
   File
 /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/RuleDispatch-0.5a0.dev_r2115-py2.4-macosx-10.3-ppc.egg/dispatch/interfaces.py,
 line 15, in __call__
 NoApplicableMethods: ((function pagelist at 0x13b1070,
 'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5',
 False, (wiki20.controllers.Root object at 0x1397bd0,), {'tg_format':
 u'json'}), {})
 --
 
 
 
 I think the problem is JSON related, not working properly in my
 browser. And yes the server was restarted...
 
 I also noticed that the final files tar.gz files provided in the
 detail documentation tutorial did not match what was written in the
 tutorial themselves.  In particular the
 use of ${std.url('/pagelist', tg_format='json')} vs
 /pagelist?turbogearsfmt=json
 as well as a few other differences
 
 
 
 
 Anybody have any clue?
 
 -Jack
 
 
  
X-Google-Language: ENGLISH,ASCII-7-bit
Received: by 10.54.160.18 with SMTP id i18mr152899wre;
Sat, 20 May 2006 13:09:46 -0700 (PDT)
Return-Path: [EMAIL PROTECTED]
Received: from mtaout02-winn.ispmail.ntl.com (mta08-winn.ispmail.ntl.com 
[81.103.221.48])
by mx.googlegroups.com with ESMTP id v23si462677cwb.2006.05.20.13.09.45;
Sat, 20 May 2006 13:09:46 -0700 (PDT)
Received-SPF: softfail (googlegroups.com: domain of transitioning [EMAIL 
PROTECTED] does not designate 81.103.221.48 as permitted sender)
Received: from aamtaout01-winn.ispmail.ntl.com ([81.103.221.35])
  by mtaout02-winn.ispmail.ntl.com with ESMTP
  id [EMAIL PROTECTED]
  for turbogears@googlegroups.com;
  Sat, 20 May 2006 21:09:44 +0100
Received: from [10.0.0.2] (really [81.96.134.223])
  by aamtaout01-winn.ispmail.ntl.com with ESMTP
  id [EMAIL PROTECTED]
  for turbogears@googlegroups.com;
  Sat, 20 May 2006 21:09:41 +0100
Message-ID: [EMAIL PROTECTED]
Date: Sat, 20 May 2006 21:09:42 +0100
From: Robin Haswell [EMAIL PROTECTED]
User-Agent: Thunderbird 1.5.0.2 (Windows/20060308)
Mime-Version: 1.0
Content-Type: text/plain
To: turbogears@googlegroups.com
Subject: Re: [TurboGears] Having problems with last page of wiki20 tutorial
References: [EMAIL PROTECTED]
In-Reply-To: [EMAIL PROTECTED]

Hey

Your first traceback tells me your template was not well-formed XML. 
Look around line 8 and see if you forgot to close a tag.

Your second traceback tells me you need to expose that method as JSON - 
add an '@expose(json)' to the method you're trying to call, eg:

@expose(json)
def pagelist(self):
...

-Rob

[EMAIL PROTECTED] wrote:
 Hi,
 
 I am using the latest TG alpha on Mac OS X 10.3 on FF 1.5 with MySQL.
 
 I have gone step by step through the wiki20 page tutorial, and was
 crusing just fine until the last tutorial page.
 
 At the end of all the changes it doesn't work anymore.
 
 Clicking on Edit pages reveals this error:
 --
 Page handler: bound method Root.edit of wiki20

[TurboGears] Re: Cross compiling and deploying a TG app...

2006-05-20 Thread Robin Haswell

Jorge Vargas wrote:
 Back to my original though, TG relies on highlevel pure-python modules, 
 all based on std api, the only one that stands out is the elementtree 
 which is done in C for efficiency, so you should have no problem doing 
 cross-platform, i run TG stuff both on linux and windows and everything 
 works great with the same packages.

I think I remember someone mentioning that if cElementTree is missing TG 
will fallback to ElementTree. You might want to consider removing cET 
and replacing it with ET - although you will suffer a performance hit :(

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] SQLObject: Accessing a RelatedJoin as as Select results object + memory things

2006-05-19 Thread Robin Haswell

Hey there

I have item in my model which have tens of thousands of RelatedJoin
members. In the example:

class A(SQLObject):
bees = RelatedJoin(B)

class B(SQLObject):
ayes = RelatedJoin(A)


Say len(A.get(1).bees)  10,000, and obj = A.get(1)

Accessing obj.bees in any way at all causes SO to immediately select
every single B that belongs to A - with 10,000 individual queries!! And
worse, afterwards it keeps them all in *memory* !! Anyway this is
unacceptable.

So..

I was wondering if someone could help me with my two problems:

1. I need to be able to select each obj.bees in turn, process it, and
move on. This would be acceptable

2. I want to be able to do bob = B.get(x), work on bob, then remove
bob from the memory. Performing del bob doesn't work - if I enable
debugging and do bob = B.get(1); del bob; bob = B.get(1) only one
query is performed.

I think the solution is to get obj.bees as a SelectResults object - that
way I can perform slice operations to get the data I need. However I
have no idea how to do this - I can't seem to get SO to reference the
a_b table, and SO documentation is a bit lacking.

If 1) and 2) can't be solved, could anyone tell me how to get a regular
MySQLdb cursor from turbogears? I can do it all manually but not with
A._connection.query*.

Thanks a lot to anyone who can help :)

Regards

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: **UPDATE** SQLObject: Accessing a RelatedJoin as as Select results object + memory things

2006-05-19 Thread Robin Haswell

I have found out that I can use SQLRelatedJoin to get a RelatedJoin as
SelectResults - does anyone have any ideas on removing objects from memory?

Cheers :-)

-Rob

Robin Haswell wrote:
 2. I want to be able to do bob = B.get(x), work on bob, then remove
 bob from the memory. Performing del bob doesn't work - if I enable
 debugging and do bob = B.get(1); del bob; bob = B.get(1) only one
 query is performed.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: class CSS in master file breaks KID?

2006-05-19 Thread Robin Haswell

This is a known bug, not to do with your code, but nobody really knows 
what in. Probably kid.

Put your change back in and restart TG. If that fails, try running kidc 
-sf on your template directory, eg: kidc -sf templates/. If you still 
get an error, make a copy of the traceback and master.py, and mail the 
list again :-)

I'm currently trying to track down this elusive bug also.

Thanks

-Rob

Damjan wrote:
 I'm trying to add this CSS in the master.kid file:
 .flash { color:red; border: 1px solid #555; padding: 8px;
 background-color: #bbb; }
 
 And when I try to display a zone.kid template that extends it I get
 this:
 
   File /home/damjan/Projects/tg-bind/tgbind/templates/zone.py, line
 21, in initialize
   File /home/damjan/Projects/tg-bind/tgbind/templates/master.py, line
 21, in initialize
 TypeError: 'NoneType' object is not callable
 
 If I delete that CSS line, I don't get an error..
 
 Is this a bug in TurboGears, kid, or in my code?
 
 
 Slackware Linux, Python 2.4, TurboGears 0.9a6, kid 0.9.1, TurboKid 0.9.5
 
 
  

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: 20 Minute Wiki updated

2006-05-18 Thread Robin Haswell

Damjan wrote:
I wish I had TextMate on Linux
 
 
 Have you tried Kate?

Women never help me write code faster!

Ho ho ho.

Actually I was looking in to Kate last night (ho ho.. nevermind) and I'm
quite interested. I'll give it a shot at some point. Cheers :-)

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Cherrypy concurrent requests

2006-05-18 Thread Robin Haswell

Hey there

I'm using ajax to make many (50+) requests to cherrypy at a time, each
one taking maybe a few minutes to process (I'm consuming a slow feed).
Are there any limits or considerations to this? Does running the server
as development make a difference?

Cheers

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: template reading optimization

2006-05-17 Thread Robin Haswell

[EMAIL PROTECTED] wrote:
 If you wish to avoid event the modification time check you can set the
 config option kid.precompiled = True.  If you want to use precompiled
 templates you'll need to run the kidc compiler yourself, such as:
   find mypackage -name *.kid | xargs kidc
 
 That will generate the .pyc files for each template found in your
 package.


I should say, I tried this on .9a6 with disastrous results. I set the 
option in app/config.cfg, compiled the templates with kidc -f 
templates/, but to no availed. I first got an error about no module 
sitetemplate, so I found that kid file and compiled it - however 
although that one worked, my app couldn't find any of my precompiled 
templates, so every page bombed out with couldn't find module 
templatename error.

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: 20 Minute Wiki updated

2006-05-17 Thread Robin Haswell

Very nice work dude! Every time I see these videos I wish I had TextMate 
on Linux. Quick question - I need to create a tutorial for a client 
pretty soon (they apparently can't read or something) - do you recommend 
adding the dialogue to the movie after it's been created?

Cheers

-Rob

Kevin Dangoor wrote:
 At long last, the 20 Minute Wiki screencast that was created for
 TurboGears 0.5 has been updated. I streamlined the overall
 presentation. I had considered bringing in widgets, but I think it
 would have been one concept too many for a quick intro.
 
 The old video was actually 23 minutes long. This one is under 19
 minutes, including a bit of exposition.
 
 http://www.turbogears.org/preview/docs/tutorials/wiki20/
 
 Kevin
 

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: Identity silently fails

2006-05-17 Thread Robin Haswell

Did you say 0.9a6? You're missing name=login on that submit button. I 
recognise this error from PHP experience and upgrading a project earlier 
today.

 Identity has changed to use PEP 8 (Python standard coding convention) style 
 names. SQL migration scripts are available to help convert your database to 
 the new names.
 
 Additionally, your identity login screen must have a button that is named 
 login or another name specified in the identity.form.submit configuration 
 variable.

-Rob

[EMAIL PROTECTED] wrote:
 tr
 td colspan=2 class=buttons
 input type=submit value=Login/
 /td
 /tr

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: how to debug: 'NoneType' object is not callable

2006-05-16 Thread Robin Haswell

Just a fresher for this thread, I'm still getting this intermittently
(nearly identical tracebacks) on .9a6. I have SQLObject calls in my
template, and my errors are on line 25 of master.py. Sorry I lost my
tracebacks applying the kid.precompiled fixes (which failed
spectacularly, by the way), however I will let you know if it comes back.

It's very odd, I've been developing this site for a week and it's only
just shown up now.

Is there a way to stop Kid deleting its .py files so I can see the code
that was failing?

More info as it comes.]

Cheers

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: how to debug: 'NoneType' object is not callable

2006-05-16 Thread Robin Haswell

Cox Chen wrote:
 Hi,
 
 Do you use customized widget?
 Maybe the widget is not instantiated as you expect.
 (I've encountered similar problem when working with widgets from
 FastTrack 0.5)
 
 -Cox

I do use one custom widget but it's not called on the pages I see errors on.

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: scheduling one time tasks with tg.scheduler

2006-05-16 Thread Robin Haswell

Tim Lesher wrote:
 I agree with that; the ticket Robin submitted didn't mention running
 the task at a specific time, though.  If that's what he meant, I
 apologize.

In which case I apologize for being unclear - that is what I meant,
however I also see the use in being able to use the scheduler to run a
background task now - for these reasons:

1. It's the same API for two essentially identical tasks
2. Threading/forking is scary for n00bs - I dunno how TG does it, but I
know I would be worried about forking or threading a webserver, because
forking it is going to leave two copies in memory, and threading while a
DB connection is open brings back scary nightmares from projects past. I
would much rather leave it to a tested API.

Regardless of that though, I think scheduling a one-time task is a good
idea IMO. In at least one of my TG apps I need to perform an action in
24 hours' time (although I don't use the TG scheduler for that as I
don't trust the server to run for 24 hours without crashing).

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: scheduling one time tasks with tg.scheduler

2006-05-16 Thread Robin Haswell

The software, based on my development experiences. That and if I want to
change a character of code I have to restart the server - and scheduler.

-Rob

Jorge Godoy wrote:
 Em Terça 16 Maio 2006 12:07, Robin Haswell escreveu:
 
 
Regardless of that though, I think scheduling a one-time task is a good
idea IMO. In at least one of my TG apps I need to perform an action in
24 hours' time (although I don't use the TG scheduler for that as I
don't trust the server to run for 24 hours without crashing).
 
 
 You don't trust the hardware or the software?  I have stable websites with TG 
 running non-stop here.  All with an Apache proxying requests to CP.
 
 But, I also rely on cron for automated repetitive tasks.  A scheduler would 
 be 
 more for sporadic things or to allow users scheduling some maintenance 
 routines (I can create crontab entries for those, though...).
 

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: how to debug: 'NoneType' object is not callable

2006-05-16 Thread Robin Haswell

The problem with these results is I can't be sure that the output from
kidc -sf is the same as the compiled code that TG is running. I really
need Kid to not delete the .py files that it generates as TG runs normally.

-Rob

Jorge Godoy wrote:
 Em Terça 16 Maio 2006 11:33, Robin Haswell escreveu:
 
Doing this indicates a Kid error. Lines 25-27 are:
 
 
 But the source should be kept there...  The error might be for the 
 compilation 
 from .py to .pyc.
 
 
def initialize(self):
rslt = initialize(self)
if rslt != 0: super(Template, self).initialize()

The initialize symbol is:

def initialize(template): pass

Must be a compilation error or something, because that looks fine to me.
 
 
 Python likes this as well...  So, no syntax error here.
 

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: template reading optimization

2006-05-16 Thread Robin Haswell

Funny, operating systems are the same, which is why frequently used 
files get put in memory (I think). Every wondered why PHP doesn't crawl?

I agree with your philosophy, I just think you need to be a little less 
zealous about it.

-Rob

jvanasco wrote:
 well thats out of the control of the framework - and you just toss
 memory at that problem.
 
 i just wanted to keep the framework from reading the disk.  i'm a big
 believe in webapps being completely memroy resident and never touching
 the disk - they either get all their content from memory or a db
 connection to another machine.
 
 
  

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: template reading optimization

2006-05-16 Thread Robin Haswell

jvanasco wrote:
 php doesn't cache into memory at any level natively

Yes, I meant the operating caches the PHP files in to memory. Obviously 
not the bytecode compiled ones though.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: New scheduler doc

2006-05-16 Thread Robin Haswell

Hm I'm personally of the opinion that the scheduler should *depend* on a 
database, like identity.

-Rob

[EMAIL PROTECTED] wrote:
 Tim did you posted that recipe? Why don't make it a buildin?
 
 
  

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: Strip spaces from output...

2006-05-16 Thread Robin Haswell

Some more pennies for the jar, when I develop PHP work I pipe the output 
through W3C's tidy util to get properly indented HTML - it helps the 
designer a lot, especially with complicated HTML. There's even couple of 
stable Python interfaces. libtidy ships with just about anything, 
although I dunno how setuptools would handle this.

-Rob

Fred C wrote:
 
 I think it would be great to have this option in the dev.cfg and 
 prod.cfg files.
 You may want to have the spaces stripped in the prod version but not 
 when you develop. 
 
 my .2 cent.
 
 -fred-

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: How to join a table with itself in the model

2006-05-16 Thread Robin Haswell

I think this helps, it's sample working code for my Article model. 
Articles have related articles:

class Article(SQLObject):
 title = UnicodeCol()
 body = UnicodeCol()
 created = DateTimeCol(default=datetime.now)
 sort = IntCol(default=0)

 slug = StringCol(alternateID=True, default=None, length=255)
 subject = ForeignKey(Subject)
 user = ForeignKey(User)
 related = RelatedJoin(Article, joinColumn=related_id_1,
 otherColumn=related_id_2, orderBy=title)

 def _set_title(self, value):
 if not self.slug:
 self.slug = Slug(value, self)
 self._SO_set_title(value)
 def _get_siteurl(self):
 return /information/%s/%s.html % (self.subject.slug,
 self.slug)
 def __str__(self):
 return self.title

I had to manually create the join table after `sql create` - no other 
caveats.

-Rob

Jorge Godoy wrote:
 Em Terça 16 Maio 2006 19:18, Ed Singleton escreveu:
 I want to join a table with itself in the model definition.

 Something like:

 class Page(SQLObject):
 parent_page = ForeignKey('Page')
 child_pages = MultipleJoin('Page')

 but when I do, and I try to pull out the child pages I get the error:

 OperationalError: (1054, Unknown column 'page_id' in 'where clause')

 Any clues?
 
 Specify the joinColumn as id.  
 

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: scheduling one time tasks with tg.scheduler

2006-05-13 Thread Robin Haswell

And on a related note, what do widgets have that HTML and some if statements 
don't provide?

Creating a scheduled task is a lot easier than messing about creating your own 
class with a run() 
instance etc.

-Rob

Tim Lesher wrote:
 On 5/12/06, Robin Haswell [EMAIL PROTECTED] wrote:
 I actually opened a ticket on this today:
 
 You didn't mention it in your ticket, but what do you need that
 threading.Thread doesn't provide?
 

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] How to get the app's document root

2006-05-12 Thread Robin Haswell

Hey there

I've tried searching around a bit/lot, and I can't find out how to get
the app's document root. I need to reference my Lucene index.

On this note, could we add a keys() method to turbogears.config so we
can interrogate what config options are available?

Cheers

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Search options: Are there any, should we be considering them?

2006-05-12 Thread Robin Haswell

Hey guys

Let's face it, every application on the web these days need some form of
search, and as far as I can see, TG + SO/any ORM is going to make that
tricky.

So I was wondering, should we be thinking about a portable way of
providing search for TG apps? Or at least, I think we should provide an
integration method for something which is quite easily obtainable, if
not shipped with TG itself.

I think we have at least two options:


1. PyLucene (http://pylucene.osafoundation.org/)

Pros


* Stable, well-maintained project
* Core engine used in a billion different things
* Lots of packages

Cons


* Appears to be a Java hack
* Stems from a Java project
* Did I mention Java?
* Looks a bit heavyweight


2. XapWrap (http://divmod.org/projects/xapwrap)

Pros


* Looks quite simple to use
* Very Pythonic
* Under active development
* Cool name

Cons


* Somewhat immature at the moment
* Not full-featured (eg no stemming - do we care?)
* Current documentation appears to consist of a few docstrings


Personally I would prefer XapWrap, however I need a search engine right
now and for internal reasons I'm going to give PyLucene a spin. I'll
report back what I think of it.

Anyway that's my $0.02 - I hope we can have a good discussion about this.

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: Search options: Are there any, should we be considering them?

2006-05-12 Thread Robin Haswell


 In the past I've also used Lupy (combining the slowness of a
 pure-python implementation with the awkwardness of a Java style
 API. With bonus bugginess!) and MySQL's full-text search (if it
 doesn't have stemming, I have a hard time considering it real
 full-text search). 
 

Our MySQL 4.1 definitely supports stemming, I was just talking to a
client about an hour ago about why her search does return result for
quickgrin but does for quickgrinder (and likewise for bags - bag)

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: How to get the app's document root

2006-05-12 Thread Robin Haswell

Kevin Dangoor wrote:
 On 5/12/06, Robin Haswell [EMAIL PROTECTED] wrote:
 
I've tried searching around a bit/lot, and I can't find out how to get
the app's document root. I need to reference my Lucene index.
 
 
 I didn't sleep enough last night, so I might just be missing
 something... but what is the app's document root? Almost by
 definition, an app isn't a collection of documents. If you mean what
 is the app's root on the web?, in the context of a request you can
 just say turbogears.url('/')

Sorry, I'm still coming from a LAMP perspective. I mean the location of
the application on the filesystem - eg `locate start-project.py` :-)

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: Search options: Are there any, should we be considering them?

2006-05-12 Thread Robin Haswell


 Well I've wasted a midday and I can tell you PyLucene is a big no-no. A
 google for cherrypy pylucene brings too many horror stories to
 mention. Basically something in PyLucene causes CP to bomb out - on my
 dev setup, insantiating (sp) PyLucene.IndexSearcher() causes an immediat
 autoreload. There is no configuration solution. Someone mentioned
 something about using PythonThread but no details on implementation, I'm
 looking in to that now
 (http://www.mail-archive.com/pylucene-dev@osafoundation.org/msg00377.html)

It does in fact appear that Lucene won't work in-process with CherryPy
at all. You need to either write some sort of service for it, or run it
as a subprocess which is just nasty.

Bummer :'(

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: How to get the app's document root

2006-05-12 Thread Robin Haswell

Jorge Godoy wrote:
 [/static]
 static_filter.on = True
 static_filter.dir = %(top_level_dir)s/static
 identity.on = False
 
 using a command such as:
 
 turbogears.config.get('static_filter.dir', path=/static)

Cheers, I tried using turbogears.config.get('top_level_dir'), didn't
work of course.

 
 This says:
 
   - for the path /static in my website
   - get the value of static_filter.dir
 
 The result here is:
 
   /path/to/project/static
 
 You can define a new section if you need an upper directory or change it to 
 something else using split, dirname, basename, etc.

Cheers, I think I'll define a new location as I'm liable to change stuff
like static paths.

Cheers

:-)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: Search options: Are there any, should we be considering them?

2006-05-12 Thread Robin Haswell

 Here's a third choice that doesn't appear to suffer from the problems
 of the other two, but I haven't used it:
 http://hype.python-hosting.com/

This doesn't build on my Debian Sarge system, bombs out with a missing
file error (_hype.c!). Plus it depends on hyperes..something, which also
doesn't build on my system (GCC syntax errors).

 Kevin

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: scheduling one time tasks with tg.scheduler

2006-05-12 Thread Robin Haswell

I actually opened a ticket on this today:

http://trac.turbogears.org/turbogears/ticket/867

-Rob

Karl Guertin wrote:
 I found that the scheduler is missing one piece of functionality that
 I'd like. I currently have a datetime object and I want to run a given
 action at the time specified by my object. To that end I've added the
 following functionality to scheduler:
 
 def add_datetime_task(self, action, taskname, date_time,
 processmethod, args, kw):
 Add a new task to the schedule. This provides a way to
 generate one-time
    events where you know the time you want the event to occur
 now = time.time()
 date_time = time.mktime(date_time.timetuple())
 if date_time - now  0:
 return None
 if processmethod==method.sequential:
 TaskClass=OneTimeTask
 elif processmethod==method.threaded:
 TaskClass = ThreadedOneTimeTask
 elif processmethod = method.forked:
 TaskClass = ForkedOneTimeTask
 if not args:
 args = []
 if not kw:
 kw = {}
 task = TaskClass(taskname, date_time, action, args, kw)
 self.schedule_task_abs(task,date_time)
 return task
 
 class OneTimeTask(Task):
 def __init__(self, name, date_time, action, args=None, kw=None):
 Task.__init__(self, name, action, args, kw)
 
 def reschedule(self, scheduler):
 pass
 
 
 Along with the mixins and convenience function. It seems to work, but
 before I shoot myself in the foot, will I have a problem with an
 excessive number of threads?
 
 It doesn't look like I get a thread for every datetime_task added but
 my knowledge of the threading module is weak and I don't see the
 scheduling threads ever dying.
 
  

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Logging generation time to log

2006-05-11 Thread Robin Haswell

Hey there

Is it possible to log the time it took to generate the page, like the
first alphas did with the on-page logging? We could probably also log
from GET / to socket.close() and get a much more accurate time than
the original information. If this is an option to turn on I don't think
I can see it anywhere :'(

Cheers

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: Logging generation time to log

2006-05-11 Thread Robin Haswell

Kevin Dangoor wrote:
 Hi Rob,
 
 On 5/11/06, Robin Haswell [EMAIL PROTECTED] wrote:
 
Is it possible to log the time it took to generate the page, like the
first alphas did with the on-page logging? We could probably also log
from GET / to socket.close() and get a much more accurate time than
the original information. If this is an option to turn on I don't think
I can see it anywhere :'(
 
 
 That's a good idea, but it's not implemented currently. Feel free to
 open a ticket...

Cheers, #865

 I'm not sure about measuring to socket.close(). I'm not sure if we
 *can* short of monkeypatching CP, and I'm also not sure if that
 measures what we'd want to measure. If the user on the other side has
 a 56K modem, it will take them longer to download the page (if they're
 hitting CherryPy directly). I think it's more interesting to measure
 the time it takes the server to generate the page, because that's the
 part that is reasonably optimizable.

Yeah you're right, we just need up until the end of KID processing.
AFAIK the old time display was quite wrong because Kid is a significant
bottleneck when generating a page. Having some timing info that includes
Kid is important. Maybe we could split the timing in to controller and view.

 Kevin
 
 p.s. Google thinks your messages are spam because your email address
 has apparently not been working.

Yes Groups randomly stopped E-mailing me updates a while back and I
haven't been able to fix it. However I receive these messages via a
redirect in my Gmail account so I have no comprehension of what could be
wrong. No-one else has trouble E-mailing me. How long have my messages
been marked as junk for? Would you recommend I get on the case?

Cheers

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: Logging generation time to log

2006-05-11 Thread Robin Haswell

Yeah probably. I dug out a confirmation link from my inbox and clicked
it.. it seemed to work, and now I get every message twice! I'm off to go
disbale that filter :-)

Cheers for letting me know about this

-Rob

 I think Google was having trouble sending to your address and then
 gave up after a certain period of time. This particular message of
 yours didn't get marked as spam... go figure.
 
 You might be able to find out more on the groups page:
 
 http://groups.google.com/group/turbogears
 
 Kevin
 
  

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Partially inserting HTML in to strings for kid

2006-05-09 Thread Robin Haswell

Hey there

I'm having some difficulty working out what to do when I just want to
add a few bits of XML to some string, and having the rest escaped
properly. Basically I'm using this in two situations:

1. When I want to put strong../strong around keyword terms in search
result snippets

2. In one of my apps, printing one of my models returns a string with a
span around it. I'd like to span to be left alone but the contents of
the span to be sanitised.

I was wondering if anyone could point me on how to do this? Ideally I
think you should be able to do ' my string + XML(tag) +
something + XML(/tag) + some more cruft ', and return a
generator, but at the moment I just get a TypeError :'(

Cheers for any help

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: Partially inserting HTML in to strings for kid

2006-05-09 Thread Robin Haswell

Can you imagine how much of a pain that's going to be for my search
snippets! A single regex is going to turn in to lines of loop code!
Surely there must be an easier way?

Is it possible to sanitise my string before it is sent to the template?
Then I could run the regex on the sanitised version and dump that in to
XML()

Cheers

-Rob

Kevin Dangoor wrote:
 On 5/9/06, Robin Haswell [EMAIL PROTECTED] wrote:
 
1. When I want to put strong../strong around keyword terms in search
result snippets

2. In one of my apps, printing one of my models returns a string with a
span around it. I'd like to span to be left alone but the contents of
the span to be sanitised.

I was wondering if anyone could point me on how to do this? Ideally I
think you should be able to do ' my string + XML(tag) +
something + XML(/tag) + some more cruft ', and return a
generator, but at the moment I just get a TypeError :'(
 
 
 I'd recommend creating cElementTree Elements.
 
 In [1]:from cElementTree import Element
 
 In [2]:e = Element(span)
 
 In [3]:e.text = This text is yours  mine.
 
 In [8]:import cElementTree as ET
 
 In [9]:ET.dump(e)
 spanThis text is yours amp; mine./span
 
 You should be able to drop the element object straight into your template.
 
 Kevin
 
  

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: Partially inserting HTML in to strings for kid

2006-05-09 Thread Robin Haswell

Cheers dude :-)

-Rob

Kevin Dangoor wrote:
 On 5/9/06, Robin Haswell [EMAIL PROTECTED] wrote:
 
Can you imagine how much of a pain that's going to be for my search
snippets! A single regex is going to turn in to lines of loop code!
Surely there must be an easier way?
 
 
 Surely there is! I suggested the ET way, because elements are fast
 (and reportedly much faster than XML()). You can do this:
 
 from cgi import escape
 escaped = escape(original_string)
 ...do your regex to put in strongs and whatnot...
 
 XML(the result)
 
 profit!
 
 Kevin
 
  

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: [article] Flummoxed By Frameworks

2006-05-09 Thread Robin Haswell

jvanasco wrote:
 My problem with the 20minute screencasts in each thing, is that they
 show how the app is geared to make something that I'd never use with an
 application logic that I think is completely abhorrent in 20minutes or
 less.
 
 Then i download the framework, I play around, and I say The db layout
 from this ORM is fucking retarded, and Why is this making 15 db
 calls? , or this should all be per user tied to a uid, not some dumb
 session variable

Web frameworks: Making slow applications, faster.

 And then I learn Oh.  So this framework was made to do 20minute
 screencasts, but do soemthing that would take me 15minutes without a
 framework will take me 2 days within its constraints.
 
 read: why i hated rails and django

But not TG? Please explain :-)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: 0.9a5 on python2.3 - anyone have working?

2006-05-08 Thread Robin Haswell

Jorge Godoy wrote:
 I prefer spending a bit more of my time to make users 
 happy.

Good to know you'll never write for the gnome project then ;-)

(Sorry)

On a more constructive note, this might sound silly but can't we just do this 
by performing a 
regular expression on quickstarted source?

Try this:

$ cat controllers.py|sed -r 's/^(\s+)@([a-z_]+\(.*\))\s*$/\1[\2]/i'

It only works on single-line decorators (multiline might be a little beyond my 
regexp skill) but it 
seems to do the job. I think the experession for a python symbol - [a-z_] - is 
a little off, but 
someone can easily sort that out. You could even replace it with [^(] .

Of course that regexp is fine to just dump in to re.compile() - 
re.compile(r's/^(\s+)@([a-z_]+\(.*\))\s*$/\1[\2]/', re.I)

Quick question - why does the [expose(...)] work?

Cheers

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: 0.9a5 on python2.3 - anyone have working?

2006-05-08 Thread Robin Haswell

Jorge Godoy wrote:
 Em Segunda 08 Maio 2006 17:16, Robin Haswell escreveu:
 Jorge Godoy wrote:
 I prefer spending a bit more of my time to make users
 happy.
 Good to know you'll never write for the gnome project then ;-)

 (Sorry)
 
 Why?  I won't indeed. ;-)

Oh, my pet hate about GNOME is that their idea of user friendliness is 
drastically slashing 
features and functionality that users are crying out for (and ignoring pleas 
for re-inclusion). I 
swear most of the checkins to GNOME must be on the lines of

@@ 100 @@
+ /* Our users don't need this
@@ 1500
+ */

 On a more constructive note, this might sound silly but can't we just do
 this by performing a regular expression on quickstarted source?

 Try this:

 $ cat controllers.py|sed -r 's/^(\s+)@([a-z_]+\(.*\))\s*$/\1[\2]/i'

 It only works on single-line decorators (multiline might be a little beyond
 my regexp skill) but it seems to do the job. I think the experession for a
 python symbol - [a-z_] - is a little off, but someone can easily sort that
 out. You could even replace it with [^(] .

 Of course that regexp is fine to just dump in to re.compile() -
 re.compile(r's/^(\s+)@([a-z_]+\(.*\))\s*$/\1[\2]/', re.I)

 Quick question - why does the [expose(...)] work?
 
 I prefer maintaining an English template -- even though English is not my 
 primary language -- than working with regular expressions (and I have a Perl 
 (!!!) background... ;-)).
 
 I believe that there's some way to declare it like this:
 
 #if python23
 #def expose_decorator
 [turbogears.expose()]
 #end def
 #def identity_decorator
 [identity.require(...)]
 #end def
 #else if python24
 #def expose_decorator
 @turbogears.expose()
 #end def
 #def identity_decorator
 @identity.require(...)
 #end def
 #end if
 
 and then use it like:
 
 #expose_decorator
 
 or 
 
 #insert expose_decorator
 
 Something like this looks much more maintainable to me and it is easy to 
 use... 
 
 BUT, I don't know the syntax for this template, so...

I don't think this scales.. if decorators transformations really are as simple 
as my regular 
expression, then using an intermediate syntax for a decorator and then doing 
the appropriate 
substitutions would be better. Just as an example, something like:

class Something(controller.Root):
$[[[expose(template=...)]]]
def index(self):
 ... 
pass

Then when we write the template we can change those to the correct form.

... with a regular expression ;-)

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



[TurboGears] Re: KID got error while process javascript operator

2006-05-07 Thread Robin Haswell


 Using comments to wrap something that you want to keep in the document 
 is a bad idea.  Sure, it might happen to work with Kid, but I still 
 wouldn't do it or recommend it.

That technique has been recommended for JS since day 1. It's the standard way 
of hiding JS from 
non-javascript-aware browser. You wrap it in a comment so if your user agent 
doesn't understand JS, 
it doesn't go printing it everywhere.

Not that you should be putting JS in your body/ though.

I'm fine with JS on-page when it only affects that page. Including it in a 
global JS file increases 
bandwidth. Including it in its own external file causes connection overhead (in 
HTTP/1.0)

 -bob

-Rob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~--~~~~--~~--~--~---



  1   2   3   >