[turbogears-commits] [2232] projects/ToscaWidgets/trunk/toscawidgets/mods: Adding a (minimal) Pylons HostFramework.

2006-12-19 Thread dangoor
Title: [2232] projects/ToscaWidgets/trunk/toscawidgets/mods: Adding a (minimal) Pylons HostFramework.








Revision 2232
Author alberto
Date 2006-12-19 13:43:01 -0500 (Tue, 19 Dec 2006)


Log Message
Adding a (minimal) Pylons HostFramework. Patch from Matthew Scott at #1202. Thanks :)

Modified Paths

projects/ToscaWidgets/trunk/examples/PylonsTWSample/pylonstwsample/config/middleware.py
projects/ToscaWidgets/trunk/examples/PylonsTWSample/pylonstwsample/controllers/home.py


Added Paths

projects/ToscaWidgets/trunk/toscawidgets/mods/pylonshf.py




Diff

Modified: projects/ToscaWidgets/trunk/examples/PylonsTWSample/pylonstwsample/config/middleware.py (2231 => 2232)

--- projects/ToscaWidgets/trunk/examples/PylonsTWSample/pylonstwsample/config/middleware.py	2006-12-18 22:23:14 UTC (rev 2231)
+++ projects/ToscaWidgets/trunk/examples/PylonsTWSample/pylonstwsample/config/middleware.py	2006-12-19 18:43:01 UTC (rev 2232)
@@ -9,9 +9,7 @@
 from pylons.middleware import ErrorHandler, ErrorDocuments, StaticJavascripts, error_mapper
 import pylons.wsgiapp
 
-import toscawidgets.api
-from toscawidgets.api import retrieve_resources
-from toscawidgets.mods.wsgi import WSGIHostFramework
+from toscawidgets.mods.pylonshf import PylonsHostFramework
 from toscawidgets.middleware import TGWidgetsMiddleware
 
 from pylonstwsample.config.environment import load_environment
@@ -51,18 +49,7 @@
 # handling middleware underneath
 
 # Setup ToscaWidgets
-app = TGWidgetsMiddleware(app, WSGIHostFramework)
-
-# Create a rule to retrieve_resources from the 'c' and 'g' objects
-# This shall probably go in a PylonsHostFramework
-from pylons.util import AttribSafeContextObj, ContextObj
-@retrieve_resources.when(
-isinstance(obj, (ContextObj, AttribSafeContextObj))
-)
-def retrieve_from_context(obj):
-return retrieve_resources(
-getattr(obj, name) for name in dir(obj) if not name.startswith('_')
-)
+app = TGWidgetsMiddleware(app, PylonsHostFramework)
 
 # If errror handling and exception catching will be handled by middleware
 # for multiple apps, you will want to set full_stack = False in your config


Modified: projects/ToscaWidgets/trunk/examples/PylonsTWSample/pylonstwsample/controllers/home.py (2231 => 2232)

--- projects/ToscaWidgets/trunk/examples/PylonsTWSample/pylonstwsample/controllers/home.py	2006-12-18 22:23:14 UTC (rev 2231)
+++ projects/ToscaWidgets/trunk/examples/PylonsTWSample/pylonstwsample/controllers/home.py	2006-12-19 18:43:01 UTC (rev 2232)
@@ -17,6 +17,10 @@
 c.value = Person()
 c.action = ""
 c.title = Sample Pylons app
+#XXX retrieving resources from g and c is not a good idea as it
+#could become *very* expensive. Probably better to stick
+#widgets at c.w and g.w and retrieve only from those.
+#c.w and g.w could be WidgetBunches, for example.   
 c.resources = retrieve_resources([g,c])
 return render_response('home')
 


Added: projects/ToscaWidgets/trunk/toscawidgets/mods/pylonshf.py (0 => 2232)

--- projects/ToscaWidgets/trunk/toscawidgets/mods/pylonshf.py	(rev 0)
+++ projects/ToscaWidgets/trunk/toscawidgets/mods/pylonshf.py	2006-12-19 18:43:01 UTC (rev 2232)
@@ -0,0 +1,22 @@
+from new import instancemethod
+from toscawidgets.api import retrieve_resources
+from toscawidgets.mods.wsgi import WSGIHostFramework
+from toscawidgets.view import EngineManager
+
+from pylons.util import AttribSafeContextObj, ContextObj
+
+__all__ = [PylonsHostFramework]
+
+
+class PylonsHostFramework(WSGIHostFramework):
+pass
+
+
[EMAIL PROTECTED](
+isinstance(obj, (ContextObj, AttribSafeContextObj))
+)
+def retrieve_from_context(obj):
+retrieve_resources from the Pylons 'c' and 'g' objects.
+return retrieve_resources(
+getattr(obj, name) for name in dir(obj) if not name.startswith('_')
+)





--~--~-~--~~~---~--~~
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?hl=en  -~--~~~~--~~--~--~---





[tg-tickets] [TurboGears] #1210: Provide a comparison to other python frameworks

2006-12-19 Thread TurboGears
#1210: Provide a comparison to other python frameworks
---+
 Reporter:  lazaridis_com  |   Owner:  anonymous
 Type:  task   |  Status:  new  
 Priority:  normal |   Milestone:   
Component:  Docs   | Version:  1.0b2
 Severity:  normal |Keywords:   
---+
 Provide a document (e.g. on wiki) which compares turbogears to other
 python web-frameworks.

 This document should enable potential users and tool evaluators to get a
 quick overview.

 The comparison could e.g. have the following structure:

  * List of Goals (which a webframework should achieve)
  * List of Requirements
  * List of Webframeworks
  * Elaborations on how the different webframeworks achieve the goals

-- 
Ticket URL: http://trac.turbogears.org/turbogears/ticket/1210
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?hl=en
-~--~~~~--~~--~--~---



[tg-tickets] Re: [TurboGears] #1138: Bad Gateway encountered while installing 1.0b1

2006-12-19 Thread TurboGears
#1138: Bad Gateway encountered while installing 1.0b1
--+-
 Reporter:  billzingler   |Owner:  anonymous
 Type:  defect|   Status:  closed   
 Priority:  high  |Milestone:   
Component:  Installation  |  Version:  1.0b1
 Severity:  critical  |   Resolution:  wontfix  
 Keywords:|  
--+-
Changes (by fredlin):

  * status:  reopened = closed
  * resolution:  = wontfix

Comment:

 Now tg is up to 1.0b2, so this ticket is outdated...

-- 
Ticket URL: http://trac.turbogears.org/turbogears/ticket/1138
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?hl=en
-~--~~~~--~~--~--~---



[tg-tickets] Re: [TurboGears] #1194: import sqlalchemy.ext.assignmapper in model.py

2006-12-19 Thread TurboGears
#1194: import sqlalchemy.ext.assignmapper  in model.py
---+
 Reporter:  maurizio.boscaini  |Owner:  anonymous
 Type:  defect |   Status:  closed   
 Priority:  normal |Milestone:   
Component:  unassigned |  Version:  1.0b2
 Severity:  normal |   Resolution:  fixed
 Keywords: |  
---+
Changes (by fredlin):

  * status:  new = closed
  * resolution:  = fixed

Comment:

 same ticket as #1163, which was fixed in [2149]

-- 
Ticket URL: http://trac.turbogears.org/turbogears/ticket/1194
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?hl=en
-~--~~~~--~~--~--~---



[tg-tickets] Re: [TurboGears] #1209: Data already flushed does not rollback if exception occurs

2006-12-19 Thread TurboGears
#1209: Data already flushed does not rollback if exception occurs
+---
 Reporter:  sanjay  |Owner:  anonymous
 Type:  defect  |   Status:  new  
 Priority:  normal  |Milestone:  1.0b3
Component:  TurboGears  |  Version:  1.0b2
 Severity:  normal  |   Resolution:   
 Keywords:  |  
+---
Comment (by [EMAIL PROTECTED]):

 Sounds to me like what you really need is a way to INSERT that's separate
 from the {{{flush}}} method (rather than changing how flush operates).
 This is how Dejavu works: the {{{Sandbox.memorize}}} method does an
 INSERT, and can be called repeatedly within a transaction. The
 {{{Sandbox.flush_all}}} method then executes COMMIT. (A Dejavu Sandbox is
 similar to an SQLAlchemy Session/Unit of Work.)

-- 
Ticket URL: http://trac.turbogears.org/turbogears/ticket/1209
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?hl=en
-~--~~~~--~~--~--~---



[tg-tickets] Re: [TurboGears] #909: TG1.0 20 Minute Wiki feedback

2006-12-19 Thread TurboGears
#909: TG1.0 20 Minute Wiki feedback
+---
 Reporter:  kevin   |Owner:  anonymous
 Type:  defect  |   Status:  closed   
 Priority:  normal  |Milestone:  1.0b3
Component:  Docs|  Version:  0.9a5
 Severity:  normal  |   Resolution:  fixed
 Keywords:  |  
+---
Changes (by fredlin):

  * status:  new = closed
  * resolution:  = fixed

Comment:

 it's fixed long time ago by kguertin

-- 
Ticket URL: http://trac.turbogears.org/turbogears/ticket/909
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?hl=en
-~--~~~~--~~--~--~---



[tg-tickets] Re: [TurboGears] #1202: add a PylonsHostFramework

2006-12-19 Thread TurboGears
#1202: add a PylonsHostFramework
--+-
 Reporter:  gldnspud  |Owner:  alberto
 Type:  enhancement   |   Status:  closed 
 Priority:  normal|Milestone: 
Component:  toscaWidgets  |  Version:  trunk  
 Severity:  normal|   Resolution:  fixed  
 Keywords:|  
--+-
Changes (by alberto):

  * status:  new = closed
  * resolution:  = fixed

Comment:

 My fault. I had tweaked the patch to rename pylonshf.py to pylons.py which
 seems to confuse the importer. Comitted at [2232]. Thanks :)

-- 
Ticket URL: http://trac.turbogears.org/turbogears/ticket/1202
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?hl=en
-~--~~~~--~~--~--~---



[tg-trunk] Re: Porting FastDataGrid to SA and ToscaWidgets.

2006-12-19 Thread thesamet

Sounds good. It would be great to see it reused in additional
framewords. Let me know how it progress.
We should continue development from this point over svn and make some
alpha-release soon. This kind of thing could be useful for many
projects even in its early stages.

I think we should supply standard controllers for the major web
frameworks in some way - so it would be really plug and play sort of
thing.

BTW, the current implementation of update() iterates over the query
arguments and does setattr over the given database object. This
practically allows a malicious user to set columns that wasn't in the
form.  Maybe it it possible to do ever more terrible things this way...
 Is there a way to make this kind of query arguments not to validate?
For the time being, I've wrote a short hack (in the controller) that
removes query arguments which do not have a corresponding widget.

Best,
Nadav

Alberto Valverde wrote:
 On Dec 17, 2006, at 1:44 AM, thesamet wrote:
 
  Sounds interesting for TGFastData 2.0... Have you thought about
  contributing to this badly-needing-a-mockup TG component?
  Yes. That's the intent.

 Great :)

  One suggestion that pops to mind... Have you thought about using
  generic functions instead of adaptation?
 
  Yes. This should be definitely considered. I'm fairly new to
  RuleDispatch so I might be missing some features. How would you handle
  this scenario using RuleDispatch:
  A user may want to have several fastdata controllers for the same SA
  class, each having a different select() method. So by what rule the
  right instance of select() function should be determined? It seems
  that
  only the URL or the call trace hold this information. Or maybe should
  be passed somehow through a hidden field.

 You can pass the controller instance as an argument and dispatch on
 it. For example, if those functions were methods of the controller
 (by being in a mixin class) you could do:

 select.when(self in FooController and )(function)

 Inheritance will work as expected if extending because if B extends
 A, then self in B would be more specific than self in A so the
 function attached to self in B would kick in. ToscaWidgets uses
 this technique in the pre_init, post_init and adapt_value
 widget methods.

 
  mechanism for free: update.after(hasattr(class_obj, '_cache'))
  (flush_objects_cache)
  Sounds useful. update.before() can be used to do some security checks
  which maybe beyond
  form validation.

 Or logging, or whatever... :) Definetively something useful to have
 IMO, and it comes for free ;)

 
  I imagine TGFastData as something newbies would just do 2 minutes
  after
  writing their first model to have something to play with. And 5
  minutes
  after that they'll have to confront RuleDispatch to change the way
  select() is working or to add post-update event. So I am a bit
  concerned about using RuleDispatch so close to the front-end.

 Fortunately RD can be wrapped in utility functions to hide most of
 the details . The utility function can be called passsing explicit
 parameters to handle the most common cases while still providing an
 optional rule argument to expose the full power of arbitrary
 expressions. This is what turbogears.errorhandling.{error,exception}
 _handler do.

 
  Can we see some code? :)
  Sure.
  http://www.thesamet.com/blog/wp-content/uploads/2006/12/
  TGQuickData-0.1.zip
  (it's called QuickData to make it easy to install it side-by-side with
  the original FastData - I use them both).

 Ok. I've started tinkering with a FastData2 egg taking ideas from
 QuickData and implementing the adapter's methods using generic
 functions and using ToscaWidgets for the widgets. I'm trying to make
 it controller agnostic so a controller class can be a TG controller
 or a Pylons controller (or any kind of controller ideally). I'll post
 back as soon as I have something working... (*hopefully* later today).

 BTW, should we start a FastData2 project in TG's projects svn
 directory for this? I've intentionally left the TG part out as I
 believe we should try and make it independent of TG so it can easily
 be reused in other frameworks. For the moment it's only dependancy is
 ToscaWidgetsForms and RuleDispatch.
 
 Regards,
 
 Alberto


--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
TurboGears Trunk group.
To post to this group, send email to turbogears-trunk@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-trunk?hl=en
-~--~~~~--~~--~--~---



[tg-trunk] Re: Porting FastDataGrid to SA and ToscaWidgets.

2006-12-19 Thread Alberto Valverde


On Dec 19, 2006, at 9:52 AM, thesamet wrote:


 Sounds good. It would be great to see it reused in additional
 framewords. Let me know how it progress.
 We should continue development from this point over svn and make some
 alpha-release soon. This kind of thing could be useful for many
 projects even in its early stages.

Sure. It's going to be useful to one of my projects already so it's  
enough motivation to keep on... :)

 I think we should supply standard controllers for the major web
 frameworks in some way - so it would be really plug and play sort of
 thing.

Agreed.


 BTW, the current implementation of update() iterates over the query
 arguments and does setattr over the given database object. This
 practically allows a malicious user to set columns that wasn't in the
 form.  Maybe it it possible to do ever more terrible things this  
 way...
  Is there a way to make this kind of query arguments not to validate?
 For the time being, I've wrote a short hack (in the controller) that
 removes query arguments which do not have a corresponding widget.

Well. this is what I've got so far:

svn co http://svn.toscat.net/FastData2

(FastData2 chosen for no particular reason... had to give it a name  
when paster createing the egg ;)

Some names have changed in the datahandler/adapter but the idea is  
the same:

I have:

do_create(self, controller, environ, **kw)
do_retrieve(self, controller, environ, **kw)
do_update(self, controller, obj, envrion, **kw)
do_delete(self, controller, obj, envrion, **kw)

which nicely spells CRUD ;) self is the datahandler, controller is...  
the controller, environ is the WSGI environ for the request and **kw  
are arbitrary keyword args which the hosting app/framework can use as  
needed. They're all generic functions. The DataController uses a  
metaclass to automatically make these methods generic and make the  
API sweeter (take a look at tests/test_meta.py if interested).  
Ideally the DataHandler should be state-less because, although Pylons  
would probably instantiate it once per request, TG's current  
implementation instantiates controllers only once.

Some differences with your approach:

Your select and get_row_by_id are both handled by do_retrieve.
The controller has no form_widget, etc, attributes. These will be  
fetched by widget_for so the view is decoupled from the controller.

Some things I don't know how to port:

The rules to generate widgets for SA import turbogears' session. How  
could be generalize this to play nice with other frameworks which  
could implement session in many different ways (sessioncontext,  
create one once per-request...)? I'd rather move the session- 
requiring rules to an extension or let the developer implement them  
themselves.

Tests cover more or less so far the controller.py module (which isn't  
really the controller but the DataHandler (sort of an adapter)) and  
the view.py module which defines the widget_for gf and the  
register_widget_for wrapper which aims to connect business/model  
objects and the widgets to view them. The idea I have in mind is that  
the default rule for an SO or SA mapped classes calls recursively  
widget_for (and only widget_for) on the object's attributes to  
generate the fields/child-widgets. These rules could be overridden at  
any time to have total control over the resulting widget. Hints  
could also be placed in the model to tell how their corresponding  
widgets should be generated (more or less a là Django-admin).

The architecture I have in mind is that the (TG or Pylons) controller  
ideally should not be overridden likely (unless extra exposed  
methods are needed). The controller per-se should only take care of  
doing the boiler plate stuff of validating using the form, choosing  
the output template, set headers, etc...

All the grunt work should be done by the DataHandler which can be  
extended via gfs. However, If no the user should not want to use gfs,  
any  object that implements the IDataHandler interface can be plugged  
in.

One controller should be able to handle CRUD operations on more than  
one model/business object at once.

This should result in an easily modifiable/extensible CatWalk  
ideally (AJAXified in a near future) if my time machine is properly  
tuned ;) I'm also envisioning a nice plug point for access rules (via  
before decorators) using RuleDispatch based on PEAK security  
(TurboPeakSecurity2 ;).

BTW, tgdatacontroller is half baked and will probably break in a  
thousand places... beware ;).

Well, I'll try to finish more or less the tgdatacontroller later this  
evening and set up some sort of demo to see how all this glues  
together...

If you (or anyone) want (s) to collaborate email privately for a  
commit account, though I rather host this (or whatever we end up  
cooking) at TG's SVN preparing it to be one of 2.0's components...

Any feedback appreciated... Am I pushing too far the generic  
functions approach maybe? Anything way off 

[tg-trunk] Re: Porting FastDataGrid to SA and ToscaWidgets.

2006-12-19 Thread Kevin Dangoor


On Dec 16, 2006, at 7:44 PM, thesamet wrote:




Sounds interesting for TGFastData 2.0... Have you thought about
contributing to this badly-needing-a-mockup TG component?

Yes. That's the intent.


Sorry for not chiming in earlier.

I'd be happy to give you access to the repository so that you can  
hack on FastData directly. That is, indeed, a project in need of a  
maintainer. Send me a separate, private mail with a username/password  
and I'll get you going.


By the way, one of the huge problems with FastData was styling: it  
was difficult to impossible to adjust the way things look because  
FastData controlled the page. But, with Genshi and Genshi's flexible  
includes, it should be quite possible to have FastData produce an  
entire interface that is still readily customized and added to via  
py:match.


Thanks for looking at this!

Kevin


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears Trunk group.
To post to this group, send email to turbogears-trunk@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-trunk?hl=en
-~--~~~~--~~--~--~---



[tg-trunk] Re: Porting FastDataGrid to SA and ToscaWidgets.

2006-12-19 Thread [EMAIL PROTECTED]


Hi:

Thanks! I give it a try and found both TG with SO and SA are not work.

In controllers.py

   from model import User
   from fastdata2.tgdatacontroller import *

   usermin = TGDataController(User)


when I try to run the start-ooo.py, I got following error:

D:\demo\ooostart-ooo.py
Traceback (most recent call last):
 File D:\demo\ooo\start-ooo.py, line 23, in ?
   from ooo.controllers import Root
 File D:\demo\ooo\ooo\controllers.py, line 8, in ?
   from fastdata2.tgdatacontroller import *
 File d:\workplane\fastdata\fastdata2\tgdatacontroller.py, line 10,
in ?
   from fastdata2.controller import IDataHandler
 File d:\workplane\fastdata\fastdata2\controller.py, line 3, in ?
   class IDataHandler(object):
 File d:\workplane\fastdata\fastdata2\meta.py, line 16, in __new__
   methods = [(name, getattr(new_,name,None)) for name in names]
TypeError: Error when calling the metaclass bases
   iteration over non-sequence


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
TurboGears Trunk group.
To post to this group, send email to turbogears-trunk@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-trunk?hl=en
-~--~~~~--~~--~--~---



[TurboGears] genshi XHTML output

2006-12-19 Thread Simon Wittber

It seems tags in a genshi template like:

meta content=text/html; charset=UTF-8 http-equiv=content-type /
link rel='stylesheet' href='/static/css/item.css' /

get changed to:

meta content=text/html; charset=UTF-8 http-equiv=content-type
link rel='stylesheet' href='/static/css/item.css'

which is of course not valid XHTML!

Is genshi doing this, or something else in the TG pipe mangling the
XML?

Has anyone come across this before me?

-Sw.


--~--~-~--~~~---~--~~
 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: Strange IE problems with loadJSONDoc

2006-12-19 Thread Florent Aide

Thanks for the input Jorge. I took good note of this :)

Florent.

--~--~-~--~~~---~--~~
 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] ValueError: too many values to unpack

2006-12-19 Thread jose

While I was modifying a script, I get the following error: 

Page handler: bound method Root.index of sicer.controllers.Root object at 
0xb6a3502c
Traceback (most recent call last):
  File 
/usr/lib/python2.4/site-packages/CherryPy-2.2.1-py2.4.egg/cherrypy/_cphttptools.py,
 line 105, in _run
self.main()
  File 
/usr/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 index
  File 
/usr/lib/python2.4/site-packages/TurboGears-1.0b2-py2.4.egg/turbogears/controllers.py,
 line 334, in expose
output = database.run_with_transaction(
  File string, line 5, in run_with_transaction
  File 
/usr/lib/python2.4/site-packages/TurboGears-1.0b2-py2.4.egg/turbogears/database.py,
 line 295, in sa_rwt
retval = dispatch_exception(e,args,kw)
  File 
/usr/lib/python2.4/site-packages/TurboGears-1.0b2-py2.4.egg/turbogears/database.py,
 line 284, in sa_rwt
retval = func(*args, **kw)
  File string, line 5, in _expose
  File 
/usr/lib/python2.4/site-packages/TurboGears-1.0b2-py2.4.egg/turbogears/controllers.py,
 line 351, in lambda
mapping, fragment, args, kw)))
  File 
/usr/lib/python2.4/site-packages/TurboGears-1.0b2-py2.4.egg/turbogears/controllers.py,
 line 391, in _execute_func
return _process_output(output, template, format, content_type, mapping, 
fragment)
  File 
/usr/lib/python2.4/site-packages/TurboGears-1.0b2-py2.4.egg/turbogears/controllers.py,
 line 82, in _process_output
fragment=fragment)
  File 
/usr/lib/python2.4/site-packages/TurboGears-1.0b2-py2.4.egg/turbogears/view/base.py,
 line 130, in render
return engine.render(**kw)
  File 
/usr/lib/python2.4/site-packages/TurboKid-0.9.8-py2.4.egg/turbokid/kidsupport.py,
 line 156, in render
return t.serialize(encoding=self.defaultencoding, output=format, 
fragment=fragment)
  File /usr/lib/python2.4/site-packages/kid-0.9.3-py2.4.egg/kid/__init__.py, 
line 236, in serialize
return serializer.serialize(self, encoding, fragment)
  File 
/usr/lib/python2.4/site-packages/kid-0.9.3-py2.4.egg/kid/serialization.py, 
line 51, in serialize
text = list(self.generate(stream, encoding, fragment))
  File 
/usr/lib/python2.4/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 /usr/lib/python2.4/site-packages/kid-0.9.3-py2.4.egg/kid/pull.py, line 
210, in _coalesce
for ev, item in stream:
  File /usr/lib/python2.4/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 /usr/lib/python2.4/site-packages/kid-0.9.3-py2.4.egg/kid/filter.py, 
line 39, in apply_matches
template, templates[:i] + templates[i+1:], apply_func):
  File /usr/lib/python2.4/site-packages/kid-0.9.3-py2.4.egg/kid/filter.py, 
line 31, in apply_matches
item = stream.expand()
  File /usr/lib/python2.4/site-packages/kid-0.9.3-py2.4.egg/kid/pull.py, line 
99, in expand
for ev, item in self._iter:
  File /usr/lib/python2.4/site-packages/kid-0.9.3-py2.4.egg/kid/pull.py, line 
168, in _track
for p in stream:
  File /usr/lib/python2.4/site-packages/kid-0.9.3-py2.4.egg/kid/pull.py, line 
210, in _coalesce
for ev, item in stream:
ValueError: too many values to unpack

I don't know what I did wrong, thus I restored it from svn but the error don't 
go away.
Any ideas?

jo






--~--~-~--~~~---~--~~
 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] [SQLObject] Do I get it?

2006-12-19 Thread Tor Hildrum

I'm trying to understand SQLObject so I've created my own schema.

Here is how it works:
At the top you have 'Type', this is a table for grouping stuff.
Then you have 'Equipment' which belongs to a Type-group.
Equipment is an abstract definition of a physical thing.
Then you have 'Items' which is a physical entity of an 'Equipment'.
A physical entity can have a status associated with it.
There are 'inv_Users' who can borrow 'Items', and this
is stored in 'Loan'.

So a Type can hold several types of 'Equipment',
and 'Equipment' can hold several 'Items'. An item
has a status, and a user can borrow an item.

Example:
Type: Computers
Equipment: 'Type: Computers, name: MacBook'
Items: 'Equipment:MacBook, name: MacBook1, barcode: 1234'
Status: 'fine'
inv_Users: 'Tor Hildrum'
Loan:
{
barcode: 1234
user_id: 'Tor Hildrum'
..
}

I'm wondering if I understood the relational mappings.
Here is my model code:



class Type (SQLObject):
  name = UnicodeCol(length=20)
  equipment = MultipleJoin('Equipment', joinColumn='type_id')

class Equipment (SQLObject):
  name = UnicodeCol(length=40)
  type_id = ForeignKey('Type')
  items = MultipleJoin('Items', joinColumn='equipment_id')

class Items (SQLObject):
  name = UnicodeCol(length=40)
  barcode = IntCol()
  equipment_id = ForeignKey('Equipment')
  status_id = ForeignKey('Status')
  loan = MultipleJoin('Loan', joinColumn='barcode')

class inv_Users (SQLObject):
  name = UnicodeCol(length=50)
  loan = MultipleJoin('Loan', joinColumn='user_id')

class Status (SQLObject):
  name = UnicodeCol(length=15)
  status_id = MultipleJoin('Items', joinColumn='status_id')

class Loan (SQLObject):
  barcode = ForeignKey('Items')
  user_id = ForeignKey('inv_Users')
  borrowed = DateTimeCol(default=datetime.now)
  delivered = DateTimeCol()



Does this look correct?

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?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: ValueError: too many values to unpack

2006-12-19 Thread jose

Never mind, I found the error.  :-[

jo


--~--~-~--~~~---~--~~
 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: genshi XHTML output

2006-12-19 Thread Jorge Godoy

Simon Wittber [EMAIL PROTECTED] writes:

 It seems tags in a genshi template like:

 meta content=text/html; charset=UTF-8 http-equiv=content-type /
 link rel='stylesheet' href='/static/css/item.css' /

 get changed to:

 meta content=text/html; charset=UTF-8 http-equiv=content-type
 link rel='stylesheet' href='/static/css/item.css'

 which is of course not valid XHTML!

Of course!  It is saying that it is text/html above.  Why would it be valid
XHTML if it is outputting HTML?

 Is genshi doing this, or something else in the TG pipe mangling the
 XML?

 Has anyone come across this before me?

Isn't there a switch as the one for Kid where you decide the output type you
want?  TG comes with a HTML default.

Also remember that IE doesn't support XHTML served with the right content type
so if you serve XHTML with a text/html doctype you end up with tagsoup in IE. 

You can google for several articles on the content type for XHTML subject. 


Be seeing you,
-- 
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?hl=en
-~--~~~~--~~--~--~---



[TurboGears] cherrypy sessions howto

2006-12-19 Thread jose

1   import cherrypy 
2
3   @turbogears.expose(html=myproject.templates.counter) 
4   def counter(self): 
5   # Session variable initialization (or recall if exists) 
6   cherrypy.session['count'] = cherrypy.session.get('count', 0)  
7 
8   # Variable assignment 
9   cherrypy.session['count'] = cherrypy.session['count'] + 1 
10
11  #Return the value to your template 
12  return dict(counter=cherrypy.session['count']) 


I'm trying to use sessions
but 

print cherrypy.session.get('count',0)

*** AttributeError: 'thread._local' object has no attribute 'request'

What am I doing wrong?

jo


--~--~-~--~~~---~--~~
 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: cherrypy sessions howto

2006-12-19 Thread Jorge Godoy

jose [EMAIL PROTECTED] writes:

 I'm trying to use sessions
 but 

 print cherrypy.session.get('count',0)

 *** AttributeError: 'thread._local' object has no attribute 'request'

 What am I doing wrong?

Where are you doing that?  At the interactive shell or inside a running
project?  You won't get it from the shell... 

-- 
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?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: cherrypy sessions howto

2006-12-19 Thread jose

Jorge Godoy wrote:

jose [EMAIL PROTECTED] writes:

  

I'm trying to use sessions
but 

print cherrypy.session.get('count',0)

*** AttributeError: 'thread._local' object has no attribute 'request'

What am I doing wrong?



Where are you doing that?  At the interactive shell or inside a running
project?  You won't get it from the shell... 
  

Thank you Jorge. :-)

jo




--~--~-~--~~~---~--~~
 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: Validation and Error Handling doubts

2006-12-19 Thread José de Paula Eufrásio Júnior
On 11/4/06, Gregor Horvath [EMAIL PROTECTED] wrote:
 José de Paula Eufrásio Júnior schrieb:

 
  * How I i18n it? The messages, I mean.

 You need this:

 http://svn.formencode.org/FormEncode/branches/gettext-enabled/
 http://trac.turbogears.org/turbogears/ticket/1136

Hey, just applied your patch on 1.0b2, any changes from the one from
the tickets to 1.0b2? And Is kevin going to merge that on the trunk
someday?

-- 
José de Paula Eufrásio Júnior
aka coredump
http://core.eti.br

--~--~-~--~~~---~--~~
 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: Validation and Error Handling doubts

2006-12-19 Thread Gregor Horvath

José de Paula Eufrásio Júnior schrieb:
 On 11/4/06, Gregor Horvath [EMAIL PROTECTED] wrote:
 José de Paula Eufrásio Júnior schrieb:

 * How I i18n it? The messages, I mean.
 You need this:

 http://svn.formencode.org/FormEncode/branches/gettext-enabled/
 http://trac.turbogears.org/turbogears/ticket/1136
 
 Hey, just applied your patch on 1.0b2, any changes from the one from
 the tickets to 1.0b2? 

no

And Is kevin going to merge that on the trunk
 someday?
 

I hope so.
The formencode changes are now merged with the trunk, so you do not need 
the gettext enabled branch but the trunk.

--
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?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: Controller organization

2006-12-19 Thread Lee McFadden

On 12/15/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

 Hi guys!

 I'm a webware user and I want to test newer tecnologies, I like the way
 cherrypy works and I was between turbogears and pylons, so I want to
 give a try to turbogears. My goal is to port a large system build over
 webware to turbogears. Well, I think I will have many question with the
 time :D

 The first one is about controllers.py. I like to organize my sites in
 subsections, as above:

 /site
/about
/services
/admin


You can use the tgbig quickstart template to get a more modular
controller layout:

tg-admin quickstart --template=tgbig

This will create a controllers folder that will make it easier for you
to split up your controller classes.


 I try to do an arrange like this in tg and I was sucessfull with 2
 methods, the first one is...

 .  class Admin(controllers.RootController):
 .  @expose(template='cheetah:saraswati.templates.admin.index')
 .  def index(self):
 .  return {}
 .
 .  class Root(controllers.RootController):
 .  @expose(template=cheetah:saraswati.templates.index)
 .  def index(self):
 .  return {}
 .
 .  admin = Admin()

 ... and the second one:

 .  class Root(controllers.RootController):
 .  @expose(template=cheetah:saraswati.templates.index)
 .  def index(self):
 .  return {}
 .
 .  class Admin(controllers.RootController):
 .  @expose(template='cheetah:saraswati.templates.admin.index')
 .  def index(self):
 .  return {}
 .  admin = Admin()
--8-- snip --8--

The only controller that should use `controllers.RootController` is,
unsurprisingly, the Root controller.  The others should all use
`controllers.Controller`

class AnotherController(controllers.Controller):
pass


 What do you think? I have another question too. If I have 2 independent
 project, suppose one is the site project and the other one is a pool
 application. Is there a way to integrate the pool application inside
 the site project. I think I can because I can insert another controller
 inside the root controller, am I right?


I'm not sure what you're asking here.  If you're asking if you can run
two TG apps from one codebase, you probably could achieve this, but it
would be much more hassle than it's worth and it wouldn't be very
clear with respect to your code.

Hope this helps.

Lee

-- 
Lee McFadden

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

--~--~-~--~~~---~--~~
 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: Template name in expose

2006-12-19 Thread michelts

Hi Adam!

 That is possible, although it gets pretty tricky in anything but the
 simple cases. Part of the problem is that your decorator is acting on a
 function before it is bound to the class, so you can't really look up
 what the function belongs to. At least that is what I think I ran into.
 The real problem is that, say you have a heirarchy like this:

I understand, and there is no way to configure this without pass an
argument to the decorator (at least I don't find any method or
attribute on the func argument :D), and this way we aren't saving
typing...

 Anyways, this should do it for you if you are still interested. I
 didn't have much time to test it, just to confirm that it provides the
 expected behavior. If it breaks any of the other features of expose I
 would not be suprised.

Hum, it seems to work ok, but in a flat hierachy :), the name clashing
is inevitable. Thanks for your code, this helped me to understand how
to make a custom expose method.

I think I need to dig up more deeper to understand the way to work
with turbogears. In webware world I work with servlets, object
orientation and inheritance.

Thanks for all help!

-- 
Michel Thadeu Sabchuk
Curitiba - Brasil

--~--~-~--~~~---~--~~
 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: ?Importing a function into a Kid template?

2006-12-19 Thread Jeff Hinrichs - DMT

On 12/19/06, Jeff Hinrichs - DMT [EMAIL PROTECTED] wrote:
  I've taken your input and modified the code. In fact, I built a
  breadcrumbs.py module that is generic enough to work out of the box
  along with the kid template snippet.  I'd be happy to post it and if
  it would add anything I could post it to the wiki.  I am just
  finishing up with the epydoc strings for the module.
 
Well I didn't get any feedback about posting it to the wiki or such
but I felt it might help some else out so I set it up on google.

http://code.google.com/p/tg-breadcrumbs/


enjoy and thanks

-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?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: ToscaWidgets

2006-12-19 Thread TG-Martin Peschke

Alberto, I didnt notice that Google Groups actually put up the post,
since it never updated the whole day back then. Now I'm back to the
question of widgets, since its getting serious now, I have implemented
many Genshi Templates meanwhile and even have to say I can live without
?python ?

But I want to provide now a  look-ahead-while-typing text field. So im
just right now at updating the TW installation. Ill be back in some
mins with more info.


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

2006-12-19 Thread TG-Martin Peschke

hmmm, I viewed the sample application, it is stripped down to the bare
bones and I have not checked the TW source, using the vanilla sample,
which should work out of the box (with updated TW rev:2224/TWF
rev:2217)

does break again, this time it breaks while trying to load all the JS
links:

{{{  File \TurboGears-1.0b2-py2.4.egg\turbogears\controllers.py,
line 68, in _process_output
js[script.location].add(script)
KeyError: 'bodybottom'}}}


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

2006-12-19 Thread Alberto Valverde


On Dec 19, 2006, at 3:18 PM, TG-Martin Peschke wrote:


 hmmm, I viewed the sample application, it is stripped down to the bare
 bones and I have not checked the TW source, using the vanilla sample,
 which should work out of the box (with updated TW rev:2224/TWF
 rev:2217)

 does break again, this time it breaks while trying to load all the JS
 links:

 {{{  File \TurboGears-1.0b2-py2.4.egg\turbogears\controllers.py,
 line 68, in _process_output
 js[script.location].add(script)
 KeyError: 'bodybottom'}}}


This is related to the samples not requiring TW post r2229. There's  
been a change on how TG apps load the HostFramework object (now done  
by a TG extension and configured in the config file) and the examples  
require latest TW.

Try:

easy_install -U ToscaWidgets==dev

As a side note, if latest dev still breaks, would you mind sending me  
privately the results of the tests? To run them you'll have to do a  
checkout from http://www.turbogears.org/svn/turbogears/projects/ 
ToscaWidgets/trunk and run python setup.py test there.

Thanks for the feedback :)

Alberto

--~--~-~--~~~---~--~~
 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: Strange IE problems with loadJSONDoc

2006-12-19 Thread Christian

Christopher Arndt wrote:
 You could try setting a few cache-control
 headers (e.g. 'Expire' and friends) in your JSON response like this

 import cherrypy
 from time import strftime , gmtime, time

 time_fmt = '%a, %d %b %Y %H:%M:%S GMT'
 cache_seconds = 0

 @expose('json')
 def add_item(self, *params, **kw):
 now = time()
 cherrypy.response.headerMap['Last-Modified'] = \
   strftime(time_fmt, gmtime(now))
 cherrypy.response.headerMap['Expires'] = \
   strftime(time_fmt, gmtime(now + cache_seconds))
 ...
 return dict_for_json

This sounds like the best solution to me (and the most true to HTTP).
Setting the 'Expires' header to zero should also work.  From RFC 2616:

HTTP/1.1 clients and caches MUST treat other invalid date formats,
especially including the value 0, as in the past (i.e., already
expired).

That is what I do in my responses that I don't want IE to cache and it
works well.

Christian
http://www.dowski.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?hl=en
-~--~~~~--~~--~--~---



[TurboGears] TG and pylint

2006-12-19 Thread Jeff Hinrichs - DMT

Is anyone using pylint on their TG source code?

If you are, what, if any, changes have you made to your rcfile?

There are some naming conventions that make pylint cry foul, given
that Kevin has ruled that PEP 8 should be the standard,
http://docs.turbogears.org/1.0/Contributing#coding-style - however
there is some flexibility in naming and such.  I was hoping that some
one had already had a pylint rcfile that accounted for these with
regards to TG.

With the docstring party that is approaching, it might be a good idea
to use a tool like pylint to automate a portion of code
checking/submission process since tools like pylint can find missing
docstrings, naming convention problems, unused imports, bad coding
practices, etc. (I am a lazy guy and if I can get a tool to do it for
me -- lucky meg)

One final group question, does anyone else have issues with
  from sqlobject import *
I didn't find a specific reference to it in PEP 8, general wisdom
considers it bad form unless you are at the interactive prompt
  http://docs.python.org/tut/node8.html#SECTION00841


-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?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: turbogears or django?

2006-12-19 Thread Ilias Lazaridis

Ο/Η Diez B. Roggisch έγραψε:
  Wow.  I had to doublecheck the From: header.
 
  Good posts.  Spot on in all the above quotes.  Glad to hear you've
  stopped the silly and unsolicited evaluation and have some good
  ***constructive*** criticisms to make.

 Illias is not a pure Troll or Nitwit, but his aggressive style (accusing
 TG of being a toy and so on... ) together with his usual the community
 doesn't do what I declare has to be done and thus is failing-stance
 make him an annoyance - to say the least.

It's not me who _declares_ what has to be done.

It's Naturality.

Naturally, Entry Barriers must be removed to achieve the goal increase
user base.

 If all it takes to make a good post is to remind people that more/better
 documentation is needed, I just set up a daily reminder post and become
 poster-of-the-week for the next year or so. Because that is true for
 nearly every project alive, FOSS or commercial. And even though his
 current demands are relatively concrete, they still are only demands,
 but he doesn't compile the information he wants in a wikipage himself
 (which is what wikis are for), but just complains about them missing.

Nothing special.

It's like any other enhancement request from any other user.

Otherwise, ticket systems would remain empty.

I've filed the issue:

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

and naturally, this _cannot_ lead to a comment like hey, troll, why
don't you provide the docu yourself?

 _Really_ helpful are posts that help others. I've not seen anything like
 this from him _ever_, regardless of which forum I've seen him.

That's just because you don't _want_ to see them.

Anyway, I understand that it's difficult to say : hey, possibly we
were wrong.

.

--
http://dev.lazaridis.com/base


--~--~-~--~~~---~--~~
 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] submit forms with different arguments

2006-12-19 Thread Javier Rojas
Hi,

I have a problem with an HTTP form. I need it to have multiple exit points
for the form, and to change the value of a couple of parameters
depending on the button that I press for submitting it. Any ideas?

Thanks

Javier


pgpzTwidpjjl4.pgp
Description: PGP signature


[TurboGears] Re: turbogears or django?

2006-12-19 Thread Adam Jones


Ilias Lazaridis wrote:
 Ο/Η Diez B. Roggisch έγραψε:
  If all it takes to make a good post is to remind people that more/better
  documentation is needed, I just set up a daily reminder post and become
  poster-of-the-week for the next year or so. Because that is true for
  nearly every project alive, FOSS or commercial. And even though his
  current demands are relatively concrete, they still are only demands,
  but he doesn't compile the information he wants in a wikipage himself
  (which is what wikis are for), but just complains about them missing.

 Nothing special.

 It's like any other enhancement request from any other user.

 Otherwise, ticket systems would remain empty.

 I've filed the issue:

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

 and naturally, this _cannot_ lead to a comment like hey, troll, why
 don't you provide the docu yourself?

Actually, considering one of your stated goals here is to evaluate
TurboGears, and you seem to have the same goal for at least Django, I
think you are in a relatively unique position to provide insight (and
thus, documentation) on the matter. Obviously I am not expecting you to
be able to provide a detailed description of the goals for the
TurboGears project, but describing it in relation to other frameworks
is much easier for someone who has evaluated many of them.

-Adam


--~--~-~--~~~---~--~~
 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: Splitting up controllers

2006-12-19 Thread Adam Jones


chiangf wrote:
 Thanks so much for all the responses.  It worked!

 But... really? This is how things work in Python?  Because it seems
 like quite a headache.

A lot of things seem like quite a headache before you understand them.
Only some of them stay a headache after you do. Python imports can be
kind of confusing, but only because they manage to accomplish a lot
under the surface. I really like the module system in Python (second
only to common lisp, IMO) but it does seem to be a ways off from what
Java does. If you have any questions about it, ask.

-Adam


--~--~-~--~~~---~--~~
 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: submit forms with different arguments

2006-12-19 Thread Diez B. Roggisch

On Tuesday 19 December 2006 16:56, Javier Rojas wrote:
 Hi,

 I have a problem with an HTTP form. I need it to have multiple exit points
 for the form, and to change the value of a couple of parameters
 depending on the button that I press for submitting it. Any ideas?

See the thread Multiple buttons on a single form.

http://www.mail-archive.com/turbogears%40googlegroups.com/msg21080.html
-- 
 Diez B. Roggisch
 Developer

T  +49 (30) 443 50 99 - 27
F  +49 (30) 443 50 99 - 99
M  +49 (179) 11 75 303
E  [EMAIL PROTECTED]


 artnology GmbH

A  Milastraße 4 / D-10437 Berlin
T  +49 (30) 443 50 99 - 0
F  +49 (30) 443 50 99 - 99
E  [EMAIL PROTECTED]
I  http://www.artnology.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?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: Do I get it?

2006-12-19 Thread Adam Jones

That looks pretty good. Note that you will be using the name of a
ForeignKey to access what it is linking to from an object, so to get
the name of a type of equipment you would be doing something like:

Equipment.get(id).type_id.name

I've found that dropping the _id from the column name makes this much
easier to type at the cost of not explicitly telling you that you are
accessing a foreign key. It's one of those minor things that always
manages to trip me up.

-Adam


--~--~-~--~~~---~--~~
 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 Sarge/easy_install troubles

2006-12-19 Thread Adam Jones

--egg is a command line option to the sqlobject-admin tool that is
used by tg-admin sql. Basically tg-admin sql * gathers some
project-specific information then calls the appropriate command from
the sqlobject-admin tool. What versions of these components are you
using? You can get a full list with tg-admin info.

-Adam


--~--~-~--~~~---~--~~
 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: TG and pylint

2006-12-19 Thread Steve Bergman

In my opinion, Guido's 80 character line limit hurts readability for no
good reason. (Even old, narrow, dot matrix printers can handle 96-132
characters/line.)

100 character lines are what I target.  I use more when the longer
lined form is more readable.

I get rid of pretty much anything that pylint considers unused.
(Except for **kw, when appropriate.)

And add doc strings where appropriate.

With the defaults, I usually start out at some embarrassing negative
score, and rarely end up at better than +4.  But I still thank myself
later for doing what I did.


--~--~-~--~~~---~--~~
 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 problem with the Wiki 20 tutorial

2006-12-19 Thread Karl Guertin

On 12/18/06, Andreas Kostyrka [EMAIL PROTECTED] wrote:
 I'm getting the following traceback using SQLite:
   File /home/andreas/tg/Wiki-20/wiki20/controllers.py, line 17, in edit
 page = model.Page.byPagename(pagename)
   File string, line 1, in lambda

This one is strange. I've never seen it come up.

 Using a postgres:// db uri, I'm getting the following error :(

   File 
 /usr/lib/python2.4/site-packages/SQLObject-0.7b1dev_r978-py2.4.egg/sqlobject/dbconnection.py,
  line 295, in _executeRetry
 return cursor.execute(query)
 TypeError: argument 1 must be str, not unicode


This is a unicode encoding error. I know this comes up for MySQL and
it may be the cause of the sqlite problems, but again I've never run
across it personally, so I don't know a fix offhand.

One thing that you didn't mention is the versions of the drivers and
databases. SQLite needs to be running off pysqlite 2.x on sqlite 3.x
and Postgres needs psycopg 2.x (I believe, I'm in a MySQL shop).

--~--~-~--~~~---~--~~
 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: cherrypy sessions howto

2006-12-19 Thread fumanchu

Jorge Godoy wrote:
 Where are you doing that?  At the interactive shell or inside a running
 project?  You won't get it from the shell...

The two are not necessarily exclusive ;)
http://projects.amor.org/misc/wiki/HTTPREPL


Robert Brewer
System Architect
Amor Ministries
[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?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: turbogears or django?

2006-12-19 Thread Ilias Lazaridis


Ο/Η Adam Jones έγραψε:
 Ilias Lazaridis wrote:
  Ο/Η Diez B. Roggisch έγραψε:
   If all it takes to make a good post is to remind people that more/better
   documentation is needed, I just set up a daily reminder post and become
   poster-of-the-week for the next year or so. Because that is true for
   nearly every project alive, FOSS or commercial. And even though his
   current demands are relatively concrete, they still are only demands,
   but he doesn't compile the information he wants in a wikipage himself
   (which is what wikis are for), but just complains about them missing.
 
  Nothing special.
 
  It's like any other enhancement request from any other user.
 
  Otherwise, ticket systems would remain empty.
 
  I've filed the issue:
 
  http://trac.turbogears.org/turbogears/ticket/1210
 
  and naturally, this _cannot_ lead to a comment like hey, troll, why
  don't you provide the docu yourself?

 Actually, considering one of your stated goals here is to evaluate
 TurboGears, and you seem to have the same goal for at least Django, I
 think you are in a relatively unique position to provide insight (and
 thus, documentation) on the matter. Obviously I am not expecting you to
 be able to provide a detailed description of the goals for the
 TurboGears project, but describing it in relation to other frameworks
 is much easier for someone who has evaluated many of them.

Your thoughts are basicly right.

But my evaluations have weaknesses:

 * They are for a specific context
 * They are not complete

http://case.lazaridis.com/wiki/Stack

a main problem I had is the missing schema evolution support, which
caused me to halt the evaluations:

http://case.lazaridis.com/wiki/Persist

Due to personal reasons (and due to the massive resistance which delayd
my work during this year), I will most possibly stop the work at the
end of the year.

However, I will place a license on the results, thus they can be reused
by any interested party.

.

--
http://case.lazaridis.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?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: Another problem with the Wiki 20 tutorial

2006-12-19 Thread Adam Jones

Postgres needs psycopg 2 if you are using unicode. It's in the docs,
although this bit needs to be reworked as
http://docs.turbogears.org/1.0/AlternativeDatabaseAccess is not where I
would expect to go for info on setting up postgres. Considering I did
the port from trac I guess I should get around to cleaning up the mess.

As for the other one, possible the dev release of SO 7.2b1? I am
assuming that 7.2b1dev_r# is an earlier version than 7.2b1. Andreas,
how did you get TG set up? I saw from an earlier thread that you were
using Debian Sarge, which components did you install through apt and
which ones did you get through easy_install, if you remember?

-Adam


--~--~-~--~~~---~--~~
 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: Strange IE problems with loadJSONDoc

2006-12-19 Thread Diez B. Roggisch

 This sounds like the best solution to me (and the most true to HTTP).
 Setting the 'Expires' header to zero should also work.  From RFC 2616:

 HTTP/1.1 clients and caches MUST treat other invalid date formats,
 especially including the value 0, as in the past (i.e., already
 expired).

Papier ist geduldig - paper is patient...

 That is what I do in my responses that I don't want IE to cache and it
 works well.

While my own experiences with IE are rather limited, I presume that e.g. dojo 
which also adds a cachePrevention parameter does so for a good reason. And 
the advantage is clearly that you can accidentally forget that header 
tinkering (which might get complicated in presence of apache  possibly squid 
in front of your cherrypy-instance), and it still works.

Diez

--~--~-~--~~~---~--~~
 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: cherrypy sessions howto

2006-12-19 Thread Javier Rojas
On Tue, Dec 19, 2006 at 10:54:12AM +0100, jose wrote:
 
 1 import cherrypy 
 2  
 3 @turbogears.expose(html=myproject.templates.counter) 
 4 def counter(self): 
 5 # Session variable initialization (or recall if exists) 
 6 cherrypy.session['count'] = cherrypy.session.get('count', 0)  
 7   
 8 # Variable assignment 
 9 cherrypy.session['count'] = cherrypy.session['count'] + 1 
 10  
 11#Return the value to your template 
 12return dict(counter=cherrypy.session['count']) 
 
 
 I'm trying to use sessions
 but 
did you enable sessions in the config file (dev.cfg)?

session_filter.on=True

 
 print cherrypy.session.get('count',0)
 
 *** AttributeError: 'thread._local' object has no attribute 'request'
 
 What am I doing wrong?
 
 jo
 
 
 --~--~-~--~~~---~--~~
  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
 -~--~~~~--~~--~--~---


pgpEXZ4ILObzS.pgp
Description: PGP signature


[TurboGears] Re: Upload Progress Bar?

2006-12-19 Thread Daniel Haus

Could you post the actual URL here when you're done?
This would be very kind, thank you.

Daniel


--~--~-~--~~~---~--~~
 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: TG and pylint

2006-12-19 Thread dundeemt

 With the defaults, I usually start out at some embarrassing negative
 score, and rarely end up at better than +4.  But I still thank myself
 later for doing what I did.

It varies, for new code I try to maintain a +10 unless there is a good
reason.(Haven't encountered a case where raising the score diminished
the code -- there are a few times where I felt there was a zero sum
gain though, but the tipping point was +0 for consistency)  For legacy
code that we are not refactoring it is much lower.

I do run it quite a bit as I'm finishing up refactoring and most of
the time fixing the warnings results in easier to read and maintain
code.  I work in a very busy shop so time is a premium -- but cleaning
now means easier maintenance later.  Especially when there is more
than 1 programmer -- agreeing on a standard then letting pylint
enforce it relieves a lot of ego pressure and makes code reviews
faster.  You can stick to the app logic and implementation and not get
sidetracked with punctuation and grammar.


--~--~-~--~~~---~--~~
 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: genshi XHTML output

2006-12-19 Thread Karl Guertin

On 12/19/06, Jorge Godoy [EMAIL PROTECTED] wrote:
 Isn't there a switch as the one for Kid where you decide the output type you
 want?  TG comes with a HTML default.

turbogears.view.base does a config.get('%s.outputformat' % enginename,
'html'), so you should get XHTML if you have genshi.outputformat set
to xhtml. Genshi takes other configuration parameters, but TurboGears
has no way to pass those through. I was looking at writing a patch,
but I didn't see a way to get all the config variables starting with
'genshi' from ConfigObj.

--~--~-~--~~~---~--~~
 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: Strange IE problems with loadJSONDoc

2006-12-19 Thread Christian

Diez B. Roggisch wrote:
 While my own experiences with IE are rather limited, I presume that e.g. dojo
 which also adds a cachePrevention parameter does so for a good reason.

My guess is that is just for developers who can't set the proper
response headers (maybe when pulling data from servers they don't have
control over?).

 And the advantage is clearly that you can accidentally forget that header
 tinkering (which might get complicated in presence of apache  possibly squid
 in front of your cherrypy-instance), and it still works.

I suppose there could potentially be issues with other proxies between
TG--User Agent.

Forgetting about adding the response header entries seems about as
likely as forgetting to add the tg_random parameter to the request.  We
can easily do something about the response forgetfulness:

class ExpireJSONFilter(object):
rh = cherrypy.response.headers
ct = rh.get('Content-type', None)
# not sure what exact content-type TG sets for JSON
# don't stomp on an already-set 'Expires' header
if ct == 'application/json' and 'Expires' not in rh:
rh['Expires'] = '0'

All that is left to do is plugging the filter in the appropriate place
in the application's object tree.

Christian
http://www.dowski.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?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: Strange IE problems with loadJSONDoc

2006-12-19 Thread Christian


Christian wrote:
 class ExpireJSONFilter(object):
 rh = cherrypy.response.headers
 ct = rh.get('Content-type', None)
 # not sure what exact content-type TG sets for JSON
 # don't stomp on an already-set 'Expires' header
 if ct == 'application/json' and 'Expires' not in rh:
 rh['Expires'] = '0'

Bah. ...

class ExpireJSONFilter(object):
def before_finalize(self):
rh = cherrypy.response.headers
ct = rh.get('Content-type', None)
# not sure what exact content-type TG sets for JSON
# don't stomp on an already-set 'Expires' header
if ct == 'application/json' and 'Expires' not in rh:
rh['Expires'] = '0'


--~--~-~--~~~---~--~~
 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: Splitting up controllers

2006-12-19 Thread Christopher Arndt

Adam Jones schrieb:
 chiangf wrote:
 But... really? This is how things work in Python?  Because it seems
 like quite a headache.
 
 A lot of things seem like quite a headache before you understand them.
 Only some of them stay a headache after you do. Python imports can be
 kind of confusing, but only because they manage to accomplish a lot
 under the surface. I really like the module system in Python (second
 only to common lisp, IMO) but it does seem to be a ways off from what
 Java does. If you have any questions about it, ask.

Well, I'm itching to be able to use relative/absolute imports from Python 2.5
with TurboGears, since they will make structuring packages with unambiguous
imports a lot easier.

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: Upload Progress Bar?

2006-12-19 Thread Ian Charnas

Yes.  I'm trying to post it right now on docs.turbogears.org - but the
site seems to be undergoing maintenance...

-ian

On Dec 19, 12:16 pm, Daniel Haus [EMAIL PROTECTED] wrote:
 Could you post the actual URL here when you're done?
 This would be very kind, thank you.
 
 Daniel


--~--~-~--~~~---~--~~
 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 or django?

2006-12-19 Thread Ilias Lazaridis

Diez B. Roggisch wrote:
  It's like any other enhancement request from any other user.
 
  Otherwise, ticket systems would remain empty.
 
  I've filed the issue:
 
  http://trac.turbogears.org/turbogears/ticket/1210
 
  and naturally, this _cannot_ lead to a comment like hey, troll, why
  don't you provide the docu yourself?

 You mean that ticket you opened two hours ago is a good point in a discussion
...

seems I was wrong.

.

--
http://dev.lazaridis.com/base


--~--~-~--~~~---~--~~
 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: Strange IE problems with loadJSONDoc

2006-12-19 Thread Diez B. Roggisch

On Tuesday 19 December 2006 18:28, Christian wrote:
 Diez B. Roggisch wrote:
  While my own experiences with IE are rather limited, I presume that e.g.
  dojo which also adds a cachePrevention parameter does so for a good
  reason.

 My guess is that is just for developers who can't set the proper
 response headers (maybe when pulling data from servers they don't have
 control over?).

Might be, but I've seen far too much trouble concerning caching (especially if 
you want it to actually happen for certain content) than not to be thankful 
about a solution that just works.

  And the advantage is clearly that you can accidentally forget that header
  tinkering (which might get complicated in presence of apache  possibly
  squid in front of your cherrypy-instance), and it still works.

 I suppose there could potentially be issues with other proxies between
 TG--User Agent.

 Forgetting about adding the response header entries seems about as
 likely as forgetting to add the tg_random parameter to the request.  We
 can easily do something about the response forgetfulness:

If you read my other post about this, you might notice that I patched MochiKit 
to do this (configurable) everytime. I'm going to polish that patch a bit 
(adding a sequence number to avoid clock-precision issues), maybe it gets 
accepted.

Diez

--~--~-~--~~~---~--~~
 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] performing form/schema evaluation against self-assembled data

2006-12-19 Thread Diez B. Roggisch

Hi,

using Forms/Schemas against http-requests to obtain a dictionary of valid and 
correctly typed values is nice and easy. However, I'm currently interested in 
a way to take a form or schema and pass it a self-assembled request (either 
in pure HTTP form, or possibly already as formencode-prepared dictionary) to 
obtain said coerced values.

The reason is that I'm interested in storing request parameters in a generic 
way (name-value, all strings), for later form repopulation. 

any hints?

-- 
 Diez B. Roggisch
 Developer

T  +49 (30) 443 50 99 - 27
F  +49 (30) 443 50 99 - 99
M  +49 (179) 11 75 303
E  [EMAIL PROTECTED]


 artnology GmbH

A  Milastraße 4 / D-10437 Berlin
T  +49 (30) 443 50 99 - 0
F  +49 (30) 443 50 99 - 99
E  [EMAIL PROTECTED]
I  http://www.artnology.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?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: Upload Progress Bar?

2006-12-19 Thread Adam Jones


Ian Charnas wrote:
  Any news on that?

 Daniel, yes it's done, I forgot to post it.  I have it in html on my
 computer now, and I'm trying to get it up on docs.turbogears.org and I
 see I finally have to learn moin moin, something I've been avoiding for
 no particular reason.  I lost my patience with it for tonight, so I'll
 try again tomorrow.   The howto just describes how to get kepty.com's
 UploadFilter working with TG.

When you get a chance to post this on the docs site please do so in
reStructuredText. We are trying to use that in preparation for a move
to a better documentation management solution. If you already know rst
this should be a relief, if not you can get more info here:
http://docutils.sourceforge.net/rst.html

If it all comes out to too much work or muddling through various markup
syntaxes just post or send me what you have and I will try to find time
to get it on the docs.

-Adam


--~--~-~--~~~---~--~~
 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: TG and pylint

2006-12-19 Thread Christopher Arndt

Steve Bergman schrieb:
 In my opinion, Guido's 80 character line limit hurts readability for no
 good reason. (Even old, narrow, dot matrix printers can handle 96-132
 characters/line.)
 
 100 character lines are what I target.  I use more when the longer
 lined form is more readable.

With a normal screensize (i.e. 1280x1024) and using an IDE it is very difficult
to have an editing window even 80 chars wide in an acceptable font size.

I hate it when I have to scroll horizontally, so I alway break lines, if they
are too long. Luckily in Python there are many ways to do this:

1) Reconition of open parenthesis

2) Backslash at line end

3) Concatenation of string literals in conjunction with 1) or 2)

Jeff Hinrichs wrote:
 One final group question, does anyone else have issues with
   from sqlobject import *
 I didn't find a specific reference to it in PEP 8, general wisdom
 considers it bad form unless you are at the interactive prompt

I see this mainly as a readability issue. If the module has a proper
declaration of it's namespace (__all__), then there should be no suprises about
what you import (and AFAICS all TG modules have __all__).

But both forms have implications on how easy it is to read the code. If you do

from foo.bar.boo import *

and you're using names from the foo package further down in you code, the
reader cannot see, where this name was defined.

If you're using

import foo.bar.boo

...

spamm = foo.bar.boo.blub('eggs')

you will end up with many long lines, that you will have to break  etc.

(the latter form might also incur a slight speed penalty because of all the
necessary namespace lookups)

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: TG and pylint

2006-12-19 Thread Martin Geisler
Steve Bergman [EMAIL PROTECTED] writes:

 In my opinion, Guido's 80 character line limit hurts readability for no
 good reason. (Even old, narrow, dot matrix printers can handle 96-132
 characters/line.)

It is not about what it can handle (IMHO), but about avoiding wrapped
lines. I can make my Emacs 314 characters wide on my current screen,
but that doesn't make it a good idea :-)

With 80 characters per line, then you're pretty sure that everybody
will see the lines unwrapped. I always hate it when my editor (Emacs)
wrap the line in a more or less arbitrarily place, I much prefer the
programmer to insert logical break-points.

Long lines might also try to do too much stuff and code readability is
often improved by splitting them up into two or three lines using a
temporary variable.

-- 
Martin Geisler  ---  [EMAIL PROTECTED]  ---  http://mgeisler.net

Read, write, create Exif data in PHP with PEL:   http://pel.sf.net
Take control of your webserver with PHP Shell:  http://phpshell.sf.net


pgp8Egy4iwAiW.pgp
Description: PGP signature


[TurboGears] Re: Strange IE problems with loadJSONDoc

2006-12-19 Thread Christian


Diez B. Roggisch wrote:
 If you read my other post about this, you might notice that I patched MochiKit
 to do this (configurable) everytime. I'm going to polish that patch a bit
 (adding a sequence number to avoid clock-precision issues), maybe it gets
 accepted.

Ah, quite nice.  At the very least, it is nice to have a couple ways to
tackle this issue if one finds short comings with one method or the
other.

Christian


--~--~-~--~~~---~--~~
 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: TG and pylint

2006-12-19 Thread Karl Guertin

On 12/19/06, Christopher Arndt [EMAIL PROTECTED] wrote:
 With a normal screensize (i.e. 1280x1024) and using an IDE it is very 
 difficult
 to have an editing window even 80 chars wide in an acceptable font size.

1280x1024 seems small for a work screen unless you're on a laptop.
Maybe it's just my environment, but the developers here get a 24
1920x1200  or a pair of 20 1600x1200.

I tend to break lines at 100 characters.

--~--~-~--~~~---~--~~
 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: TG and pylint

2006-12-19 Thread Christopher Arndt

Karl Guertin schrieb:
 On 12/19/06, Christopher Arndt [EMAIL PROTECTED] wrote:
 With a normal screensize (i.e. 1280x1024) and using an IDE it is very 
 difficult
 to have an editing window even 80 chars wide in an acceptable font size.
 
 1280x1024 seems small for a work screen unless you're on a laptop.
 Maybe it's just my environment, but the developers here get a 24
 1920x1200  or a pair of 20 1600x1200.

Well, not everybody can afford that. And I work on my laptop very often,
because I don't like being fixed at my desk for hours.

Also, for web development it is good to see how your app will look like on a
screen size that most average users have. It is too easy to forget that not
everybody has such a big screen otherwise ;-)

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: TG and pylint

2006-12-19 Thread Adam Jones


Karl Guertin wrote:
 On 12/19/06, Christopher Arndt [EMAIL PROTECTED] wrote:
  With a normal screensize (i.e. 1280x1024) and using an IDE it is very 
  difficult
  to have an editing window even 80 chars wide in an acceptable font size.

 1280x1024 seems small for a work screen unless you're on a laptop.
 Maybe it's just my environment, but the developers here get a 24
 1920x1200  or a pair of 20 1600x1200.

I've upgraded laptops and jumped from 800x600 to 1024x768. Gained some
speed and ram too. This is also my development box most days, but I use
emacs anyways and have well over 80 chars per line usually.

-Adam


--~--~-~--~~~---~--~~
 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: Controller organization

2006-12-19 Thread [EMAIL PROTECTED]

Hi,

Hum, even before I know the tgbig template I break the controllers.py
module on a package controllers/ with many methods inside it :D, I like
this approach.

Another thing I like is to break the model.py in a package too, I have
a big project with many sqlobject classes and I think is more readable
to me. But when I break model.py apart I can't use the tg-admin sql
create tool. I have the same problem with sqlobject-admin tool. Does
anyone use this approach and know how to find the classes when you have
a structure like the above:

model/
   __init__.py
   office.py
   user.py
   anotherclasses.py

Each of the modules have many classes and the __init__ method loads all
the classes.
Thanks for help, 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?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: TG and pylint

2006-12-19 Thread Christoph Zwerschke

Christopher Arndt wrote:
 100 character lines are what I target.  I use more when the longer
 lined form is more readable.
 
 With a normal screensize (i.e. 1280x1024) and using an IDE it is very 
 difficult
 to have an editing window even 80 chars wide in an acceptable font size.
 
 I hate it when I have to scroll horizontally, so I alway break lines, if they
 are too long. Luckily in Python there are many ways to do this:

Exactly. With overlong lines you will also get into troubles when you 
arrange two or more windows vertically (e.g. for comparing different 
versions). Or when you want to paste code to a mailing list like this 
one and the overlong lines are wrapped, or view them on a console or via 
an ssh client which usually have the default of 80 chars. Plus, I'm 
getting older and a bigger font size is starting to get convenient ;-)

So I think the 80 chars recommendation is still appropriate...

-- Christoph

--~--~-~--~~~---~--~~
 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: ?Importing a function into a Kid template?

2006-12-19 Thread Nicky Ayoub
Thanks Jeff,

I made a quick widget out of it. I'm sure its not up to snuff... but it
works for me.

I added the widget to the global space and reference it in my master.kid.
The
thread that mentions register_widgets provided the method for doing this.
Now all my pages have the breadcrumb widget automatically.
Very cool. Thanks again,

Nicky

On 12/19/06, Jeff Hinrichs - DMT [EMAIL PROTECTED] wrote:


 On 12/19/06, Jeff Hinrichs - DMT [EMAIL PROTECTED] wrote:
   I've taken your input and modified the code. In fact, I built a
   breadcrumbs.py module that is generic enough to work out of the box
   along with the kid template snippet.  I'd be happy to post it and if
   it would add anything I could post it to the wiki.  I am just
   finishing up with the epydoc strings for the module.
  
 Well I didn't get any feedback about posting it to the wiki or such
 but I felt it might help some else out so I set it up on google.

 http://code.google.com/p/tg-breadcrumbs/


 enjoy and thanks

 -j

 



-- 
--
Nicky Ayoub
G-Mail Account


--~--~-~--~~~---~--~~
 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
-~--~~~~--~~--~--~---
#__
# Bread Crumbsfrom turbogears.widgets.forms import  Widget
from turbogears import controllers
from turbogears.view import variable_providers
from cherrypy._cputil import get_object_trail

class Breadcrumb(Widget):
template = 
div xmlns:py=http://purl.org/kid/ns#; 
span py:for=href_link,href_text in tg.breadcrumbs() / a href=${href_link}${href_text}/a/span
/div
 
def __init__(self, **kw):
super(Breadcrumb, self).__init__(**kw)
variable_providers.append(add_breadcrumbs)
  
def create_breadcrumbs():
Return link information for constructing bread crumb navigation.
cherry_trail = get_object_trail()
href = '/'
crumbs = [(href, 'home')] 
for item in cherry_trail:
# item[0] is the name you use in the URL to access the controller.
# item[1] is the actual controller
if isinstance(item[1],
(controllers.Controller, controllers.RootController)):
if item[0] != 'root':
href = %s%s/ % (href, item[0])
crumbs.append([href, item[0]])
return crumbs

def add_breadcrumbs(variables):
variables[breadcrumbs] = create_breadcrumbs

breadcrumbs = Breadcrumb()



[TurboGears] Re: help with catwalk problems

2006-12-19 Thread Ian Charnas

Luby, hello!  It might be that your model is too complex for catwalk to
understand.  Try again with a new project that has a very simple model
(no joins or foreign keys) and see if that fixes it.  The turbogears
developers think that FastDataController is likely to replace Catwalk
soon, which can handle more than Catwalk.

-ian

On Dec 17, 1:10 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 Hi, catwalk never works for me.   Clicking on a text input field
 neither confirms focus with a cursor nor allows editing.  I cannot add
 or delete tuples.  In these cases, the GUI is not responsive and it
 does not generate errors.I use TurboGears-1.0b2 on a FC4 machine.
 Any help is most highly appreciated.  cheers, Luby Liao


--~--~-~--~~~---~--~~
 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: submit forms with different arguments

2006-12-19 Thread Javier Rojas
On Tue, Dec 19, 2006 at 05:17:03PM +0100, Diez B. Roggisch wrote:
 See the thread Multiple buttons on a single form.
 
 http://www.mail-archive.com/turbogears%40googlegroups.com/msg21080.html
That did the trick! thanks


pgpZJnxxPr4IX.pgp
Description: PGP signature


[TurboGears] tg-admin in a production system

2006-12-19 Thread [EMAIL PROTECTED]


Okay, I must be missing something totally obvious here but...how do i
use tg-admin in a system that is deployed in production?

I have my project installed as an egg, with my prod.cfg and sqlite db
in a folder.  The project runs fine but i want to be able to hop in and
make some quick db updates (without having to resort to sql), also i
would like to run an 'sql create' to generate the db, currently i just
copy over a freshly created db from my dev environment.

Any incarnation of the tg-admin command i can think of returns This
command needs to be run from inside a project directory, and looking
through turbogears.command.base i see a --config option for SQL, but
that doesn't seem to work either.

Oh, and I am running 1.0b2

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

2006-12-19 Thread TG-Martin Peschke


Hi Alberto,

the update worked fine (now to TW rev:2235 and the TG App doesnt break
in the sense that it executes without complaining, but the following
source gives you an idea of what I ve been wondering in the first
place:

{{{
body
   lt;form id=form action=save method=POST
class=adduserformgt;
   lt;input type=hidden name=id class=hiddenfield id=form_id
value=I'm hidden!gt;

   lt;ul class=field_listgt;
   lt;li class=evengt;
   lt;label id=form_name.label for=form_name
class=fieldlabel requiredgt;Namelt;/labelgt;
   lt;input type=text name=name class=textfield
required id=form_name value=Your name heregt;
   lt;/ligt;lt;li class=oddgt;

   lt;label id=form_age.label for=form_age
class=fieldlabelgt;Agelt;/labelgt;
   lt;select name=age class=singleselectfield
id=form_agegt;
   lt;option value=0gt;0lt;/optiongt;lt;option
value=1gt;1lt;/optiongt;lt;option
value=2gt;2lt;/optiongt;lt;option
value=3gt;3lt;/optiongt;lt;option
value=4gt;4lt;/optiongt;lt;option value=5gt;5lt;/
lt;/selectgt;
}}}

Its escaped again and much more so this time, it is escaped so heavily
that you have the lt; even in the view.

The tests results in 22 errors and 3 failures, refer to

http://trac.exilante.de:9000/trac/attachment/wiki/GenshiQuickStartLog/error.log

for the output.
I really wonder how this can happen, am I missing some installation
step?


--~--~-~--~~~---~--~~
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: Strange IE problems with loadJSONDoc

2006-12-19 Thread Bob Ippolito


On 12/20/06, Diez B. Roggisch [EMAIL PROTECTED] wrote:


On Tuesday 19 December 2006 18:28, Christian wrote:
 Diez B. Roggisch wrote:
  While my own experiences with IE are rather limited, I presume that e.g.
  dojo which also adds a cachePrevention parameter does so for a good
  reason.

 My guess is that is just for developers who can't set the proper
 response headers (maybe when pulling data from servers they don't have
 control over?).

Might be, but I've seen far too much trouble concerning caching (especially if
you want it to actually happen for certain content) than not to be thankful
about a solution that just works.

  And the advantage is clearly that you can accidentally forget that header
  tinkering (which might get complicated in presence of apache  possibly
  squid in front of your cherrypy-instance), and it still works.

 I suppose there could potentially be issues with other proxies between
 TG--User Agent.

 Forgetting about adding the response header entries seems about as
 likely as forgetting to add the tg_random parameter to the request.  We
 can easily do something about the response forgetfulness:

If you read my other post about this, you might notice that I patched MochiKit
to do this (configurable) everytime. I'm going to polish that patch a bit
(adding a sequence number to avoid clock-precision issues), maybe it gets
accepted.


I'm not going to accept any patch that changes behavior of the whole
library by setting some variable. It'd have to be a parameter to a
function.

-bob

--~--~-~--~~~---~--~~
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: ?Importing a function into a Kid template?

2006-12-19 Thread Jeff Hinrichs - DMT



I made a quick widget out of it. I'm sure its not up to snuff... but it
works for me.

I added the widget to the global space and reference it in my master.kid.
The
thread that mentions register_widgets provided the method for doing this.
Now all my pages have the breadcrumb widget automatically.

I am glad the code was helpful for you.  I haven't gotten around to
figuring out how to make a proper widget out of it or even packaging
it as an egg.   I most likely will, but for now, it serves it's
purpose. Hopefully the code is clean enough and documented enough that
others will find it useful too.

-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?hl=en
-~--~~~~--~~--~--~---



[TurboGears] Re: TG and pylint

2006-12-19 Thread John M Camara



Christopher Arndt wrote:

But both forms have implications on how easy it is to read the code. If you do

from foo.bar.boo import *

and you're using names from the foo package further down in you code, the
reader cannot see, where this name was defined.

If you're using

import foo.bar.boo

...

spamm = foo.bar.boo.blub('eggs')

you will end up with many long lines, that you will have to break  etc.

(the latter form might also incur a slight speed penalty because of all the
necessary namespace lookups)

Chris


I would code it as

import foo.bar.boo as boo
spamm = boo.blub('eggs')


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