[TurboGears] Creating new User: TG_User / tg_admin shell issue (0.9a4)
Hello list, I've a customized identity model: class Account(TG_User): _inheritable = False timezone = IntCol(default=0) ### Some other fields deleted for simplicity I also have the following function in the model.py to simplify user creation: def user_create(username, password): user = Account(userId=username, password=password, emailAddress='', displayName=username) return user When I launch tg-admin shell, and try to execute user_create('test', 'test') I receive the following exception: RequestRequiredException: An attempt was made to use a facility of the TurboGear s Identity Management framework that relies on an HTTP request outside of a requ est. Can somebody please clarify things a little bit? Why would a I need to have an HTTP request just to insert a user in my model? Thanks a lot, Regards Victor. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups TurboGears group. To post to this group, send email to turbogears@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/turbogears -~--~~~~--~~--~--~---
[TurboGears] Re: Creating new User: TG_User / tg_admin shell issue (0.9a4)
Patrick Lewis wrote: You're not going crazy, it's a bug. http://trac.turbogears.org/turbogears/ticket/624 The patch is pretty straightforward if you want to apply it. Thanks a lot, Patrick! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups TurboGears group. To post to this group, send email to turbogears@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/turbogears -~--~~~~--~~--~--~---
[TurboGears] Tutorial for 0.9a4: bugs, corrections and questions
Hello list, wasn't able to work with TurboGears for a while and was impressed of what you have achieve so far! Congratulations to everybody with such a significant progress towards TurboGears 0.9! I've decided to re-check tutorial (using TurboGears 0.9a4), and have come up with the following glitches: 1) In 'Friendlier URLs' section, mention of HTTPRedirect should be changed to turgogears.redirect 2) wiki20.tgz contains configuration files with the old style (.py) configuration files Now what seems like a BUG for me - I receive the following traceback while entering http://localhost:8080/pagelist?tg_format=json (and yes, I've added allow_json=True to the decorator). I've even changed tg.allow_json to True in config\app.py - and still nothing works. Can please someone check and confirm this is indeed a bug? Regards, Victor. * * * 500 Internal error The server encountered an unexpected condition which prevented it from fulfilling the request. Page handler: bound method Root.pagelist of wiki20.controllers.Root object at 0x0148AA30 Traceback (most recent call last): File c:\python24\lib\site-packages\CherryPy-2.2.0-py2.4.egg\cherrypy\_cphttptools.py, line 106, in _run self.main() File c:\python24\lib\site-packages\CherryPy-2.2.0-py2.4.egg\cherrypy\_cphttptools.py, line 255, in main body = page_handler(*virtual_path, **self.params) File string, line 3, in pagelist File c:\python24\lib\site-packages\TurboGears-0.9a4-py2.4.egg\turbogears\controllers.py, line 211, in expose output = database.run_with_transaction(expose._expose,func, accept, allow_json, allow_json_from_config,*args, **kw) File c:\python24\lib\site-packages\TurboGears-0.9a4-py2.4.egg\turbogears\database.py, line 216, in run_with_transaction retval = func(*args, **kw) File string, line 5, in _expose File c:\python24\lib\site-packages\TurboGears-0.9a4-py2.4.egg\turbogears\controllers.py, line 228, in lambda lambda _func, accept, allow_json, allow_json_from_config,*args, **kw: _execute_func( File c:\python24\lib\site-packages\TurboGears-0.9a4-py2.4.egg\turbogears\controllers.py, line 255, in _execute_func output = errorhandling.try_call(func, *args, **kw) File c:\python24\lib\site-packages\TurboGears-0.9a4-py2.4.egg\turbogears\errorhandling.py, line 71, in try_call output = func(self, *args, **kw) TypeError: pagelist() got an unexpected keyword argument 'tg_format' --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups TurboGears group. To post to this group, send email to turbogears@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/turbogears -~--~~~~--~~--~--~---
[TurboGears] Re: //add with widgettutorial
Hi Robert-Reinder, I'm sure it's related to http://trac.turbogears.org/turbogears/ticket/594 - please check if solution posted there works. Regards, Victor --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups TurboGears group. To post to this group, send email to turbogears@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/turbogears -~--~~~~--~~--~--~---
[TurboGears] Re: CalendarDatePickers causes JavaScript error: too much recursion
OK, changset r796 which fixed #598 fixed my problem as well; I've marked #597 as closed. Thanks Simon! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups TurboGears group. To post to this group, send email to turbogears@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/turbogears -~--~~~~--~~--~--~---
[TurboGears] Re: CalendarDatePickers causes JavaScript error: too much recursion
And I also meant - thanks Michelle! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups TurboGears group. To post to this group, send email to turbogears@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/turbogears -~--~~~~--~~--~--~---
[TurboGears] CalendarDatePickers causes JavaScript error: too much recursion
Hello list, I've faced a *very* strange problem when trying to user CalendarDatePicker. I've modified controllers.py from FormsTutorial, adding CalendarDatePicker (the diff to controllers.py from FormsTutorial/controllers.py is attached). Now when I'm pressing the 'Choose' button and selecting some date, nothing happens (e.g., the Calendar form does not dissappear from the screen and the form field is not updated), and I'm receving Error: too much recursion Source File: http://localhost:8080/tg_widgets/turbogears.widgets/calendar/calendar.js Line: 14 in my JavaScript console (I'm using Firefox 1.5.0.1 on Windows XP); the same error occurs with IE 6.0 SP2. The fun thing is that in Toolbox everything (both CalendarDatePicker and CalendarDateTimePicker) is working fine. Anybody has any clue? (Of course, I'm using latest SVN). Just in case, I've created ticket for it: http://trac.turbogears.org/turbogears/ticket/597 Regards, Victor. Index: /FormsTutorial/formstutorial/controllers.py === --- controllers.py (revision 12) +++ controllers.py (revision 13) @@ -7,14 +7,17 @@ name = widgets.TextField(validator=validators.NotEmpty) email = widgets.TextField(validator=validators.Email(), attrs={'size':30}) comment = widgets.TextArea() +date = widgets.CalendarDatePicker( +validator=validators.DateConverter(format='%Y/%m/%d'), +format='%Y/%m/%d') notify = widgets.CheckBox(label=Notify me) comment_form = widgets.TableForm(fields=CommentFields(), submit_text=Post comment) class Comments(list): -def add(self, name, email, text): -self.append((name, email, text, time.ctime())) +def add(self, name, email, text, date): +self.append((name, email, text, date, time.ctime())) comments = Comments() @@ -36,8 +39,8 @@ @expose() @validate(form=comment_form) @error_handler(add) -def save(self, name, email, comment, notify=False): -comments.add(name, email, comment) +def save(self, name, email, comment, date, notify=False): +comments.add(name, email, comment, date) if notify: flash(Comment added! You will be notified.) else: --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups TurboGears group. To post to this group, send email to turbogears@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/turbogears -~--~~~~--~~--~--~---
[TurboGears] turbogears.ulr() glitch fixed
Hello list, It seems as if turbogears.url() adds extra '/' to absolute paths if CherryPy's mount point is '/'. I've added a new ticket http://trac.turbogears.org/turbogears/ticket/594 with obvious patch. Regards, Victor. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups TurboGears group. To post to this group, send email to turbogears@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/turbogears -~--~~~~--~~--~--~---
[TurboGears] Quickstarting project in the directory under SVN control: 'empty' problems
Hello list, I've just come accross the following problem when quickstarting project in a directory which lives under SVN control (under Windows): After running quickstart, it seems as somebody (paste.script.create_distro?) already performed 'svn add' for the new created directory. However, turbogears\command\quickstart.py has a 'dirty hack' as it call it around lines 99-105: it removes 'empty' files from directories without content (currently newproject\static\css, newproject\static\javascript and newproject\sqlobject) as well as __init__.py. However, nobody does 'svd delete' for this file at this point, so 'svn commit' fails with error message and user should run 'svn delete' for each of those (now non-existing) files. That would probably confuse novice users - how can this be fixed?
[TurboGears] Re: Quickstarting project in the directory under SVN control: 'empty' problems
Elvelind Grandin wrote: Could you please open a ticket on this and I will look into it. Sure. http://trac.turbogears.org/turbogears/ticket/557
[TurboGears] Using catwalk with custom identity model
Hi list, Summary: 1. _inheritance=False should be added to your own class to avoid CatWalk crashing on your inherited user/group/permission table. 2. CatWalk does not understand sqlobject inheritance. Details: I'm trying to integrate identity into my existing project. I've successfully followed the wiki (http://trac.turbogears.org/turbogears/wiki/IdentityManagement) with idtest project and are now customizing identity model for my app: 1. I've added identity.soprovider.model.user=letsmeet.model.Account to the letsmeet\config.py as suggested. 2. I've modified my existing Account class, so now it look like that: class Account(TG_User): tasks = MultipleJoin('Task') ... various model-specific methods ... 3. Now, if I would try to select Account in the CatWalk, I'm receiving the following error message: Fail to load object instance: column account.child_name does not exist. 4. As explained here http://sqlobject.org/Inheritance.html, one should add _inheritance=False at the inherited class in order to avoid child_name automatic creation. 5. Now, CatWalk works - but doesn't show anything interesting when selecting Account model; in particular, you cannot use CatWalk to create new account and should use old good tg-admin shell. 6. It would be fun to have CatWalk that understands sqlobject inheritance some day, though I'm sure it shouldn't be expected before 1.1 given all existing priority tasks. 7. Just in case, I've created new ticket explaining all the above: http://trac.turbogears.org/turbogears/ticket/558 Please share your opinions, Regards, Victor.
[TurboGears] Using wiki - registration problems
Hi Kevin, when I'm trying to register myself on TurboGears trac on http://trac.turbogears.org/turbogears/register (I'm kind of tired entering my email details each time I want to fix some typo), after pressing the 'Create account' button I'm just receiving the login popup message - and nothing happens when I'm entering login/pass for my new account. I would be glad to see that fixed one day, whenever you'll have some spare time - it's not that big issue. Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups TurboGears group. To post to this group, send email to turbogears@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/turbogears -~--~~~~--~~--~--~---
[TurboGears] Re: Using wiki - registration problems
Thanks guys - it works now. Simon Belak wrote: It just takes some time for the system to acknowledge you as registered. Try again later. Simon Victor Kryukov wrote: I would be glad to see that fixed one day, whenever you'll have some spare time - it's not that big issue. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups TurboGears group. To post to this group, send email to turbogears@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/turbogears -~--~~~~--~~--~--~---
[TurboGears] Re: TurboGears google group FAQ proposal
Hi Michele, good point - I haven't noticed the 'official' FAQ. Now I've merged the two, and slightly reorganized it - hope now it's slightly more structured, though categorization is very objective thing I should admit. Let's keep the FAQ in the updated form - e.g. if somebody knowledgeable (like you or other guys) posts some brilliant topic, why don't add the link to this topic to the TurbogearsFaq? That would potentially decrease the newby traffic here from people like myself and will also add some value to the new users. Just my 2 cents, Ciao, Victor.
[TurboGears] Re: Python Editor
Lee McFadden wrote: On 2/9/06, Victor Kryukov [EMAIL PROTECTED] wrote: I've started using SPE for my main stuff (and if anyone knows how it might be possible to get tg-admin shell working in the bottom window they'll get a cookie! ;) I've just tried to do the following to make tg-admin shell works: 1. easy_install . in my project directory - just to make sure pkg_resource do know my project name. 2. in bottom window shell: os.getcwd(the top-directory of your project) import turbogears turbogears.command.base.Shell(turbogears.__version__).run() and this resulted for SPE hangup, and pythonw.exe (yes, I live under Windows) eating up most of the processor time - until I killed it. I'm not sure what went wrong here; probably some TurboGears / SPE gurus would be able to explain / fix this. Anyway, I'm really missing ipython in SPE shell and Scite for kid stuff. Just because it has XML/HTML support? Seems that adding XML/HTML syntax support to SPE shouldn't be such a hard task given that it's written in Python/wxPython... Victor.
[TurboGears] Re: Python Editor
Karl Guertin wrote: I'm not sure exactly which combination you're talking about, but I assume it's vim+ipython. Yep. If you do use windows (and do it via vsplit) map C-J C-WjC-W_ map C-k C-WkC-W_ Yes, I have the same bindings - but if you have, say, 10 open files in the bottom and you need to select third from the end - that's a lot of typing (ok, ok, you could press 7 C-J, but in that case you should now the number 7 exactly). I aslo don't like the way gvim highlights the active window - white on black and bold white on black just makes me frustrating... I've never felt the need for an object browser. I search for 'def function' or 'class class' if it's open in vim or if I'm in ipython %ed class or function. If I was more proactive I could run ctags on my projects and jump around that way. Good point - I almost forgot about ctags; using if might save a lot of typing. On the other hand, if you're just studying somebody's else sources, seeing big picture might be useful. If only one could replace the SPE internal shell with ipython...
[TurboGears] Re: Python Editor
Victor Kryukov wrote: I've just tried to do the following to make tg-admin shell works: 1. easy_install . in my project directory - just to make sure pkg_resource do know my project name. 2. in bottom window shell: os.getcwd(the top-directory of your project) import turbogears turbogears.command.base.Shell(turbogears.__version__).run() and this resulted for SPE hangup, and pythonw.exe (yes, I live under Windows) eating up most of the processor time - until I killed it. I'm not sure what went wrong here; probably some TurboGears / SPE gurus would be able to explain / fix this. OK, I found the clue for SPE hangup: adding if sys.executable.endswith('pythonw.exe'): from cStringIO import StringIO sys.stdout = StringIO() after sys import in SPE.py should solve the problem. But now, I'm getting the following error message: turbogears.command.base.Shell(turbogears.__version__).run() Traceback (most recent call last): File input, line 1, in ? File c:\python24\lib\site-packages\turbogears-0.9a0dev_r707-py2.4.egg\turbogears\command\base.py, line 173, in run self.find_config() File c:\python24\lib\site-packages\turbogears-0.9a0dev_r707-py2.4.egg\turbogears\command\base.py, line 63, in find_config load_project_config(self.config) File c:\python24\lib\site-packages\turbogears-0.9a0dev_r707-py2.4.egg\turbogears\command\base.py, line 46, in load_project_config modulename = package + .config) File c:\python24\lib\site-packages\turbogears-0.9a0dev_r707-py2.4.egg\turbogears\config.py, line 121, in update_config pathconfig.load_config(modfile) File c:\python24\lib\site-packages\turbogears-0.9a0dev_r707-py2.4.egg\turbogears\config.py, line 90, in load_config execfile(modfile, d) IOError: [Errno 2] No such file or directory: 'c:\\documents and settings\\victor kryukov\\my documents\\_private\\python.svn\\letsmeet\\config.py' While TurboGears should look for my config.py in ...\\letsmeet\\letsmeet. What is the right way to call turbogears.command.base.Shell(version).run(), anyway?
[TurboGears] Re: Python Editor
Michele Cella wrote: Karl, the cool thing about PIDA is that it uses the *real* VIM with your configuration (.vimrc). PIDA just adds some tools around a normal VIM instance by wrapping it inside a GTK application (that uses pygtk). There are many tools: - integration with svn, bzr, darcs - code browser - ... So is there any estimation when this wonderful tool will be available for poor Windows users?
[TurboGears] TurboGears google group FAQ proposal
Hello list, I've found that this group is invaluable source for all kinds of information regarding TurboGears development. While we all waiting for official documentation to appear, why don't we start codifying all that knowledge that is already here? I've created simple wiki page - http://trac.turbogears.org/turbogears/wiki/TurboGearsGroup - please feel free to add anything interesting that you've spot here. Regards, Victor.
[TurboGears] Re: Tutorial wiki page editing error (Cyrillic characters)
Alexei hi, you may find the following info useful: http://groups.google.com/group/turbogears/browse_thread/thread/89f54a2eb5e16d14/2c80c93dd9f327de#2c80c93dd9f327de
[TurboGears] Starting with widgets - how and where?
Hello list, could anybody please give (here or at wiki) any references how to start with widgets? I'm following SVN right now, and have read initial Kevin's posts, but things are going pretty fast here, and for somebody who (like myself) couldn't follow the google group very carefully and can only code on weekends that become an issue. I fully understand that there is no 'official doc' yet; but probably some non-trivial working examples and/or some sequence of TurboGears group postings, updated at wiki, would be enough. Thanks a lot, Victor.
[TurboGears] Re: turbogears.url() doesn't work?
Hi Gigi, you may look here on how to debug kid files: http://tinyurl.com/89lab (in short, setting shell environment KID_OUTPUT_PY=true should help - for both windows/linux)
[TurboGears] Do we need an option to turn off automatic cherrypy.server.start() during import?
Hi list, I'm currently testing my database model with generous help of turbogears.testutil, and frankly it's quite annoying that server starts every time I run my test-model.py, while I don't need it. Shouldn't we move server start into some function and call it explicitly only when we need the server? E.g. something like this: --- testutil.py (revision 564) +++ testutil.py (working copy) @@ -1,6 +1,5 @@ import cherrypy cherrypy.config.update({global : {autoreload.on : False}}) -cherrypy.server.start(serverClass=None, initOnly=True) from turbogears import database database.set_db_uri(sqlite:///:memory:) @@ -16,6 +15,9 @@ from turbogears import controllers from turbogears.util import get_model +def server_start(): +cherrypy.server.start(serverClass=None, initOnly=True) + def create_request(request, method=GET, protocol=HTTP/1.1, headers={}, rfile=None, clientAddress=127.0.0.1, remoteHost=localhost, scheme=http):
[TurboGears] Re: Do we need an option to turn off automatic cherrypy.server.start() during import?
Done. http://trac.turbogears.org/turbogears/ticket/467
[TurboGears] Re: Problems with SVN version of TurboGears
Thanks Kevin!
[TurboGears] Re: Problems with SVN version of TurboGears
The same solution worked for me as well. Thanks.
[TurboGears] Re: Problems with SVN version of TurboGears
Hi Kevin, and thanks for your quick reply. I've solved 1) with kid update, as suggested. As to the 2) - it was just me misusing TG: my root class was NOT a subclass of turbogears.controllers.RootController (which was ok in TurboGears 0.8.7 since it was just a dummy class), and that caused error in my case. After subclassing controllers.RootController, everything works just fine. On the positive note - comments in the turbogears.util helps a lot! The whole process of getting the latest version of TurboGears via SVN still has a lot of mystery in it, though: I didn't quite get the relationship between SVN and easy_install (is there any doc which explains this relationship)? In particular, am I right that: 1) After svn update in turbogears root dir, I'll get the latest trunk version of turbogears AND the latest trunk versions of corresponding thirdparty modules (true/false?) 2) After each svn update, I should manually run 'python setup.py develop' in turbogears root dir in order to have in installed (true/false?) 3) And after that, I should manually run 'python setup.py develop' inside each thirdparty module directory (true/false?)
[TurboGears] Re: SQLObject: changing way how orderBy sorts
Thanks Ksenia - I'm using SQLite for prototyping my application at the moment, but will switch to Postgres while in production, so your advice is quite useful.
[TurboGears] Re: SQLObject: changing way how orderBy sorts
OK, I should have think twice... One obvious solution is: tasks1 = Task.select(Task.q.deadline != None).orderBy(Task.q.deadline) tasks2 = Task.select(Task.q.deadline == None) tasks = list(tasks1) + list(tasks2) Any other ideas?