[turbogears-commits] [1992] website/dynamic/tgorg/controllers/cogbin.py: added turbogears.quickstart.template to the Cogbig to close #1018

2006-10-18 Thread dangoor
Title: [1992] website/dynamic/tgorg/controllers/cogbin.py: added turbogears.quickstart.template to the Cogbig to close #1018








Revision 1992
Author jorge.vargas
Date 2006-10-18 22:43:20 -0400 (Wed, 18 Oct 2006)


Log Message
added turbogears.quickstart.template to the Cogbig to close #1018

Modified Paths

website/dynamic/tgorg/controllers/cogbin.py




Diff

Modified: website/dynamic/tgorg/controllers/cogbin.py (1991 => 1992)

--- website/dynamic/tgorg/controllers/cogbin.py	2006-10-19 01:40:59 UTC (rev 1991)
+++ website/dynamic/tgorg/controllers/cogbin.py	2006-10-19 02:43:20 UTC (rev 1992)
@@ -18,7 +18,8 @@
 categories = [
 Category(Applications, keywords=turbogears.app),
 Category(Widgets, keywords=turbogears.widgets),
-Category(Template Plugins, keywords=python.templating.engines),
+Category(Template Engine Plugins, keywords=python.templating.engines),
+Category(Quickstart Templates, keywords=turbogears.quickstart.template),
 Category(Extension Components, keywords=turbogears.extension),
 Category(Identity Providers, keywords=turbogears.identity.provider),
 Category(tg-admin Commands, keywords=turbogears.command),





--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups TurboGears Repository Commits group.  To post to this group, send email to turbogears-commits@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-commits  -~--~~~~--~~--~--~---





[turbogears-commits] [1991] trunk/turbogears/toolbox/templater/__init__.py: refactor templates browser internaly

2006-10-18 Thread dangoor
Title: [1991] trunk/turbogears/toolbox/templater/__init__.py: refactor templates browser internaly








Revision 1991
Author fredlin
Date 2006-10-18 21:40:59 -0400 (Wed, 18 Oct 2006)


Log Message
refactor templates browser internaly

Modified Paths

trunk/turbogears/toolbox/templater/__init__.py




Diff

Modified: trunk/turbogears/toolbox/templater/__init__.py (1990 => 1991)

--- trunk/turbogears/toolbox/templater/__init__.py	2006-10-19 01:34:45 UTC (rev 1990)
+++ trunk/turbogears/toolbox/templater/__init__.py	2006-10-19 01:40:59 UTC (rev 1991)
@@ -1,8 +1,8 @@
 Graphical user interface for template designer
 import os
-import cherrypy
 import turbogears
 from turbogears import controllers
+from cherrypy import response
 from cherrypy.lib.cptools import serveFile
 import pkg_resources
 
@@ -85,12 +85,12 @@
 
 def render(self, filename, ContentType):
 
-render the template to anyformat
+render the template to any format
 
 project_files=self.project_files()
 for file in project_files:
 if file['file_name']==filename:
-cherrypy.response.headerMap['Content-Type']= ContentType
+response.headerMap['Content-Type']= ContentType
 f=open(self.currentProject+'/'+file['path'],'r')
 #return dict(content = f.read())
 return f.read()





--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups TurboGears Repository Commits group.  To post to this group, send email to turbogears-commits@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-commits  -~--~~~~--~~--~--~---





[tg-tickets] Re: [TurboGears] #1148: Migrate FastData docs Was: Comment on widgets/tutorials/DataGridWidget.html

2006-10-18 Thread TurboGears
#1148: Migrate FastData docs Was: Comment on 
widgets/tutorials/DataGridWidget.html
--+-
 Reporter:  nyenyec   |Owner:  anonymous
 Type:  task  |   Status:  closed   
 Priority:  high  |Milestone:  1.0  
Component:  FastData  |  Version:  1.0b1
 Severity:  minor |   Resolution:  fixed
 Keywords:|  
--+-
Changes (by fredlin):

  * status:  new = closed
  * resolution:  = fixed

Comment:

 migrated to
 http://docs.turbogears.org/1.0/DataController

-- 
Ticket URL: http://trac.turbogears.org/turbogears/ticket/1148
TurboGears http://www.turbogears.org/
TurboGears front-to-back web development
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears Tickets group.
To post to this group, send email to turbogears-tickets@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-tickets
-~--~~~~--~~--~--~---



[tg-tickets] [TurboGears] #1150: Role of RPC widget is not well defined.

2006-10-18 Thread TurboGears
#1150: Role of RPC widget is not well defined.
-+--
 Reporter:  ajones   |   Owner:  anonymous
 Type:  task |  Status:  new  
 Priority:  low  |   Milestone:   
Component:  Widgets  | Version:  1.0b1
 Severity:  minor|Keywords:   
-+--
 The use case for the RPC widget (widgets/RPC.py) is not well defined. It
 is used in widgets/big_widgets.py/LinkRemoteFunction and
 widgets/big_widgets.py/RemoteForm, but not in other widgets where it seems
 applicable (AutoCompleteField).

-- 
Ticket URL: http://trac.turbogears.org/turbogears/ticket/1150
TurboGears http://www.turbogears.org/
TurboGears front-to-back web development
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears Tickets group.
To post to this group, send email to turbogears-tickets@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-tickets
-~--~~~~--~~--~--~---



[tg-tickets] [TurboGears] #1151: VisitManagers should delete expired entries in tg_visit

2006-10-18 Thread TurboGears
#1151: VisitManagers should delete expired entries in tg_visit
--+-
 Reporter:  grover|   Owner:  anonymous
 Type:  defect|  Status:  new  
 Priority:  normal|   Milestone:   
Component:  Identity  | Version:  1.0b1
 Severity:  normal|Keywords:   
--+-
 Otherwise tg_visit will just keep all its stale visit entries forever. It
 would also be nice if when an entry in tg_visit was deleted, its
 corresponding entry in VisitIdentity was deleted too.

-- 
Ticket URL: http://trac.turbogears.org/turbogears/ticket/1151
TurboGears http://www.turbogears.org/
TurboGears front-to-back web development
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears Tickets group.
To post to this group, send email to turbogears-tickets@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-tickets
-~--~~~~--~~--~--~---



[tg-tickets] Re: [TurboGears] #1150: Role of RPC widget is not well defined.

2006-10-18 Thread TurboGears
#1150: Role of RPC widget is not well defined.
-+--
 Reporter:  ajones   |Owner:  anonymous
 Type:  task |   Status:  new  
 Priority:  low  |Milestone:  1.0  
Component:  Widgets  |  Version:  1.0b1
 Severity:  minor|   Resolution:   
 Keywords:   |  
-+--
Changes (by jorge.vargas):

  * milestone:  = 1.0

-- 
Ticket URL: http://trac.turbogears.org/turbogears/ticket/1150
TurboGears http://www.turbogears.org/
TurboGears front-to-back web development
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears Tickets group.
To post to this group, send email to turbogears-tickets@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-tickets
-~--~~~~--~~--~--~---



[tg-tickets] Re: [TurboGears] #1018: Add turbogears.quickstart.template category to CogBin

2006-10-18 Thread TurboGears
#1018: Add turbogears.quickstart.template category to CogBin
+---
 Reporter:  kevin   |Owner:  kevin   
 Type:  task|   Status:  reopened
 Priority:  normal  |Milestone:  
Component:  Docs|  Version:  0.9a5   
 Severity:  normal  |   Resolution:  
 Keywords:  |  
+---
Comment (by jorge.vargas):

 I'm so sorry I missread I have commited the changed and will be out when
 Kevin rebuilds the site.

-- 
Ticket URL: http://trac.turbogears.org/turbogears/ticket/1018
TurboGears http://www.turbogears.org/
TurboGears front-to-back web development
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears Tickets group.
To post to this group, send email to turbogears-tickets@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-tickets
-~--~~~~--~~--~--~---



[TurboGears] Re: widget CalendarDatePicker again

2006-10-18 Thread jose

Adam Jones wrote:

What have you tried so far to get it working? AFAIK it should work in
exactly the same way as any other widget, since all of the work that
CDP does is on the display side. Please post whatever relevant code you
have so we can figure this out.

-Adam

  

I'm trying this:

widgets.CalendarDatePicker(
name = mydate,
label = 'date label:',
default = None,
validator = DateValidator(today_or_after=True),
not_empty = True,
),

I expect it doesn't allow me to input a date before today but it does.

j





--~--~-~--~~~---~--~~
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: contribute wiget to cogbin

2006-10-18 Thread gasolin

Hi:

Did you have enough info to make your widget?


FYI: before you upload the widget, you can use

$ setup.py develop

to debug your widget locally.

And your widget should be shown on tg-admin toolbox. (if you define the
widgetdescription of course)


--
Fred

Jon Saints wrote:
 I have ported the collapsing fieldset widget from
 Drupal to my Turbo Gears app.  What steps do I need to
 take to share it in the Cogbin?   
 
 Thanks
 Jon


--~--~-~--~~~---~--~~
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] Problem following the tutorial

2006-10-18 Thread John Henry

I am following the tutorial at:

http://docs.turbogears.org/1.0/Wiki20/Page3

I am having trouble at the top of step 3 after:

  tg-admin toolbox

I am getting a:

  NameError: name 'page' is not defined

I checked several times, and the file page.kid exists (so is page.pyc).

What did I do wrong?

Regards,


--~--~-~--~~~---~--~~
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] Handling large forms

2006-10-18 Thread Tor Hildrum

Hi,

I'm getting my feet wet with TurboGears by creating a library for
books.

To add a book to the library you can fill out a rather large form. How
do you
handle this in the controller?

I've searched but can't find any decent way to do it.

There has to be a way to get form-data back as a dict or similar. If
not
I end up with something like:

@expose(template=library.templates.showBook)
def addBook(self, isbn=, title=, author=, num_pages=,
publisher=, ddc=,..)
   # add book to db
   # return book

Is there some kind of structure/dictionary I could just pass instead?

Tor


--~--~-~--~~~---~--~~
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] AttributeError in tg-admin sql create

2006-10-18 Thread Igor

Hi,

I seem to be hitting the following issue:
http://trac.turbogears.org/turbogears/ticket/763

I've read the previous thread about it, but the workaround that's been
suggested there (adding 'notrans_' to the sqlite uri) doesn't seem to
work for me.

However the fix for:
http://trac.turbogears.org/turbogears/ticket/279

does solve the problem for me.

I've posted this info on the ticket as well. Is there any uptodate
information on this other than what's in the ticket?

Thanks,
Igor


--~--~-~--~~~---~--~~
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] Unicode Error with MySQL... :\

2006-10-18 Thread core

Hello all,

I'm getting those messages: (snipped the first part):

  File
/usr/lib/python2.4/site-packages/SQLObject-0.7.1-py2.4.egg/sqlobject/mysql/mysqlconnection.py,
line 73, in _executeRetry
myquery = unicode(query, self.encoding)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
71: ordinal not in range(128)

When I try to use characters like á é í ç ã in data comming from
both form posts and XMLRequests (loadJSONDoc). My model.py uses
UnicodeCols, I tried setting the sys.defaultencoding to utf8, even with
my default language being an UTF8 one already,
Apparently, it works ok when I use a SQLite db (like I do on my
development machines, one win32 and one suse linux), but when I send it
to the wanna-be-production (ubuntu linux dapper) where I have to use
MySQL (4.1), the DB stuff go crazy. The part I do not understand is, it
worked until some weeks ago, then I took some time off development (ok,
more than weeks, I left on TG 0.9.something and came back now), and
things broke. I may be let something pass on the changelogs...

I searched google and found a lot of conflicting info, so, any clue for
my cluelesness? :)

thanks

[]s
coredump
http://core.eti.br
all I wanna do is to find a job to work with turbogears


--~--~-~--~~~---~--~~
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 RuleDispatch install problem

2006-10-18 Thread exhuma.twn



On Sep 21, 7:32 am, Gary Scarr [EMAIL PROTECTED] wrote:
 I'm getting the following error trying to findRuleDispatch.  I'm using
 OS X on an Intel Mac with python2.4 and setuptools installed via
 DarwinPorts (hence the use of /opt/local rather than /usr/local).  But
 it looks like the error is due to a missing index file on PyPi.  But
 I'm totally new to Easy_install and TG so maybe I'm missing the obvious
 - hence asking the experts...

 Thanks in advance,
 Gary

 sudo easy_install 
 -fhttp://www.turbogears.org/preview/download/index.html--script-dir
 /opt/local/bin TurboGears
 Password:
 Searching for TurboGears
 Best match: TurboGears 1.0b1
 Processing TurboGears-1.0b1-py2.4.egg
 TurboGears 1.0b1 is already the active version in easy-install.pth
 Installing tg-admin script to /opt/local/bin

 Using
 /opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/TurboGears-1.0b1-py2.4.egg
 Processing dependencies for TurboGears
 Searching forRuleDispatch
 Readinghttp://www.turbogears.org/preview/download/index.html
 Readinghttp://www.python.org/pypi/RuleDispatch/
 Couldn't find index page for 'RuleDispatch' (maybe misspelled?)
 Scanning index of all packages (this may take a while)
 Readinghttp://www.python.org/pypi/
 No local packages or download links found forRuleDispatch
 error: Could not find suitable distribution for
 Requirement.parse('RuleDispatch')

I am getting similar problems too. Trying to visit
http://www.python.org/pypi/RuleDispatch/; yields a Not Found error.
What happened? I need to install Turbogears somewhere during this week.


--~--~-~--~~~---~--~~
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 and forms

2006-10-18 Thread Tor Hildrum

I tried posting to this group earlier trough Google Groups, but it
never showed up so I'm trying again.

I'm getting my feet wet with TurboGears, and creating a book library
while doing so.

I have a huge form for adding books.

In my controller I have the following:
--
@expose(template=bibliotek.templates.showBook)
def addBook(self, **kw):
--

Now, kw should hold all the form-data, and I need to create the book.

I've tried passing in a dict to my 'model constructor':
---
newBook = Book(kw)
--

File 
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/SQLObject-0.7.1-py2.4.egg/sqlobject/declarative.py,
line 93, in _wrapper
return fn(self, *args, **kwargs)
TypeError: __init__() takes exactly 1 argument (2 given)

I've tried creating the book 'manually':
---
theObject = 
for key in kw:
   theObject = theObject + key + =' + kw[key] + ',

# remove trailing comma
theObject = theObject[:-1]

newBook = Book(theObject)


This gives the same error and backtrace as above.

So, how exactly do I do this? Do I have to create the constructor in model.py?

Also, is http://www.sqlobject.org/ down for anyone else?

regards

Tor

--~--~-~--~~~---~--~~
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: Getting Started example dosen't work

2006-10-18 Thread Elvelind Grandin

it should be.

class Root(controllers.RootController):
@expose()
def index(self):
   return h1Hello World/h1

On 10/18/06, PM [EMAIL PROTECTED] wrote:

 Hi,

 I've installed TG and started reading the Getting Started Guide.

 The first example given doesn't work for me :

 [code]
 from turbogears import controllers, expose

 @expose()
 class Root(controllers.RootController):
 def index(self):
 return h1Hello World/h1
 [/code]

 I get the following error in my terminal :

 D:\turbogears\gspython start-gs.py
 Traceback (most recent call last):
   File start-gs.py, line 26, in ?
 from gs.controllers import Root
   File D:\turbogears\gs\gs\controllers.py, line 4
 class Root(controllers.RootController):
 ^
 SyntaxError: invalid syntax

 Where is my mistake ?

 It's a little bit frustrating when the first example given doesn't
 work.

 Python version : 2.4.3
 TG version : 1.0b1 installed with easy_install

 PM


 



-- 
cheers
elvelind grandin

--~--~-~--~~~---~--~~
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: Handling large forms

2006-10-18 Thread Italo Maia

Like this you get a list and a dictionary with your data:

@expose(template=library.templates.showBook)
def addBook(self, *args, **kw)
   # add book to db
   # return book


--~--~-~--~~~---~--~~
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: Getting Started example dosen't work

2006-10-18 Thread PM

After some tests it appears that it's the line @expose() that causes
the error but I've started learning TG today so I've very limited
knowings about this framework.


--~--~-~--~~~---~--~~
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: Problem following the tutorial

2006-10-18 Thread Lee McFadden

On 10/18/06, John Henry [EMAIL PROTECTED] wrote:

 I am following the tutorial at:

 http://docs.turbogears.org/1.0/Wiki20/Page3

 I am having trouble at the top of step 3 after:

   tg-admin toolbox

 I am getting a:

   NameError: name 'page' is not defined

 I checked several times, and the file page.kid exists (so is page.pyc).

 What did I do wrong?


Without seeing your code it's difficult to say.  Could you send your
index method to the list?  You'll want to check that you've got
exactly the same code as the tutorial.

Lee


-- 
Lee McFadden

blog: http://www.splee.co.uk
work: http://fireflisystems.com

--~--~-~--~~~---~--~~
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: Getting Started example dosen't work

2006-10-18 Thread PM

Yeah it's working. Thanks Elvelind.


--~--~-~--~~~---~--~~
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: SQLObject and forms

2006-10-18 Thread Lee McFadden

On 10/18/06, Tor Hildrum [EMAIL PROTECTED] wrote:


 I've tried passing in a dict to my 'model constructor':
 ---
 newBook = Book(kw)
 --


For this to work you'd need to use:

newBook = Book(**kw)

However, you'd have to be certain that there's nothing in the dict's
keys other than in the Book object's column names otherwise SO may
complain (not 100% sure on that as I've never looked into how SO
initialises a new object).


 I've tried creating the book 'manually':
 ---
 theObject = 
 for key in kw:
theObject = theObject + key + =' + kw[key] + ',

 # remove trailing comma
 theObject = theObject[:-1]

 newBook = Book(theObject)
 

That definately won't work.  All you're doing there is passing in one
big string to SO.

The *preferred* way of creating a new object is to pass each column
and it's data as a keyword/value pair (I'm going to make up the column
names for your Book class, but you should get the idea):

new_book = Book(title=kw['title'], author=kw['author'],
isbn=kw['isbn'], publisher=kw['publisher'])

Hope this helps.

Lee


-- 
Lee McFadden

blog: http://www.splee.co.uk
work: http://fireflisystems.com

--~--~-~--~~~---~--~~
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: SQLObject and forms

2006-10-18 Thread Lee McFadden

Just as an addendum...  Even if you do get `new_book = Book(**kw)` to
work, it's a seriously bad idea.  The kw dict will also contain
anything you put as query arguments to the URL so, to break your app,
all anyone has to do is go to:

http://example.com/addBook?extra=data

It's best to explicitly initialise your SQLObject instances just so
you don't get errors cropping up later on.

Lee

On 10/18/06, Lee McFadden [EMAIL PROTECTED] wrote:
 On 10/18/06, Tor Hildrum [EMAIL PROTECTED] wrote:
 
 
  I've tried passing in a dict to my 'model constructor':
  ---
  newBook = Book(kw)
  --
 

 For this to work you'd need to use:

 newBook = Book(**kw)

 However, you'd have to be certain that there's nothing in the dict's
 keys other than in the Book object's column names otherwise SO may
 complain (not 100% sure on that as I've never looked into how SO
 initialises a new object).

 
  I've tried creating the book 'manually':
  ---
  theObject = 
  for key in kw:
 theObject = theObject + key + =' + kw[key] + ',
 
  # remove trailing comma
  theObject = theObject[:-1]
 
  newBook = Book(theObject)
  
 
 That definately won't work.  All you're doing there is passing in one
 big string to SO.

 The *preferred* way of creating a new object is to pass each column
 and it's data as a keyword/value pair (I'm going to make up the column
 names for your Book class, but you should get the idea):

 new_book = Book(title=kw['title'], author=kw['author'],
 isbn=kw['isbn'], publisher=kw['publisher'])

 Hope this helps.

 Lee


 --
 Lee McFadden

 blog: http://www.splee.co.uk
 work: http://fireflisystems.com



-- 
Lee McFadden

blog: http://www.splee.co.uk
work: http://fireflisystems.com

--~--~-~--~~~---~--~~
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: Getting Started example dosen't work

2006-10-18 Thread gasolin

Hi:

That's my fault (fixed),
We are glad to improve the doc according to new commers' response.
I'm very intrested that did the doc layout lead you to learn from API
first?
I suggest you start learning tg from 'Brian Beck's Multiuser Todo List'
tutorial.


Those docs in API section are a bit out of date, thus we are
refactoring it and some mistakes occured.

--
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: Observers

2006-10-18 Thread mario henrique
I think, that having observers in widgets, would be a plus to turbogears, like in JSF (Java Server Faces). How the thing works?You create a widget and associates some event that occurs in this widget with one method in the server, and the application write all _javascript_ necessary to you.
example:nowadays:apartmentType = widgets.TextField(name		= apartamentType,label		= 
Name: ,attrs		= dict(maxlength = 64, size = 30
),validator	= validators.String(max = 64, not_empty = True),help_text	= )
with event handler, the widget could beapartmentType = widgets.TextField(name		= apartamentType,label		= 
Name: ,attrs		= dict(maxlength = 64, size = 30
),validator	= validators.String(max = 64, not_empty = True),help_text	= , 
event_handler   = dict('onchange', 'selectedApJs', turbogears.url('selectedAp'))  )
where  eventselectedApJs = _javascript_ function to work with data returned by turbogears.url('selectedAp')

selectAp = method in the server, invoked by any change on this textfield.I think is this.mario h.c.t.

On 10/17/06, Jorge Godoy [EMAIL PROTECTED] wrote:
isaac [EMAIL PROTECTED] writes: I'm wondering... how would you do that *without* JS?Probably Rails generates the _javascript_. Or do you mean JS I don't have to write myself?;)
Probably. :-)BUT there's also a different paradigm as a push method instead of a pollingapplication.Take a look at comet, for example. This could be done fairly easily as a widget, it's just that no one
 has done it in a handy re-usable form, AFAIK, yet.It just takes a couple of lines.It's so simple that isn't worth packagingalone :-)I believe that it makes more sense when you embed it with your application's
specific code to achieve something otherwise it is a bit overkill to usewidgets just for that and using them alone at the template.--Jorge Godoy[EMAIL PROTECTED]

--~--~-~--~~~---~--~~
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: Getting Started example doesn't work

2006-10-18 Thread PM

 I'm very intrested that did the doc layout lead you to learn from API
 first?

I simply followed the links from TG - Documentation - Reference -
Getting Started. But I don't understand why you're talking about the
API, the document doesn't look like an API :)

 I suggest you start learning tg from 'Brian Beck's Multiuser Todo List'
 tutorial.

Ok I'll do so. 

Thanks for your reactivity


--~--~-~--~~~---~--~~
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: Getting Started example doesn't work

2006-10-18 Thread gasolin

 But I don't understand why you're talking about the
 API, the document doesn't look like an API :)
 

oops, I just feel asleep now :P


--~--~-~--~~~---~--~~
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: Data for globalization

2006-10-18 Thread GinTon

By now I'll use a free hosting for projects related to Python
http://www.webfaction.com/freetrac


--~--~-~--~~~---~--~~
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: globalization data

2006-10-18 Thread GinTon

Does anybody more is agree with Jorge Vargas?

I only want ideas to begin to looking for the best solution and to
begin with the implementation. And better if it's a solution that can
be used for any project in general.


--~--~-~--~~~---~--~~
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: Observers

2006-10-18 Thread isaac


On Oct 17, 2006, at 5:17 PM, Jorge Godoy wrote:

 BUT there's also a different paradigm as a push method instead of a  
 polling
 application.  Take a look at comet, for example.

Hmm, it certainly sounds better than polling. Does anyone more  
familiar with comet have thoughts on what would be entailed in  
getting TG to use it?

 It just takes a couple of lines.  It's so simple that isn't worth  
 packaging
 alone :-)


Maybe so, but it would really be helpful if the framework handled it  
for you. I'd prefer not to have to think about it, especially in a  
big app with a lot of different screens. It would save a LOT of time  
to avoid writing that same bit of code over and over, even if it's  
only a few lines each time. It would make the app much more  
maintainable and changeable too.

--i


--~--~-~--~~~---~--~~
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: Observers

2006-10-18 Thread Adam Jones


mario henrique wrote:
 I think,

 that having observers in widgets, would be a plus to turbogears, like in JSF
 (Java Server Faces).
 How the thing works?
 You create a widget  and associates some event that occurs in this widget
 with one method in the server, and the application write all javascript
 necessary to you.
 example:

 nowadays:

 apartmentType = widgets.TextField(
 name  = *apartamentType*,
 label = *Name: *,
 attrs = dict(maxlength = *64*, size
 = *30*),
 validator = validators.String(max =
 64, not_empty = True),
 help_text = **
 )


 with event handler, the widget could be

 apartmentType = widgets.TextField(
 name  = *apartamentType*,
 label = *Name: *,
 attrs = dict(maxlength = *64*, size
 = *30*),
 validator = validators.String(max =
 64, not_empty = True),
 help_text = *,
 *event_handler   = dict(*'onchange',
 'selectedApJs', turbogears.url('selectedAp'))
 *)

 where
 onchange = javascript event
 selectedApJs = javascript function to work with data returned by *
 turbogears.url('selectedAp')*
 selectAp = method in the server, invoked by any change on this textfield.

It looks like the RPC widget should do most of what you want (could be
extended to fully support this concept), but it needs to be documented
and is not being used in places where it seems like it should. It
really shouldn't be too hard to put together a widget that does what
you are looking for.

I think isaac is correct on this point. The problem is that it is so
easy to put together case-by-case solutions for this that no one has
taken the extra time for a generalized one.

-Adam

 
 
 I think is this.
 
 mario h.c.t.
 
 *
 *
 
 3--


--~--~-~--~~~---~--~~
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 RuleDispatch install problem

2006-10-18 Thread venkatbo

You may want to try an offline install option:
  http://docs.turbogears.org/1.0/OfflineInstall
It lists the steps and points to TG's own download pg:
  http://www.turbogears.org/download/index.html

The above article points also to a zip file of all the
needed files. If that is not accessible, pl look at the
thread Problem with TurboJson=0.9.9, for a list of
files you can manuualy download.

/venkat


--~--~-~--~~~---~--~~
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: Data for globalization

2006-10-18 Thread Bob Ippolito

If the project is free, then you don't need money to pay for the
server. There's plenty of places that will host open source software
for free such as Google Code, SourceForge, etc...

-bob

On 10/17/06, GinTon [EMAIL PROTECTED] wrote:

 I'll follow your advices although I'll have to thinking how earn some
 money to pay the sever.

 Thanks Jorge!


 


--~--~-~--~~~---~--~~
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] old field value reappears

2006-10-18 Thread JM

Hello!

I'm hitting a weird problem. I have the following classes

class Container(SQLObject):
name = UnicodeCol(length=40, alternateID=True)
tests = MultipleJoin('Test')

class Test(SQLObject):
name = UnicodeCol(length=40, alternateID=True)
datafile = ForeignKey('DataFile')
container = ForeignKey('Container')
...

and a method:

@expose()
@validate(form=bm_form)
@error_handler(post)
@identity.require(identity.not_anonymous())
def save(self, id, name, datafile):
user = identity.current.user;

try:
test = Test.get(id)
except SQLObjectNotFound:
print error

...

if testdef.name != name:
testdef.name = name
print New Name is %s % testdef.name



After I call save and successfully change the an existing object's
name, I display a page listing all the tests in the container, and  I
also double check with CatWalk and everything looks fine in the DB
(notrans_sqlite), the test name has changed to the new name.

However, if I keep reloading the page, once every few times the name
changes back to the old one! Trying to retrieve the object by its name
from another method fails, it does not exist in the DB. Even CatWalk
does not show the old name... is it some caching error in CherryPy?

How would you debug this if you were a beginner TG user like me?

Thanks in advance for your help.
JM


--~--~-~--~~~---~--~~
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: Problem following the tutorial

2006-10-18 Thread John Henry

Thanks for the response.  Sorry for not providing more details.

Here's controllers.py:

###
import logging

import cherrypy

import turbogears
from turbogears import controllers, expose, validate, redirect

from wiki20 import json

from wiki20.model import Page
from docutils.core import publish_parts

log = logging.getLogger(wiki20.controllers)

class Root(controllers.RootController):
@expose(template=wiki20.templates.page)
def index(self):
import time
log.debug(Happy TurboGears Controller Responding For Duty)
return dict(now=time.ctime())

@expose(wiki20.templates.page)
def index(self, pagename=FrontPage):
page = Page.byPagename(pagename)
content = publish_parts(page.data,
writer_name=html)[html_body]
return dict(data=content, page=page)
#

Here's model.py:


#
from sqlobject import *

from turbogears.database import PackageHub

hub = PackageHub(wiki20)
__connection__ = hub

# class YourDataClass(SQLObject):
# pass

class Page(SQLObject):
pagename = UnicodeCol(alternateID=True, length=30)
data = UnicodeCol()



Here's page.kid:

##
!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
html xmlns=http://www.w3.org/1999/xhtml;
xmlns:py=http://purl.org/kid/ns#;
py:extends='master.kid'
head
meta content=text/html; charset=utf-8 http-equiv=Content-Type
py:replace=''/
titleWelcome to TurboGears/title
/head
body
div style=float:right; width: 10em
Viewing span py:replace=page.pagenamePage Name Goes Here/span
br/
You can return to the a href=/FrontPage/a.
/div

div py:replace=XML(data)Page text goes here./div
/body
/html



Here's the screen error messages:

#
500 Internal error

The server encountered an unexpected condition which prevented it from
fulfilling the request.

Page handler: bound method Root.index of wiki20.controllers.Root
object at 0x0163D650
Traceback (most recent call last):
  File
c:\python24\lib\site-packages\CherryPy-2.2.1-py2.4.egg\cherrypy\_cphttptools.py,
line 105, in _run
self.main()
  File
c:\python24\lib\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 index
  File
c:\python24\lib\site-packages\TurboGears-1.0b1-py2.4.egg\turbogears\controllers.py,
line 326, in expose
output = database.run_with_transaction(
  File string, line 5, in run_with_transaction
  File
c:\python24\lib\site-packages\TurboGears-1.0b1-py2.4.egg\turbogears\database.py,
line 246, in so_rwt
retval = func(*args, **kw)
  File string, line 5, in _expose
  File
c:\python24\lib\site-packages\TurboGears-1.0b1-py2.4.egg\turbogears\controllers.py,
line 343, in lambda
mapping, fragment, args, kw)))
  File
c:\python24\lib\site-packages\TurboGears-1.0b1-py2.4.egg\turbogears\controllers.py,
line 380, in _execute_func
return _process_output(output, template, format, content_type,
mapping, fragment)
  File
c:\python24\lib\site-packages\TurboGears-1.0b1-py2.4.egg\turbogears\controllers.py,
line 74, in _process_output
fragment=fragment)
  File
c:\python24\lib\site-packages\TurboGears-1.0b1-py2.4.egg\turbogears\view\base.py,
line 131, in render
return engine.render(**kw)
  File
c:\python24\lib\site-packages\TurboKid-0.9.9-py2.4.egg\turbokid\kidsupport.py,
line 174, in render
return t.serialize(encoding=self.defaultencoding, output=format,
fragment=fragment)
  File
c:\python24\lib\site-packages\kid-0.9.3-py2.4.egg\kid\__init__.py,
line 236, in serialize
return serializer.serialize(self, encoding, fragment)
  File
c:\python24\lib\site-packages\kid-0.9.3-py2.4.egg\kid\serialization.py,
line 51, in serialize
text = list(self.generate(stream, encoding, fragment))
  File
c:\python24\lib\site-packages\kid-0.9.3-py2.4.egg\kid\serialization.py,
line 329, in generate
for ev, item in self.apply_filters(stream):
  File c:\python24\lib\site-packages\kid-0.9.3-py2.4.egg\kid\pull.py,
line 210, in _coalesce
for ev, item in stream:
  File
c:\python24\lib\site-packages\kid-0.9.3-py2.4.egg\kid\filter.py, line
21, in transform_filter
for ev, item in apply_matches(stream, template, templates,
apply_func):
  File
c:\python24\lib\site-packages\kid-0.9.3-py2.4.egg\kid\filter.py, line
31, in apply_matches
item = stream.expand()
  File c:\python24\lib\site-packages\kid-0.9.3-py2.4.egg\kid\pull.py,
line 99, in expand
for ev, item in self._iter:
  File c:\python24\lib\site-packages\kid-0.9.3-py2.4.egg\kid\pull.py,
line 168, in _track
for p in stream:
  File c:\python24\lib\site-packages\kid-0.9.3-py2.4.egg\kid\pull.py,
line 210, in _coalesce
   

[TurboGears] Re: SQLObject and forms

2006-10-18 Thread Tor Hildrum

On 10/18/06, Lee McFadden [EMAIL PROTECTED] wrote:

 On 10/18/06, Tor Hildrum [EMAIL PROTECTED] wrote:
 
 
  I've tried passing in a dict to my 'model constructor':
  ---
  newBook = Book(kw)
  --
 

 For this to work you'd need to use:

 newBook = Book(**kw)

 However, you'd have to be certain that there's nothing in the dict's
 keys other than in the Book object's column names otherwise SO may
 complain (not 100% sure on that as I've never looked into how SO
 initialises a new object).

Perfect.

 The *preferred* way of creating a new object is to pass each column
 and it's data as a keyword/value pair (I'm going to make up the column
 names for your Book class, but you should get the idea):

 new_book = Book(title=kw['title'], author=kw['author'],
 isbn=kw['isbn'], publisher=kw['publisher'])

That's not pretty when the table has a lot of attributes, it also
lends itself to problems when/if the db-schema is updated.

I'd rather just use a dict and check it against my db-schema.

One more thing, since I can't access the SQLObject documentation.
**kw holds all the fields in my form, some of them will almost always be empty.
(there are a lot of information that we won't have for most of the books)
Say I have a field in my database:
--
Num_revision =   IntCol()
-
Which is the revision number of the book, this will seldom have a value.
In kw I get:
kw['Num_revision'] == '' # an empty string

Since Num_revision is an IntCol() I have to cast it. So while checking kw
I would do something like:
-
if( schema[key][type] == 'int' ):
   kw[key] = int( kw[key] )
-
key is the attribute, in this case Num_revision.

Now, if Num_revision is '', this will error out.
 Num_revisions = int( '' )
Traceback (most recent call last):
  File stdin, line 1, in ?
ValueError: invalid literal for int():

So, what I would like to do first:
-
for key in kw.keys():
  if( kw[key] == ''):
del kw[key]


This means I only check and add the values the user supplies. I don't
need the rest, they can stay blank.

However, SQLObject refuses me to do this.
File 
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/SQLObject-0.7.1-py2.4.egg/sqlobject/main.py,
line 1217, in _create
raise TypeError, %s() did not get expected keyword argument %s %
(self.__class__.__name__, column.name)
TypeError: Book() did not get expected keyword argument Num_revisions

Is there any way I can get SQLObject to only require me to pass it the
key(ISBN), and have all other fields be optional?

Like this(postgres):
---
library= INSERT INTO book (isb_n) VALUES('1234567');
INSERT 0 1
library= SELECT * FROM book;
 id |  isb_n  | title | series
+-+---++
  1 | 1234567 |   ||
(1 row)
--
Hope this makes sense :)

regards

Tor

--~--~-~--~~~---~--~~
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: SQLObject and forms

2006-10-18 Thread Tor Hildrum

On 10/18/06, Lee McFadden [EMAIL PROTECTED] wrote:

 Just as an addendum...  Even if you do get `new_book = Book(**kw)` to
 work, it's a seriously bad idea.  The kw dict will also contain
 anything you put as query arguments to the URL so, to break your app,
 all anyone has to do is go to:

 http://example.com/addBook?extra=data

 It's best to explicitly initialise your SQLObject instances just so
 you don't get errors cropping up later on.

It will be like this:
def foo(self, **kw):
   bar = kw

   ## Check all keys of bar against schema
  ## and do various actions

   new_book = Book(**bar)

So, I will always be sure that what's passed to Book() will adhere to my schema.
I just don't want to handle the schema manually, as in going trough
every attribute
in the table. I'd rather just loop over the keys that is passed to the
function and check
them against my predefined schema.

regards

Tor

--~--~-~--~~~---~--~~
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: Problem following the tutorial

2006-10-18 Thread Karl Guertin

On 10/18/06, John Henry [EMAIL PROTECTED] wrote:
 class Root(controllers.RootController):
 @expose(template=wiki20.templates.page)
 def index(self):
 import time
 log.debug(Happy TurboGears Controller Responding For Duty)
 return dict(now=time.ctime())

 @expose(wiki20.templates.page)
 def index(self, pagename=FrontPage):
 page = Page.byPagename(pagename)
 content = publish_parts(page.data,
 writer_name=html)[html_body]
 return dict(data=content, page=page)

The error message is that the template is expecting a variable named
'page'. The index method that was called (the one under Root) was
providing only the 'now' variable to the template. You want to replace
the index method in the Root class not add a function outside of any
class.

The above should be:

class Root(controllers.RootController):
@expose(wiki20.templates.page)
def index(self, pagename=FrontPage):
page = Page.byPagename(pagename)
content = publish_parts(page.data,
writer_name=html)[html_body]
return dict(data=content, page=page)

--~--~-~--~~~---~--~~
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: Problem following the tutorial

2006-10-18 Thread John Henry

Okay.  So, that's what one of the comment was talking about.

I am getting further along now.

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
-~--~~~~--~~--~--~---



[TurboGears] Re: SQLObject and forms

2006-10-18 Thread Gregor Horvath

Tor Hildrum schrieb:
 On 10/18/06, Lee McFadden [EMAIL PROTECTED] wrote:
 
Just as an addendum...  Even if you do get `new_book = Book(**kw)` to
work, it's a seriously bad idea.  The kw dict will also contain
anything you put as query arguments to the URL so, to break your app,
all anyone has to do is go to:

http://example.com/addBook?extra=data

It's best to explicitly initialise your SQLObject instances just so
you don't get errors cropping up later on.
 
 
 It will be like this:
 def foo(self, **kw):
bar = kw
 
## Check all keys of bar against schema
   ## and do various actions
 
new_book = Book(**bar)

I use this for that purpose:

def dict_to_attr(dict_, object_):
  valid_attributes = object_.sqlmeta.columns.keys()
  for attr, value in dict_.iteritems():
if attr in valid_attributes:
setattr(object_, attr, value)


--
Greg

--~--~-~--~~~---~--~~
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: SQLObject and forms

2006-10-18 Thread Jorge Vargas

On 10/18/06, Tor Hildrum [EMAIL PROTECTED] wrote:

 On 10/18/06, Lee McFadden [EMAIL PROTECTED] wrote:
 
  On 10/18/06, Tor Hildrum [EMAIL PROTECTED] wrote:
  
  
 
  However, you'd have to be certain that there's nothing in the dict's
  keys other than in the Book object's column names otherwise SO may
  complain (not 100% sure on that as I've never looked into how SO
  initialises a new object).

 Perfect.

if that's all the code you have that will also fail, unless ALL your
SO columns are StringCol, since there is no automatic data convertion.


  The *preferred* way of creating a new object is to pass each column
  and it's data as a keyword/value pair (I'm going to make up the column
  names for your Book class, but you should get the idea):
 
  new_book = Book(title=kw['title'], author=kw['author'],
  isbn=kw['isbn'], publisher=kw['publisher'])

 That's not pretty when the table has a lot of attributes, it also
 lends itself to problems when/if the db-schema is updated.

actually pretty here is not an option your talking about db corruption
unless you do the checks.

 I'd rather just use a dict and check it against my db-schema.

 One more thing, since I can't access the SQLObject documentation.

why not? it's online.

 **kw holds all the fields in my form, some of them will almost always be 
 empty.
 (there are a lot of information that we won't have for most of the books)
 Say I have a field in my database:
 --
 Num_revision =   IntCol()
 -
 Which is the revision number of the book, this will seldom have a value.
 In kw I get:
 kw['Num_revision'] == '' # an empty string

 Since Num_revision is an IntCol() I have to cast it. So while checking kw
 I would do something like:
 -
 if( schema[key][type] == 'int' ):
kw[key] = int( kw[key] )
 -
 key is the attribute, in this case Num_revision.

no use the build in validators that's what they are for

 Is there any way I can get SQLObject to only require me to pass it the
 key(ISBN), and have all other fields be optional?

don't use Alternate id s?

--~--~-~--~~~---~--~~
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: AttributeError in tg-admin sql create

2006-10-18 Thread Jorge Vargas

On 10/17/06, Igor [EMAIL PROTECTED] wrote:

 Hi,


 However the fix for:
 http://trac.turbogears.org/turbogears/ticket/279

 does solve the problem for me.

 I've posted this info on the ticket as well. Is there any uptodate
 information on this other than what's in the ticket?

well this was some time ago and we have upgraded our SO version, since then.

Can you please post your model and issue to the SO mailing list, I'm
pretty sure this is fix but you may have found another edge case.

 Thanks,
 Igor


 


--~--~-~--~~~---~--~~
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 Error with MySQL... :\

2006-10-18 Thread Jorge Vargas

On 10/18/06, core [EMAIL PROTECTED] wrote:

 /usr/lib/python2.4/site-packages/SQLObject-0.7.1-py2.4.egg/sqlobject/mysql/mysqlconnection.py,
 line 73, in _executeRetry
 myquery = unicode(query, self.encoding)
 UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
 71: ordinal not in range(128)

This is an issue with mysql's default encoding.

please check out your ubuntu's my.cfg file for default encoding which
is what mysqldb uses when you don't pass in anything (which is SO's
default)

 Apparently, it works ok when I use a SQLite db (like I do on my
 development machines, one win32 and one suse linux), but when I send it
 to the wanna-be-production (ubuntu linux dapper) where I have to use
 MySQL (4.1), the DB stuff go crazy. The part I do not understand is, it
 worked until some weeks ago, then I took some time off development (ok,
 more than weeks, I left on TG 0.9.something and came back now), and
 things broke. I may be let something pass on the changelogs...

did you upgraded your TG install?

--~--~-~--~~~---~--~~
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: globalization data

2006-10-18 Thread GinTon

I've created a new group for integrating G11n data in Django and
Turbogears:
http://groups.google.com/group/webda

Please I need ideas to get the best possible integration.


--~--~-~--~~~---~--~~
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: Data for globalization

2006-10-18 Thread GinTon

I've created a new group for integrating G11n data in Django and
Turbogears:
http://groups.google.com/group/webda

Please I need ideas to get the best possible integration.


--~--~-~--~~~---~--~~
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] new Categories on the CogBig

2006-10-18 Thread Jorge Vargas

Hello everyone,

just wanted to tell you we have 2 new categories

- turbogears.quickstart.template
- turbogears.extension

under which we have the very nice registration templates by Patrick
Lewis and the recently released TurboMail which Matthew Bevan posted
on this list some days ago.

if anyone has any app that doesn't fits the current Categories please
send a reply to this message and we'll work it out.

PS: the changes are in svn, just need Kevin to rebuild the site :)

--~--~-~--~~~---~--~~
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 on Media Temple grid hosting

2006-10-18 Thread Sanjay

 Also, the faq encourages people
 interested in running Django and TG to get in touch with them so you
 might want to do that if you find this grid stuff interesting.

I could not find this in the FAQ. A link or some guidence would help.

thanks
sanjay


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---