[TurboGears] Re: Class-style form declaration [NEW IDEA]
Jeff Watkins wrote: On 20 Jan, 2006, at 10:12 pm, Kevin Dangoor wrote: That's one of the cool things about making WidgetsDeclaration a list subclass: TableForm(widgets=[TextField(someotherfield)] + ContactFields()) That would just work, because lists already support +. Excellent. I hadn't thought of that. Me too, that's cool. :-) Implementation-wise, I was thinking that WidgetsDeclaration would actually subclass list and each widget would get added to the list. widgets=ContactFields() would work exactly the same as widgets=[TextField(name), TextField(age)]. I think that it's actually cleaner and more explicit to have the ()s there. Agreed on everything. Ciao Michele
[TurboGears] Re: note to those following svn: nose now required
Bob Ippolito wrote: Running tg-admin sql create doesn't do anything unless there's something in your model. Adding a tg-admin sql create button and/or checkbox next to Write model would be a nice addition to ModelDesigner though. You are right indeed, we can't imagine (yet :D) what DB structure the user will need. There's no need to ask the question -- it should just put a SQLite DB URI in there (if pysqlite is installed). It won't create the DB until it needs to, and creating a SQLite DB is better than an error. If you have a need to manually specify a DB URI, you'd simply just comment out or change that line. Yes, that would be really useful and not in the way if you don't need it. Ciao Michele
[TurboGears] Re: Class-style form declaration
Kevin Dangoor wrote: On 1/19/06, Michele Cella [EMAIL PROTECTED] wrote: Is there a way to make the widget instance a callable that defaults to the insert() method? Example: instead of: form.insert(action...) it would be nice to use (at least for me): form(action...) since the insert() method is the most used inside a template this could be convenient. We could do this. I can't think of any drawbacks offhand. Great. what about making widgets a dictionary? for the Form: widgets['fields'] = [] widgets['submit'] = [SubmitButton] this should make it clear to thirdparty widgets writers where they should put child widgets, and it feels more natural to me since child widgets are clearly categorized. The submit button is the only one that is special, and the only thing that's special about it is that it's value is pulled out of the input if it shows up there. (I guess it's also special because it's automatically created for you). That's not the case anymore: http://trac.turbogears.org/turbogears/changeset/528 I also think that as errors should be displayed by the container form (#125), this also applies to a widget label, this means we should remove the label attribute from a simple Widget (like a TextField) and rename labeltext to label. TextField(name=age, label=Enter your age:) now the form will simply use it's label widget (in my vision widgets['label'] = Label()) to insert the proper label. That's where there's the widgets list and the submit button and that's it. I can't think of a reason, offhand, why we'd need other categories of widgets to appear. as said above: Label for a Form. :-) And maybe others would need them. It's also easier if you need to dig into a widget you know you can refer to the widgets attribute for customizing it's behavior. I do agree that having a standard interface for this is good. Yes, and in particular this is essential if we want (and we want it) a CompoundWidget, if we don't know where attributes containing widgets would pop-up we can't provide a ready-to implementation of retrieve_css and retrieve_javascript and every widget writer will need to override it if they are putting other widgets outside of the widgets attribute. If we know and suggest that you put all your widgets there, the retrieve_js and retrieve_css method just need to iterate over the widgets dict and over every key to to do the same thing without further modifications. To me it just seems as good practise (from an OOP POV) grouping together those related component (Widgets). Moreover given that widgets are state-less and you wouldn't need to access them too frequently moving them here will not hurt anyone I think, and will establish a good conventions for the future. I finally think for a form we should use: Form(fields=...) and not: Form(widgets=...) Maybe if we abstract the declarative mechanism to a CompoundWidget we can provide facilities like this for every CompoundWidget: class Test(TestCompoundWidget): class foo: - widgets['foo'] = ... ... class bar: - widgets['bar'] = ... ... Ok, enough crack for the moment, excuse me. :-) wouldn't that be: class Test(...): class fields: foo = ... ??? Mmm, sorry I was already using my own widgets convention, so foo and bar are categories. But anyway that's not a problem anymore. Ciao Michele
[TurboGears] Re: Class-style form declaration [NEW IDEA]
[Last email I promise] Finally should we go with this style: class ContactFields(WidgetsDeclaration): age = TextField() name = TextField() or as from Jeff suggestion: class ContactFields(WidgetsDeclaration): TextField(name=age) TextField(name=name) plus for the latter is that it removes all the magic (regarding the name parameter), and I agree with Jeff that it feels right. But how does it feel from a python point? It's legal code inside a class? :-) Ciao Michele Michele Cella wrote: Jeff Watkins wrote: On 20 Jan, 2006, at 10:12 pm, Kevin Dangoor wrote: That's one of the cool things about making WidgetsDeclaration a list subclass: TableForm(widgets=[TextField(someotherfield)] + ContactFields()) That would just work, because lists already support +. Excellent. I hadn't thought of that. ...
[TurboGears] Re: Proposal: Visitor Tracking
thanks ^_^ It works fine...
[TurboGears] Re: No peak.security for 0.9
Can I just sneak some generic functions into Identity than? ;) What I would like is to have more flexibility when it comes to authentication failure. Therefore I propose adding function fail() defined as: @generic() def fail(func, errors=None): pass @fail.when(strategy.default) def _default_redirect(func, errors): raise cherrypy.InternalRedirect( current_provider.url_for_identity_failure()) Predominantly it would get called from require(), but of curse it could be triggered manually as well. Motivation: 1) Contextual redirection 2) Additional logging For example one may want to log every failed attempt to log-in as an administrator. 3) Additional error handling For example properly ending a transaction, saving input of a multi-page form, etc. This enchantment is fully backwards compatible and imposes no overhead to those who do not wish to use it. Cheers, Simon Kevin Dangoor wrote: I've been thinking about combining Identity + peak.security (or, more specifically, RuleDispatch) for the past couple of weeks. (Not constantly, mind you... just when I've had the chance.) Computer science is all about tradeoffs. Occasionally, you'll have something that is distinctly a win with no drawbacks. More often than not, though, you need to balance things out between flexibility, complexity and performance. But you knew that, already. In this particular case, I think that the Identity user API is really easy to use and will meet a good variety of needs (but certainly not all). peak.security is the kind of thing that can meet everyone's needs, but wouldn't be as easy for some of the common cases that Identity is good at. Here's my thinking: 1) Leave the Identity user API as is for 0.9.0 2) Don't try to work the notion of a subject into the existing API. The idea with a subject is: does this user have edit permission *for this item*. It's very app specific, and RuleDispatch would be a big win here. 3) Integrate peak.security/RuleDispatch into some later release 4) Ensure that there are enough plugpoints that people can take advantage of as much Identity code as possible. Other people here have used Identity far more than I have. How has it been as far as the API for you? (Particularly since Jeff created his predicate system.) Kevin -- Kevin Dangoor Author of the Zesty News RSS newsreader email: [EMAIL PROTECTED] company: http://www.BlazingThings.com blog: http://www.BlueSkyOnMars.com -- Simon Belak vodja projektnih skupin e: [EMAIL PROTECTED] - Hruska d.o.o., agencija za nove medije Ilirska 21, SI-1000 Ljubljana t: +386 1 430 25 86 f: +386 1 430 25 87 s: http://www.hruska.si s: http://akademija.hruska.si (izobrazevalni portal) s: http://www.elor.si (kadrovski sistem letnih razgovorov) Hruska.si - socne resitve To elektronsko sporocilo in vse morebitne priloge so poslovna skrivnost in namenjene izkljucno naslovniku. Ce ste sporocilo prejeli pomotoma, Vas prosimo, da obvestite posiljatelja, sporocilo pa takoj unicite. Kakrsnokoli razkritje, distribucija ali kopiranje vsebine sporocila je strogo prepovedano. This e-mail and any attachments may contain confidential and/or privileged information and is intended solely for the addressee. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail, or any action taken or omitted to be taken in reliance on it, is strictly prohibited.
[TurboGears] develix.com -- This page is parked free, courtesy of GoDaddy.com
Now there's some motivation for going after one of those Bug Bounty bugs. Yikes! Steve
[TurboGears] Re: Ticket #308
Thanks! Hmm, I didn't know this value_of() function. Is it the same as locals().get() ? -- JP
[TurboGears] Re: Ticket #308
On 1/21/06, JP Farias [EMAIL PROTECTED] wrote: Thanks!Hmm, I didn't know this value_of() function. Is it the same aslocals().get() ? It is implemented as a hasattr(self, name, default=None). When values are passed in to the template, via the dictionary returned from a controller, they become Template instance variables. I would not advise using the locals() in a template it get values. Things that are going on in Kid right now may (or may not) break that. -- David
[TurboGears] Re: No peak.security for 0.9
On 21 Jan, 2006, at 6:03 am, Simon Belak wrote:Can I just sneak some generic functions into Identity than? ;)I have no problem with adding generic functions to Identity if generic functions solve a problem that can't be solved any other way.What I would like is to have more flexibility when it comes to authentication failure. Therefore I propose adding function fail() defined as:@generic()def fail(func, errors=None): pass@fail.when(strategy.default)def _default_redirect(func, errors): raise cherrypy.InternalRedirect( current_provider.url_for_identity_failure())Predominantly it would get called from require(), but of curse it could be triggered manually as well.There's no need to call this from the require decorator. It doesn't need any more flexibility than it already has. I don't find myself saying: "Gosh, I wish I could do XYZ in the require decorator, but I have no idea how without a generic failure function."Motivation:1) Contextual redirectionTry raising turbogears.redirect instead. That's what it's for, I think. Or if you need to redirect based on a specific set of errors, you should try specifying a callable for your identity-failure-url (soon to be committed).2) Additional loggingFor example one may want to log every failed attempt to log-in as an administrator.I've been remiss about not adding enough logging to the Identity and Visit Tracking code. No admittedly, the standard logging might not be what everyone is looking for; I can envision Identity expanding to provide hooks for detailed authorisation logging.3) Additional error handlingFor example properly ending a transaction, saving input of a multi-page form, etc.This is a general issue which shouldn't be solved in the Identity or Visit Tracking framework. Why would you have an authorisation failure in the MIDDLE of a multi-page form? This sounds more like a programmer-didn't-think-things-through-completely problem than anything with Identity.This enchantment is fully backwards compatible and imposes no overhead to those who do not wish to use it.So far no one has "stood up" and said: "I need to be able to X and I just can't without generic functions." And my experience managing software projects leads me to shy away from features that don't solve a problem. --Jeff Watkinshttp://newburyportion.com/Democracy n: A country where the newspapers are pro-American.
[TurboGears] Re: No peak.security for 0.9
2006/1/21, Kevin Dangoor [EMAIL PROTECTED]: Other people here have used Identity far more than I have. How has it been as far as the API for you? (Particularly since Jeff created his predicate system.) Works great for me. The only thing that I found a little confusing was that std.identity in a template is an alias to identity.current... -- Ksenia
[TurboGears] Re: No peak.security for 0.9
Jeff Watkins wrote: On 21 Jan, 2006, at 6:03 am, Simon Belak wrote: Can I just sneak some generic functions into Identity than? ;) I have no problem with adding generic functions to Identity if generic functions solve a problem that can't be solved any other way. Any other way? Isn't this a bit drastic? The way I see it these 5 lines of code allow for multiple features which you say you are going to implement along with a whole class of other possibilities. There's no need to call this from the require decorator. It doesn't need any more flexibility than it already has. I don't find myself saying: Gosh, I wish I could do XYZ in the require decorator, but I have no idea how without a generic failure function. Well I do. I like to separate functionalities. Handling security within the controller deludes and is more error-prone. Not to mention, it is not optimal approach when spreading development among a team. Again, it's not about the generic functions (my remark was, obviously poor, attempt at a joke), if you have a better (in terms of flexibility versus bloatware) solution, I will gladly use that. 1) Contextual redirection Try raising turbogears.redirect instead. That's what it's for, I think. Or if you need to redirect based on a specific set of errors, you should try specifying a callable for your identity-failure-url (soon to be committed). If I understand correctly, this requires checking for permissions manually from within the controller (or some such)? 3) Additional error handling For example properly ending a transaction, saving input of a multi-page form, etc. This is a general issue which shouldn't be solved in the Identity or Visit Tracking framework. Why would you have an authorisation failure in the MIDDLE of a multi-page form? This sounds more like a programmer-didn't-think-things-through-completely problem than anything with Identity. Perhaps it is just a design mistake, but take trac for instance. On every page you have a login link. Yes it's dumb to try to login in the middle of something, especially if one forgot one's password, but such things do happen, especially in intranet applications. Sure, the programmer could hide all inappropriate buttons etc., but than again wouldn't it be even more prudent to select a tool where he didn't have to? So far no one has stood up and said: I need to be able to X and I just can't without generic functions. And my experience managing software projects leads me to shy away from features that don't solve a problem. I am a bit confused. Didn't you just said that you will (or have) implement 2 out of 3 of my feature requests? I am most certainly flatter if it is just for me. ;) Simon
[TurboGears] Re: develix.com -- This page is parked free, courtesy of GoDaddy.com
On Sat, 2006-01-21 at 04:30 -0800, ssteiner wrote: Now there's some motivation for going after one of those Bug Bounty bugs. Domain expired! Sheesh. Thanks. I didn't see it because I use my own DNS server so it all looked good here :P I would like to point out that the only goddaddy.com service being used is domain registration. /me wonders where the godaddy notification email went... Cliff
[TurboGears] Re: No peak.security for 0.9
Hi. Dunno if this is this post related, but what's the best way to implement the 'subject' strategy that you pointed out? I have a situation where i have a permission 'can_admin' which allows to edit a part of the site, but I want another limitation on it, like 'can_admin and user == page.owner' Can it be done with current identity? Eli
[TurboGears] Re: note to those following svn: nose now required
Hmm. This morning, following an update to TG release 584, nosetests no longer works. Running it gets: [EMAIL PROTECTED] turbogears]$ nosetests E == ERROR: test module turbogears in /home/mike/Work/projects/turbogears/turbogears -- Traceback (most recent call last): File /usr/local/lib/python2.4/site-packages/nose-0.8.4-py2.4.egg/nose/core.py, line 409, in run self.setUp() ## LOTS OF LINES ELIDED ## File /usr/local/lib/python2.4/site-packages/kid-0.8-py2.4.egg/kid/pull.py, line 407, in feed raise e ExpatError: mismatched tag: line 22, column 2 -- Ran 0 tests in 0.629s FAILED (errors=1)
[TurboGears] Kid import error from quickstart
Hello, When running tg-admin quickstart I get a traceback that kid does not have attribute HTMLSerializer. The reason why kid does not have HTMLSerializer is because view.py is importing the kid script, not the kid package! If I stick print kid.__file__ after importing kid in view.py, I get this path: c:\python24\lib\site-packages\kid-0.8-py2.4.egg\EGG-INFO\scripts\kid Which is not right, but if I hard code the path by using something like imp.load_module(kid, None, 'c:\\python24\\lib\\site-packages\\kid-0.8-py2.4.egg\\kid', ('', '', 5)), then it naturally gets the right kid package: c:\python24\lib\site-packages\kid-0.8-py2.4.egg\kid\__init__.pyc I had this problem a few months ago with 0.8a5, which I got around by using load_module. I also got it just now after updating to 0.8.8. I followed the normal install instructions for Windows, but it seems like something is messed up on my end. I don't see any other people having this problem, but just in case this was my cheap solution (short of reinstalling everything). Steve
[TurboGears] Re: develix.com -- This page is parked free, courtesy of GoDaddy.com
I figured this'd be a pretty good way to send out the Godaddy Notification E-Mail ;-) Steve
[TurboGears] [patch] The grid widget has an embedded css link
The grid widget has an embedded css link in its template, making it very difficult to override its css. Here's a very simple patch to remove that link. I'd submit this to Trac, but it's down again. Index: grid.py === --- grid.py (revision 548) +++ grid.py (working copy) @@ -8,7 +8,6 @@ class Grid(Widget): template = div xmlns:py=http://purl.org/kid/ns#; -link href=/tg_static/css/widget.css type=text/css rel=stylesheet / table id=${widget.name} class=grid form_container ${' '.join(widget.css_classes)} cellpadding=0 cellspacing=1 border=0 thead py:if=widget.headers td py:for=head in widget.headers
[TurboGears] Re: problem trying to run wiki20-start.py
It worked.Thanks--GregOn 1/21/06, Joost Moesker [EMAIL PROTECTED] wrote: Hi Greg,Try running the start script from the projects directory:c:\PathToMyProjectsDir\wiki20wiki20-start.pyThat should work fine. The pyhton 2.4 windows install binds the .pyextention to the python interperter. Greg Dean wrote: Hello all, I just the 0.8.8 release and all went fine until I tried to run the wiki20-start.py file. I got this. Anybody have any ideas on what is wrong here. I haven't touched anything in these files. I'm using Windows XP. C:\Python24python scripts\wiki20\wiki20-start.py Traceback (most recent call last): File scripts\wiki20\wiki20-start.py, line 16, in ? cherrypy.config.update(file= dev.cfg) File c:\python24\lib\site-packages\CherryPy- 2.1.1-py2.4.egg\cherrypy\config.py, line 86, in update _load(file, override) File c:\python24\lib\site-packages\CherryPy- 2.1.1-py2.4.egg\cherrypy\config.py,line 206, in _load conf = dict_from_config_file(configFile) File c:\python24\lib\site-packages\CherryPy- 2.1.1-py2.4.egg\cherrypy\config.py ,line 182, in dict_from_config_file configParser.read(configFile) File c:\python24\lib\site-packages\CherryPy- 2.1.1-py2.4.egg\cherrypy\config.py, line 168, in read fp = open(filename) IOError: [Errno 2] No such file or directory: 'dev.cfg' --Greg
[TurboGears] gadfly ? quantact ?
On Fri, 2006-01-20 at 11:30 -0500, Kevin Dangoor wrote: On 1/20/06, Mike Kent [EMAIL PROTECTED] wrote: Excellent, 'nosetests' in the svn checkout directory now works. But there are failures. Apparently sqlite is also required now? Yeah, I should mention that somewhere. sqlite is *not* required by TurboGears itself, but the tests do require it. sqlite is a very good database for tests because you can make an in-memory database which is blazingly fast and requires no cleanup. Kevin Any plans for the all-Python in memory SQL database gadfly? It doesn't even need machine-specific object code. I am happy using quantact.com for turbogears-compatible hosting, since I don't mind managing an entire system and having root. They started out as a user mode linux virtual hosting system and have transitioned nicely to a Xen system and they have some decent tools. My virtual server runs debian and even uses logical volume management. - Daniel Holth
[TurboGears] Naming conflict in new config code
Always on the lookout for ways to simplify the Identity framework, I thought about allowing developers to specify their Identity model classes directly rather than by specifying the name of the module and then the names of the classes. So instead of:identity.soprovider.model="project.model"identity.soprovider.model.user="MyUser"identity.soprovider.model.group="MyGroup"identity.soprovider.model.permission= "MyPermission"You could have:from project.model import *identity.soprovider.model.user= MyUseridentity.soprovider.model.group= MyGroupidentity.soprovider.model.permission= MyPermissionHowever, it turns out that the model imports the identity module, which has a soprovider module and so the config file doesn't actually wind up with the right value.My temporary solution is to use the fully qualified module names:import project.modelidentity.soprovider.model.user= project.model.MyUseridentity.soprovider.model.group= project.model.MyGroupidentity.soprovider.model.permission= project.model.MyPermissionThis sure feels like a bug and I'll file a ticket once Trac comes back online. --Jeff Watkinshttp://newburyportion.com/
[TurboGears] Re: gadfly ? quantact ?
is Gadfly usable with sqlobject ? (Thanks for the info, I didn't know this RDBMS) Daniel Holth a écrit : On Fri, 2006-01-20 at 11:30 -0500, Kevin Dangoor wrote: On 1/20/06, Mike Kent [EMAIL PROTECTED] wrote: Excellent, 'nosetests' in the svn checkout directory now works. But there are failures. Apparently sqlite is also required now? Yeah, I should mention that somewhere. sqlite is *not* required by TurboGears itself, but the tests do require it. sqlite is a very good database for tests because you can make an in-memory database which is blazingly fast and requires no cleanup. Kevin Any plans for the all-Python in memory SQL database gadfly? It doesn't even need machine-specific object code. I am happy using quantact.com for turbogears-compatible hosting, since I don't mind managing an entire system and having root. They started out as a user mode linux virtual hosting system and have transitioned nicely to a Xen system and they have some decent tools. My virtual server runs debian and even uses logical volume management. - Daniel Holth -- -- David Dwayne BernardFreelance Developer mailto:[EMAIL PROTECTED] \|/ http://dwayne.java-fan.com --o0O @.@ O0o- signature.asc Description: OpenPGP digital signature
[TurboGears] MySQL sqlobject query
Hi guys, My queries worked just fine on Postgres, but now that I've moved to dreamhost (MySQL), they don't return any results. Here's my code: imgsearch=set(list(Searchtable.select( OR(Searchtable.q.galleryterms.contains(term), Searchtable.q.imageterms.contains(term) I've also tried this: imgsearch=set(list(Searchtable.select(Searchtable.galleryterms LIKE term OR Searchtable.imageterms LIKE term))) but with that one, it doesn't recognize term as the variable that it is. Any suggestions on a better way to construct this query, or mangle/add to term so that results get returned? In playing with phpMyAdmin, I realized that % wildcards are necessary for a successful query, but changing term with the following line still doesn't return results: term = '%'+term+'%' I have verified that records are in the database with phpMyAdmin, and that they match the criteria I'm looking for, I just think I'm not using the right code to query/select. Thanks, Mike
[TurboGears] Identity Changes
Revision 549 contains some refinements to the Identity framework. Mostly I'm finally taking advantage of the fact that our config files are now python scripts. If you've defined your own model using SqlObjectIdentityProvider, you'll need to make a few changes (they're easy and much more clear than the previous version).Details on the changes can be found at:http://nerd.newburyportion.com/2006/01/refining-the-identity-frameworkI'm planning to do a couple articles about how Visit Tracking can benefit your application enabling you to do collaborative filtering and implicit personalisation. (Can you tell I spent some time at BroadVision back at the turn of the Century?) --Jeff Watkinshttp://newburyportion.com/"Not everything that can be counted counts, and not everything that counts can be counted."-- Albert Einstein
[TurboGears] Re: MySQL sqlobject query
2006/1/21, Mike Sarahan [EMAIL PROTECTED]: Hi guys, My queries worked just fine on Postgres, but now that I've moved to dreamhost (MySQL), they don't return any results. Here's my code: imgsearch=set(list(Searchtable.select( OR(Searchtable.q.galleryterms.contains(term), Searchtable.q.imageterms.contains(term) I've also tried this: imgsearch=set(list(Searchtable.select(Searchtable.galleryterms LIKE term OR Searchtable.imageterms LIKE term))) but with that one, it doesn't recognize term as the variable that it is. Any suggestions on a better way to construct this query, or mangle/add to term so that results get returned? In playing with phpMyAdmin, I realized that % wildcards are necessary for a successful query, but changing term with the following line still doesn't return results: term = '%'+term+'%' I have verified that records are in the database with phpMyAdmin, and that they match the criteria I'm looking for, I just think I'm not using the right code to query/select. If you add ?debug=1 to the sqlobject.dburi, you can see exactly what query SQLObject produces, it might help to trace down the problem. -- Ksenia
[TurboGears] Re: Class-style form declaration [NEW IDEA]
class ContactFields(WidgetsDeclaration): TextField(name=age) TextField(name=name) Jeff says he can do this using a zope-inspired hack. I prefer the sqlobject style due to its symmetry with the rest of the framework and because I'm comfortable with the code. Top notch idea, by the way.
[TurboGears] Dynamic SQLObject classes
I have what sounds like a strange request, even to me: I'd like to create a SQLObject class on the fly. Imagine something like the following: def create_link_table( class1, class2 ): class LinkTable(SQLObject): class sqlmeta: table= link_%s_%s % (class1, class2) id= None obj1= ForeignKey( class1 ) obj2= ForeignKey( class2 ) LinkTable.createTable( True ) return LinkTable But I don't think this will work because of SQLObject's lame registry thing. I suppose I could put each generated class into its own registry, but that's even lamer. Any thoughts? -- Jeff Watkins http://newburyportion.com/ “In science it often happens that scientists say, ‘You know that’s a really good argument; my position is mistaken,’ and then they actually change their minds and you never hear that old view from them again. They really do it. It doesn’t happen as often as it should, because scientists are human and change is sometimes painful. But it happens every day. I cannot recall the last time something like that happened in politics or religion.” Carl Sagan, 1987
[TurboGears] Q: For debugging, how do I turn on .py output from Kid?
For debugging, how do I tell Kid to write to a file the .py it creates from a template?
[TurboGears] Re: MySQL sqlobject query
This sure looks right to me, 1/Select : SELECT searchtable.id, searchtable.galleryterms, searchtable.imageterms, searchtable.alt__id FROM searchtable WHERE ((searchtable.galleryterms LIKE '%toronto%') OR (searchtable.imageterms LIKE '%toronto%')) Thinking that the OR might be confusing it somehow, I reduced the complexity to one section: 1/Select : SELECT searchtable.id, searchtable.imageterms, searchtable.alt__id FROM searchtable WHERE (searchtable.imageterms LIKE '%2002%') Still nothing, although issuing a similar select from phpMyAdmin gives the result that I expect. phpMyAdmin SQL query: SELECT * FROM `searchtable` WHERE `imageterms` LIKE CONVERT( _utf8 '%2000%' USING latin1 ) COLLATE latin1_swedish_ci LIMIT 0 , 30
[TurboGears] Re: Q: For debugging, how do I turn on .py output from Kid?
from this thread: http://groups.google.com/group/turbogears/browse_thread/thread/a306f55771b67bae/d72fb280d92edf05?q=kid+.py+output; To turn on .py generation just have KID_OUTPUT_PY=true in your server's environment. -Mike
[TurboGears] Re: Dynamic SQLObject classes
On Jan 21, 2006, at 2:11 PM, Jeff Watkins wrote: I have what sounds like a strange request, even to me: I'd like to create a SQLObject class on the fly. Imagine something like the following: def create_link_table( class1, class2 ): class LinkTable(SQLObject): class sqlmeta: table= link_%s_%s % (class1, class2) id= None obj1= ForeignKey( class1 ) obj2= ForeignKey( class2 ) LinkTable.createTable( True ) return LinkTable But I don't think this will work because of SQLObject's lame registry thing. I suppose I could put each generated class into its own registry, but that's even lamer. Any thoughts? I don't know the specifics of SQLObject, but you can do anything you need to do with regard to creating classes on the fly and whatnot with type's constructor. -bob
[TurboGears] Re: Identity Changes
How about blocks the whole tree ?? This don't work: class Admin(controllers.Controller, identity.SecureResource): required_groups= [Admin]
[TurboGears] Re: MySQL sqlobject query
2006/1/21, Mike Sarahan [EMAIL PROTECTED]: This sure looks right to me, 1/Select : SELECT searchtable.id, searchtable.galleryterms, searchtable.imageterms, searchtable.alt__id FROM searchtable WHERE ((searchtable.galleryterms LIKE '%toronto%') OR (searchtable.imageterms LIKE '%toronto%')) Thinking that the OR might be confusing it somehow, I reduced the complexity to one section: 1/Select : SELECT searchtable.id, searchtable.imageterms, searchtable.alt__id FROM searchtable WHERE (searchtable.imageterms LIKE '%2002%') Still nothing, although issuing a similar select from phpMyAdmin gives the result that I expect. phpMyAdmin SQL query: SELECT * FROM `searchtable` WHERE `imageterms` LIKE CONVERT( _utf8 '%2000%' USING latin1 ) COLLATE latin1_swedish_ci LIMIT 0 , 30 Knowing very little about MySQL, those two queries seems to be not exactly the same. I'd try to use exactly the same query you get from SQLObject debug log, either pasting it in phpMyAdmin or in mysql command line client... -- Ksenia
[TurboGears] Re: Identity Changes
2006/1/21, [EMAIL PROTECTED] [EMAIL PROTECTED]: How about blocks the whole tree ?? This don't work: class Admin(controllers.Controller, identity.SecureResource): required_groups= [Admin] It should be (at least in rev. 548): class Admin(controllers.Controller, identity.SecureResource): require = identity.in_group('Admin') -- Ksenia
[TurboGears] Re: MySQL sqlobject query
Ksenia, good idea - they don't look exactly the same, I agree. I copied/pasted the query from SQLObject debug into phpMyAdmin - and I get the same results as with the phpMyAdmin query - so it looks as if something isn't right with my database connection string or something therein. Other parts of the page that depend on the same database are functional, though - just this search query is broken. Hence my confusion.
[TurboGears] Error from TurboGears==0.9a0dev-r550
I get the below erro when I try to run my app. I just updated to 0.9a0dev-r550. C:\data\projects\ftestftest-start.py Traceback (most recent call last): File C:\data\projects\ftest\ftest-start.py, line 20, in ? from ftest.controllers import Root File C:\data\projects\ftest\ftest\controllers.py, line 1, in ? import turbogears File c:\python24\lib\site-packages\TurboGears-0.9a0dev_r550-py2.4.egg\turboge ars\__init__.py, line 12, in ? from turbogears import startup File c:\python24\lib\site-packages\TurboGears-0.9a0dev_r550-py2.4.egg\turboge ars\startup.py, line 192, in ? if startTurboGears not in cherrypy.server.on_start_server_list: AttributeError: 'Server' object has no attribute 'on_start_server_list' What gives ? any help much appreciated. Martin
[TurboGears] Re: Identity Changes
I'm sorry to hear that. Posting a stack trace is VERY helpful. If you had, I could already be working on the problem rather than asking for one.On 21 Jan, 2006, at 5:52 pm, [EMAIL PROTECTED] wrote:How about blocks the whole tree ?? --Jeff Watkinshttp://newburyportion.com/Democracy n: A country where the newspapers are pro-American.
[TurboGears] Re: Dynamic SQLObject classes
OK, that's a start. I don't know Python well enough to actually understand the lead you've given me. Sorry. I'd like to buy an example, please...On 21 Jan, 2006, at 5:45 pm, Bob Ippolito wrote:I don't know the specifics of SQLObject, but you can do anything you need to do with regard to creating classes on the fly and whatnot with type's constructor. --Jeff Watkinshttp://newburyportion.com/"Advertising directed at children is inherently deceptive and exploits children under eight years of age."-- American Academy of Pediatrics
[TurboGears] Re: Error from TurboGears==0.9a0dev-r550
I'm not shure, but that sounds like TG is using an older version of CheryPy. Try running easy_install . from within the thirdparty/ cherrypy directory. Hope that helps. Cheers Ronald On Jan 22, 2006, at 12:59 AM, [EMAIL PROTECTED] wrote: I get the below erro when I try to run my app. I just updated to 0.9a0dev-r550. C:\data\projects\ftestftest-start.py Traceback (most recent call last): File C:\data\projects\ftest\ftest-start.py, line 20, in ? from ftest.controllers import Root File C:\data\projects\ftest\ftest\controllers.py, line 1, in ? import turbogears File c:\python24\lib\site-packages\TurboGears-0.9a0dev_r550-py2.4.egg \turboge ars\__init__.py, line 12, in ? from turbogears import startup File c:\python24\lib\site-packages\TurboGears-0.9a0dev_r550-py2.4.egg \turboge ars\startup.py, line 192, in ? if startTurboGears not in cherrypy.server.on_start_server_list: AttributeError: 'Server' object has no attribute 'on_start_server_list' What gives ? any help much appreciated. Martin Ronald Jaramillo mail: ronald AT checkandshare DOT com blog: http://www.checkandshare.com/blog
[TurboGears] Re: Dynamic SQLObject classes
I think he was refering to metaclasses [1]. [1] http://www.python.org/2.2/descrintro.html#metaclasses Jeff Watkins wrote: OK, that's a start. I don't know Python well enough to actually understand the lead you've given me. Sorry. I'd like to buy an example, please... On 21 Jan, 2006, at 5:45 pm, Bob Ippolito wrote: I don't know the specifics of SQLObject, but you can do anything you need to do with regard to creating classes on the fly and whatnot with type's constructor. -- Jeff Watkins http://newburyportion.com/ Advertising directed at children is inherently deceptive and exploits children under eight years of age. -- American Academy of Pediatrics
[TurboGears] Re: Error from TurboGears==0.9a0dev-r550
Thanks, that got me further, but now I get: C:\data\projects\ftestftest-start.py Traceback (most recent call last): File C:\data\projects\ftest\ftest-start.py, line 20, in ? from ftest.controllers import Root File C:\data\projects\ftest\ftest\controllers.py, line 1, in ? import turbogears File c:\python24\lib\site-packages\turbogears-0.9a0dev_r550-py2.4.egg\turboge ars\__init__.py, line 14, in ? from turbogears import controllers File c:\python24\lib\site-packages\turbogears-0.9a0dev_r550-py2.4.egg\turboge ars\controllers.py, line 12, in ? import view File c:\python24\lib\site-packages\turbogears-0.9a0dev_r550-py2.4.egg\turboge ars\view.py, line 15, in ? from turbogears.i18n import i18n_filter, get_locale File c:\python24\lib\site-packages\turbogears-0.9a0dev_r550-py2.4.egg\turboge ars\i18n\__init__.py, line 9, in ? from turbogears.i18n.format import get_countries, get_country, get_month_nam es, \ File c:\python24\lib\site-packages\turbogears-0.9a0dev_r550-py2.4.egg\turboge ars\i18n\format.py, line 5, in ? from turbogears.i18n.utils import get_locale_data, set_locale_data, get_loca le ImportError: cannot import name get_locale_data
[TurboGears] ann: MochiKit 1.2
MochiKit 1.2 the ocho is now available! This release is the calm before the storm, it contains mostly bug fixes and minor functionality improvements -- but big things are coming soon. We have a signal/slot dispatch mechanism, a script.aculo.us port, a new testing system, non-browser compatibility (SpiderMonkey, KJS, SpiderMonkey, Rhino) and a normalized event object all in the works which will be hitting the trunk soon. For more information about the new features check out the mailing list and the trac instance. download: http://mochikit.com/download.html release announcement: http://mochikit.com/ann/MochiKit-1.2.html -bob
[TurboGears] Debugging the TextField widget built-in method title of str object at 0xb7b416a0 bug
I decided to take a crack at one of the current bugs, where a TextField widget named 'title' would display on a form with the text 'built-in method title of str object at 0xb7b416a0' filled in. Trac is down, so I don't know what the Trac bug number this is, but it does have a number. You can see this bug by putting the following in a controller: myForm = TableForm(widgets=[TextField('title')]) and then passing that to a template via the returned dict, then inserting the form in the template. It became obvious pretty quickly that something in TG was doing the equivalent of 'repr(getattr('some string', 'title')), and putting it into the value displayed in the field. In fact, changing 'title' to 'upper' resulted in 'built-in method upper of str object at 0xb7b416a0'. However, changing 'title' to 'foobar' results in an empty field, which lead me to believe the code was doing the equivalent of 'repr(getattr('some string', 'foobar', ''))' or possibly 'repr(getattr('some string', 'foobar', None))'. After spending some time with the code, I found the following in the template for the TableForm widget (line 138 widgets/forms.py): td${widget.insert(getattr(self.widget_value, widget.name, None), input_values, widget_error.get(widget.name, None))}/td After some study, I've determined that the intent of this code is to pass the current value of a widget on the form (in this case, a TextField widget) to the insert method of that widget. Changing the first argument of the above insert call to None results in an empty field being displayed rather than the 'build-in method...' text, but obviously if the TextField widget has a value, it will not be displayed. I can change the first argument to widget.default, and get the default value of the widget displayed in the field, but I'm not sure this exactly fills the intent of the code. At this point, I suppose Kevin will need to take a look at this code and determine what the actual intent is before a patch can be generated.
[TurboGears] tg-admin sql create problems
Hello all,I get up to the tg-admin sql create part of the 20 minute wiki and when I run the command I get this output. I have changed what I needed to in the dev.cfg file as far as the db uri goes. Another oddity is that by default it looks for prod.cfg instead of dev.cfg( I have tried the command with both .cfg files and I get the same results). I am on Windows XP. Anbody have any ideas?C:\Python24\Scriptstg-admin sql createDatabase URI not specified in the config file ( prod.cfg). Please be sure it's on the command line.This project seems incomplete. In order to use the sqlobject commandswithout manually specifying a model, there needs to be anegg-info directory with an appropriate sqlobject.txt file.I can fix this automatically. Would you like me to?Enter [y] or n: yTraceback (most recent call last): File C:\Python24\Scripts\tg-admin-script.py, line 7, in ? sys.exit( File c:\python24\lib\site-packages\turbogears-0.8.8-py2.4.egg\turbogears\command\__init__.py, line 186, in main command.run() File c:\python24\lib\site-packages\turbogears-0.8.8-py2.4.egg\turbogears\command\__init__.py , line 97, in run eggname = self.fix_egginfo(eggname) File c:\python24\lib\site-packages\turbogears-0.8.8-py2.4.egg\turbogears\command\__init__.py, line 121, in fix_egginfo imp.load_module (setup, *imp.find_module(setup, [.]))ImportError: No module named setup
[TurboGears] Re: Error from TurboGears==0.9a0dev-r550
this is a stab in the dark, and juding from the fact you've got that egg there, probably won't fix anything, but have you run python setup.py develop in your trunk directory?
[TurboGears] Re: tg-admin sql create problems
For the 'tg-admin sql create' command to work, you must run it from the top-level directory of your TG project. For example, if I used the command 'tg-admin quickstart', to create a TG project named 'myproject', I need to be in the just-created 'myproject' directory before I run 'tg-admin sql create' (of course, before that, I need to edit 'model.py' to create my data model).
[TurboGears] Re: Identity Changes
This is fixed in r551. I've just never really needed these before and didn't notice they weren't working for the rest of the tree.On 21 Jan, 2006, at 7:19 pm, Jeff Watkins wrote:Regrettably, SecureResource only protects itself and not included controllers. I haven't really addressed this yet (because frankly, you're the first to mention that you're using it). --Jeff Watkinshttp://newburyportion.com/In the USDA study [of the meat packing industry conducted in 1996] 78.6 percent of the ground beef contained microbes that are spread primarily by fecal material. The medical literature on the causes of food poisoning is full of euphemisms and dry scientific terms: coliform levels, aerobic plate counts, sorbitol, MacConkey agar, and so on. Behind them lies a simple explanation for why eating a hamburger can now make you seriously ill: There is shit in the meat.-- Eric Schlosser, Fast Food Nation
[TurboGears] whitspace being encoded as \t or \n
Heya all Using revision 550, any tab or newline character in my kid templates is being converted to an actual string '\t' or '\n' the html output. I have kid.encoding=utf-8 in my config.py, and the source files are all utf, and the the browser is seeing utf. It also occurs when I view the toolbox, so it's not my kid files specifically. My template files all have unix newlines, as I guess do toolbox's. Not really sure whats going on. Is there another option in kid that I'm missing? -- wavy davy True religion confronts earth with heaven and brings eternity to bear on time - A. W. Tozer
[TurboGears] Re: MySQL sqlobject query
Fixed it - no bug here, other than the ones crawling in my head, destroying my ability to notice glaring programming errors. -Mike
[TurboGears] Re: gadfly ? quantact ?
On Sat, 2006-01-21 at 21:42 +0100, David Bernard wrote: is Gadfly usable with sqlobject ? (Thanks for the info, I didn't know this RDBMS) Well, it's not usable with sqlobject right now. Does sqlobject require any of these features? * Nulls. * Outer joins. * CHECK conditions. * Enforced data type constraints. * Alter table (can't implement until NULLs arrive). * Date, Time, and Interval data types that are not implemented in gadfly? But check it out anyway. It is really fun to have an all Python SQL database. http://gadfly.sourceforge.net/ - Daniel Holth
[TurboGears] Re: No peak.security for 0.9
Yep, i feared so :) Thanks, Jeff.