[web2py] unicode problem in args?
hi, I have such a problem this url works (unicode in vars http://localhost:8000/myapp/default/show/products?q=M%C4%83rimea but this doesn't (unicode in args) http://localhost:8000/myapp/default/show/products/s-M%C4%83rimea any ideas?
[web2py] webfaction increased memory
hi, I just noticed that webfaction increased memory from 80 to 256Mb important to notice that this is application memory This is the actual memory available to your long-running processes (for instance, your Rails or Django processes). Unlike on a VPS, the memory used by the operating system, the main web server and the database servers doesn't count towards your memory usage and Roberto have made optimizations to uwsgi to run on low resources hostings, so it is a great time to use web2py with uwsgi and webfaction so now uwsgi command to run web2py on webfaction will be uwsgi --http 127.0.0.1:yourport --pythonpath /home/youruser/web2py -- module wsgihandler -d /home/youruser/tmp/uwsgi.log -t 20 --async 10 -- ugreen --limit-as 100 -r --no-orphans -M -p 2 --touch-reload /home/ youruser/tmp/uwsgireload.txt --reload-on-rss 100 short: 2 uwsgi workers(processes) each limited to 100Mb uwsgi version 0.9.8.6 if you are new you could use my affiliate link (hope you will not judge me for that :) ) http://www.webfaction.com/services/hosting?affiliate=fermer
[web2py] small book error
http://web2py.com/book/default/chapter/08 please add an 's' to auth.setting.extra_fields['auth_user']= [ Field('address'), Field('city'), Field('zip'), Field('phone')] should be auth.settings
[web2py] Re: Webfaction: Memory usage way over your limit ; again.
with the latest uwsgi version I cannot login to my website, even no error is generated I use also a flex app with web2py service and it gives an error Traceback (most recent call last): File /home/yourname/web2py/gluon/restricted.py, line 194, in restricted exec ccode in environment File /home/yourname/web2py/applications/myapp/controllers/ gateway.py, line 129, in module File /home/yourname/web2py/gluon/globals.py, line 149, in lambda self._caller = lambda f: f() File /home/yourname/web2py/applications/myapp/controllers/ gateway.py, line 127, in call return service() File /home/yourname/web2py/gluon/tools.py, line 3847, in __call__ return self.serve_amfrpc(3) File /home/yourname/web2py/gluon/tools.py, line 3716, in serve_amfrpc pyamf_request = pyamf.remoting.decode(request.body) File /home/yourname/web2py/site-packages/pyamf/remoting/ __init__.py, line 605, in decode msg.amfVersion) DecodeError: Malformed stream (amfVersion=12134) on webfaction I use 0.9.8.6 with no problems
[web2py] Re: Webfaction: Memory usage way over your limit ; again.
and also uwsgi --version doesn't give the version but tells that there is an error
[web2py] how to execute a controller from command line
hi, is it possible to execute a controller from command line without running a wsgi server? I want to use that in a long running applications which from time to time will call different controllers
[web2py] codemirror as editor
hi, I just managed to use codemirror instead of editarea using python mode and html mixed mode for views and codemirror-ui toolbar I propose to include it in web2py as an alternative to eamy and editarea, may be as a default one I can send the code and files that I used
[web2py] Re: Webfaction: Memory usage way over your limit ; again.
hi Roberto, a few questions about uwsgi 1: - how it is running by default: threaded or async? - does it limits memory usage or I have to use as before --limit-as 80 ? I suppose that I have to pass parameter as it doesn't know the memory limit please tell me what you think about my command uwsgi --wsgi-file web2py/wsgihandler.py -m --http-socket :15507 -d / home/fermer/tmp/uwsgi.log -t 20 --async 16 --ugreen --limit-as 70 -r -- no-orphans -M -p 1 --touch-reload /home/fermer/tmp/uwsgireload.txt -- reload-on-rss 50
[web2py] auth.requires_login() inside a view
hi, I need to display a form (similar to a blog post), but only when a user is registered, but the page should be displayed even if user is not authenticated, except the form #a list of posts {{if auth.user:}} {{=form}} {{else:}} h3{{=T('Posting messages requires login')}}/h3 {{=auth.navbar()}} {{pass}} the problem is that after login it is not redirected to that page any help? thank you
[web2py] unql
hi, I am thinking how to extend DAL so it could be suitable for OriendDB SQL or for http://www.unqlspec.org/display/UnQL/Home do you have any thoughts on that? gae storage is already an example of DAL variations by not supporting joins and other features
[web2py] Re: IMPORTANT
We welcome people of any gender identity or expression, race, ethnicity, size, nationality, sexual orientation, ability level, religion, culture, subculture, and political opinion +1 for me that means that Johan has the right to include his signature, as we accept him, that speaks about himself, not against others, that tells us about his religion not that he is against other religions forcing him to remove his signature is exactly the opposite of accepting people of all religions
[web2py] anyone using jython with web2py on production
hi, I am interested to know if there is anyone using jython with web2py in production - on top of what server - with what database - what is the memory consumption - what is the performance thank you
[web2py] uwsgi question
hi, sqlite 3.7+ supports better concurrency (see http://www.sqlite.org/draft/wal.html), on webfaction, there are multiple python versions installed, but python2.7 is built against 3.3.6 so I built from sources sqlite, python 2.7 and now on /home/my_user/ bin/python2.7 I can use latest sqlite import sqlite3 sqlite3.sqlite_version shows 3.7+ if I run /home/my_user/bin/python2.7 web2py.py sqlite3.sqlite_version is 3.7 but if I run uwsgi the way I described in other posts it seems to see the standard one (3.3.6) also I put in uwsgihandler.py first line to be #!/home/my_user/bin/ python2.7 and my question is: how I can enforce to use sqlite 3.7 (is it because it uses the default installed python 2.7)
[web2py] maybe it is time to think on starting web3py
why I think it is time: - python 3 is already in version 3.2 - pypy will start soon a python 3 implementation - python 3 has many cool features (OrderedDict, all strings are unicode, etc), well some of them already ported to 2.7 :) - many libraries used by web2py already support python 3: rocket even without translation tool - we can break backward compatibility and to use new language features to implement our wishes we can start with a planning wiki like jquery ui does what do you think?
[web2py] web2py with jython on linux
I got this error import cPickle ImportError: No module named copy_reg
[web2py] Re: uWSGI 0.9.9
seems fixed in 0.9.9.2 thank you and some questions: is it possible to run uwsgi with jython ? when do you think it will be possible to run uwsgi with pypy ? thank you again for your awesome project
[web2py] Re: uWSGI 0.9.9
hi Roberto, This version seems to be backward incompatible: --protocol http --socket 127.0.0.1: doesn't seems to work for me and using uwsgi --http 127.0.0.1: with --touch-reload makes uwsgi to exit completely (no uwsgi processes after touching the file )
[web2py] table_class
hi, just noticed that you added table_class to dal define_table method thank you Massimo, do you have anything in mind to use it for? or you did a favor to me ? :)
[web2py] web2py vs Drupal
hi, soon I will have a conversation with a client and it is possible that we will discuss this thing too, I have good experience with php, but not with Drupal, if some of you have some experience and migrated to web2py please share that thank you
[web2py] web2py license
here is an interesting article about source code licenses http://gskinner.com/blog/archives/2008/07/source_code_lic_1.html the author in summary says I would strongly encourage developers to release shared code under the MIT license. and I would also encourage developers to petition the owners of their favourite shared libraries to change their licensing to MIT, if they haven’t already. so my question: why not releasing under MIT license or under dual license (as jquery) ?
[web2py] Re: web2py 1.97.1 is OUT
I get an error when access an amfrpc3 service from flex (works for 1.96.4) [FaultEvent fault=[RPC Fault faultString=Send failed faultCode=Client.Error.MessageSend faultDetail=Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Status 500: url: 'http://localhost:8000/myapp/gateway/call/ amfrpc3'] messageId=6F671232-BAC7-E72A-9829-D278D50BD935 type=fault bubbles=false cancelable=true eventPhase=2] also if you will fix that please make it work with pyamf 0.6 thank you
[web2py] Markmin question
hi, I like markmin syntax, I am thinking to use it, yet I have a few questions - is there a html to markmin converter? (a markmin to html is - /gluon/ contrib/markmin/markmin2html.py) - how to emebed flash? - what about including css or javascript ? (script, link ) thank you
[web2py] Web2py - the one-man-band of all python frameworks :)
http://projects.unbit.it/uwsgi/wiki/Example
[web2py] new versions of software
just want to share some news :) recently released pypy 1.5 jquery 1.6 codemirror 2 flex 4.5
[web2py] a new html editor
hi, I am here to present a work in progress: a lighweight jquery based html editor http://8plus2.org/init/static/bolteditor/index.html it is in alpha version now it is 10kb of js code + 15kb html+css+images and of course dependencies jquery and jquery.ui.position user interface (and just user interface) is from another editor http://www.openwebware.com/, some coding ideas from jquery.rte http://code.google.com/p/rte-light why another one? - jquery.rte is not feature rich - I like openwebware interface but - it is not compatible with jquery - seems not updated for a few years I need some feedback, ideas, and suggestions on integration with web2py thank you
[web2py] OrderedTree implementation
Hi, I am developing a solution to store hierarchical data, we have already nested sets, but I have some reasons to develop an alternative for those interested to contribute with ideas and implementation the description (draft) https://docs.google.com/document/d/1ZOwRUJz4gRPI875rftTfwOBIera1JgZDPulooGjNyu0/edit?hl=en
[web2py] reCaptcha in forms
how to use reCaptcha in other form then authorization forms? is it possible or do I need to implement that? please help
[web2py] april fools
from my country http://www.tigan.md/card1.aspx?id=7417ac7c-3188-4652-b9b2-362875219e70 from google http://www.google.com/mail/help/motion.html#utm_source=en-et-na-usutm_medium=new-features-linkutm_campaign=en
[web2py] recaptcha or requires login for comments
hi, I cannot find in the book how to use recaptcha with simple forms for now I need recaptcha or requires login for comments, any thoughts?
[web2py] fulltext search question
hi, sqlite supports fulltext search http://www.sqlite.org/fts3.html also mysql, mssql, oracle, and soon GAE what could be some steps to add support for fulltext search in dal?
[web2py] authentication with services
I want to do that @auth.requires_login() @service.amfrpc3('myservice') def item_list(): return [1,2,3] but of course it will not work as it can't redirect to login form, how to use then authentication and authorization here?
[web2py] a few DAL proposes
hi, I propose to add a few things to DAL 1) an 'act_as' parameter in define_table so I can extend Table class and use it as regular table for e.g. db.define_table(images, Field(category, db.categories), Field(title), act_as=OrderedList, ) OrderedList is a class that extends Table class and adds a 'line' column, overrides insert and __del__ methods and adds 2 other methods: move_before, move_after required changes to gluon dal: - add 'act_as' to the allowed keyword list in define_table method ['migrate', 'primarykey', 'fake_migrate', 'format', 'trigger_name', 'sequence_name', 'act_as'] - act_as = args.get('act_as',Table) - Table is the default for 'act_as' - t = self[tablename] = act_as(self, tablename, *fields, usages: _id = db.images.insert(... ) db.images.move_before(_id, 2) 2) please add __mod__ to Expression class so I can use it in dal expressions I want that #move last image to first position and all other images positions are increased by 1 db(db.images).update(line=db.images.line % _count +1) but I am forced to use raw sql db.executesql('UPDATE images SET line = line %% %s +1', (_count,))
[web2py] Re: pyamf 0.6 doesn't work with web2py
What is the status, I would like to test it On Jan 31, 4:19 pm, Massimo Di Pierro massimo.dipie...@gmail.com wrote: g... I can port it to the new one. Can you help with testing? On Jan 31, 3:04 am, elffikk elff...@gmail.com wrote: hi Massimo, I think this is due to a list of backward incompatibilitieshttp://www.pyamf.org/whatsnew/0.6.html
[web2py] dal feature request
hi Massimo, I would like to have something like sqlsoup, but I don't need it to inspect database to do class mapping or so I am just interested to use dal syntax without defining my tables ( they are already in the database) When I have to develop database parts I have 2 scenarios: - everything is built from scratch - database already exists and I should build some functionality without altering database for first scenario the current dal is great, web2py handles for me database creation, migration, etc for second part I am forced to define tables (or to use a tool that generates dal equivalent structure) but I think I don't need that, I would like an option that will let dal expression to behave like simple sql, without checking if table is defined or if sql fields are part of this table, and to let my self to be sure that table and fields names are correct I think it should look like that db = DAL('conn string', define_tables=False) db(db.table1).select() db.table1.insert(field1=1, field2='aa') I think that is possible because DAL expressions are translated to sql then executed, and this implementation will need just to skip some checking in the code PS: I'm ok if sqlforms will not work in this mode
[web2py] PyPy faster than C ...
I think this is cool http://morepypy.blogspot.com/2011/02/pypy-faster-than-c-on-carefully-crafted.html
[web2py] dal to use a limited number of connections
hi, I use dal standalone with gevent for a high io bound program, there are thousands of users each with his own database (mysql), I update some tables with info from the web, and to make it fast I use a few hundreds greenlets, that means each has a db (DAL) object, which use a db connection how to use only a few connections with dal, or what I need to change to do so even if that means to use just one connection, database operations are much faster so it doesn't affect too much overall performance usin pool_size doesn't help because it reuse connections for the same connection string, that means it can use a few connections for the same database, but I need a pool for all databases
[web2py] pyamf 0.6 doesn't work with web2py
hi Massimo, I think this is due to a list of backward incompatibilities http://www.pyamf.org/whatsnew/0.6.html
[web2py] nginx with bultin uwsgi module
http://nginx.org/
[web2py] Re: New server
a few files that I used for CentOS 5+ (I can;t attach them so I provide links) http://thebookle.com/thebookle/static/install/supay.py http://thebookle.com/thebookle/static/install/www.d http://thebookle.com/thebookle/static/install/server_install.txt use commands from server_install.txt place www.d and supay.py (http://code.google.com/p/supay/) in web2py folder make www.d executable use ./www.d start ./www.d stop commands if you want to use admin, first run web2py on port 80 and set a password (will be created a file parameters_80.py) if you have this file on your pc you can upload it to server on web2py folder after creating a tunnel http://oldsite.precedence.co.uk/nc/putty.html connect to server from browser http://127.0.0.1:80/admin/
[web2py] routes problem
hi, I use version 1.82.1 (latest) and this seems not to work ('(.*):https?://(.*)site\.com:(.*)/(.*)', '/site/$4'), for simple site.com getting error site - is another name :)
[web2py] Cron question
Is it possible to use hardcron when running on rocket not on apache? I am running web2py on top of gevent.pywsgi on CentOS 5.+ soft cron is just not suitable...
[web2py] Flash security
I know that web2py aims to be secure, but if you use it with amfrpc service that could be interesting to read http://www.ivizsecurity.com/blog/web-application-security/testing-flash-applications-pen-tester-guide/
[web2py] DAL error
I am getting such an error in last release of web2py, with previews versions didn't try Traceback (most recent call last): File ...\web2py\gluon\restricted.py, line 178, in restricted exec ccode in environment File .../web2py/applications/mailtest/models/models.py, line 7, in module Field(body, text) File ...\web2py\gluon\sql.py, line 1309, in define_table t._create(migrate=migrate, fake_migrate=fake_migrate) File ...\web2py\gluon\sql.py, line 1730, in _create self._db._execute(query) File ...\web2py\gluon\sql.py, line 897, in lambda self._execute = lambda *a, **b: self._cursor.execute(*a, **b) OperationalError: near from: syntax error Is 'body' a keyword that can't be used ? model: db.define_table(email, Field(from), Field(to), Field(subject), Field(body, text) ) view: def index(): form = crud.create(db.email) if form.accepts(request.vars, session): pass return dict(form=form)
[web2py] amfast rtmp example
will it be hard to add this in web2py? http://code.google.com/p/amfast/source/browse/#svn/trunk/examples/messaging/python or it is again a question for Tim? :)
[web2py] to Tim Farrell
hi, this is not related to web2py, just to rocket I just got trac running with Rocket. Performance is great! But one thing that I need is authentication using at least basic auth, since trac is relying on web server authentication anyone can help with that? seems that cherrypy does it and (nothing bad, I think): I installed this version http://pypi.python.org/pypi/rocket/1.0.4 but on your website (https://launchpad.net/rocket) latest is 1.0.3 thank you in advance
[web2py] how to use sql functions in dal expressions
hi, how to use sql functions in dal expressions ? particularly I am interested in mod operator (%) for using on updates need somethings like that db.table.update( (db.table.field+n) % db.table.count() )
[web2py] routes question
hi, I want to serve multiple websites (absolutely different domains) using the same web2py instance I am getting always an 'Invalid request' message routes.py is something like that routes_in = ( ('^.*site1\.com.*/(.*)', '/site1/$1'), ('^.*site2\.com.*/(.*)', '/site2/$1'), ) I read this post http://groups.google.com/group/web2py/browse_thread/thread/4768cc04ad88c48d/ce9e4800f98591d2?lnk=gstq=routes#ce9e4800f98591d2 and I thought that will work Any thoughts?
[web2py] rocket performance
a simple test loading one by one the same link, leaving concurrency and advanced testing to Tim and others :) just wanted to feel the improvement, and I have to say Tim did his job very well web2py 1.76.5 vs 1.77.1 load test 10 requests: 1.76.5 - 0.3016 seconds 1.77.1 - 0.2736 seconds 100 requests: 1.76.5 - 1.7729 seconds 1.77.1 - 1.4585 seconds 1000 requests: 1.76.5 - 16.6493 seconds 1.77.1 - 13.4033 seconds and here is the great test script :) import sys, urllib n = int((sys.argv[1:] or [10])[0]) s = 'http://127.0.0.1:8001/' # s = 'http://127.0.0.1:8002/' for i in xrange(n): urllib.urlopen(s).read() -- Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en
[web2py] web2py wrong version
hi, just downloaded 1.77.2 (from http://www.web2py.com/examples/static/web2py_src.zip ), but it shows that is version 1.77.1 content of version file: Version 1.77.1 (2010-04-19 15:50:56) -- Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en
[web2py] web2py on github
hi, I use a few project stored on github, and I find it easier to navigate source code or to get a trunk version. What about moving web2py on github? -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] a substitute for sqlite?
Berkeley DB's new SQLite-compatible SQL API Oracle Berkeley DB 11g Release 2 introduces a new SQL API, based on SQLite, which is familiar to a large developer community and helps simplify application development. http://www.oracle.com/us/corporate/press/063695 A few things to note (from press release): - Improved SQL concurrency, performance and reliability using Oracle Berkeley DB storage engine’s fine-grained locking mechanism and write- ahead logging underneath the SQLite API; - SQLite Tools integration means that all tools that work with SQLite will also work with Oracle Berkeley DB, making it easier to develop, deploy and manage Oracle Berkeley DB applications and databases; -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] web2py on hostmonster
hi, I am trying to install web2py on hostmonster (fcgid) using this (how to install django) http://www.hostmonsterforum.com/showthread.php?t=3100 but ... :( fcgi scripts are running only from cgi-bin/ directory, tried to install just cherrypy and it seems not finding a free port, logs says that port 8080 is not free any thoughts or help ? thank you all in advance ps: - I already installed python 2.6 - I use fcgihandler.py renamed to fcgihandler.fcgi -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] web2py with alchemy
hi, is there somebody that used sqlalchemy with web2py, how hard will be to do that? my thoughts now are to try it with formalchemy as alternative to web2py models + things like SQLForm or SQLTable -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] amfast
Hi, have someone used amfast with web2py? http://code.google.com/p/amfast/ I am interested in using it with web2py in gae http://code.google.com/p/amfast/wiki/ExampleImplementations so if someone used it please share your experience, save my time :) -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py:36338] Re: crossdomain.xml problem
No one had this problem? -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py:36195] crossdomain.xml problem
Hi, I created routes in the root folder of web2py and it look like that routes_in = (('.*:/crossdomain.xml', '/myapp/static/ crossdomain.xml'),) I don't see any errors but http://127.0.0.1:8000/crossdomain.xml shows an 'Invalid request' message Any thoughts? -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py:35188] gae transactions
Hi, A while ago I read in web2py manual that gae doesn't support transactions I found this link http://code.google.com/appengine/docs/python/datastore/transactions.html Quite confused.. Any one can tell me more about? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:34905] Nested Sets implementation
Hi, I started a nested sets implementation Just sharing the code. I welcome any thoughts you have 2 files - nstree_controller (just quick and dirty tests of the model), and nstree_model [nstree_controller :] t1 = nstree(db, db.tree1) def index(): return dict(message=Version + nstree.version) def test_path(): _id = 33 return dict(message = .join([node.name for node in t1.path (_id)])) def test_removetree(): _id = request.vars.id if request.vars.id else 3 t1.remove_tree(_id) return dict(message=Success) def test_delete(): _id = request.vars.id if request.vars.id else 19 node = t1.delete(_id) return dict(message= node.name + deleted ) def test_get(): _id = request.vars.id if request.vars.id else 15 #nodes = t1.ancestors(_id) #nodes = t1.descendants(_id) nodes = t1.children(_id) return dict(message= , .join([node.name for node in nodes])) def test_gettree(): root_id = request.vars.root_id if request.vars.root_id else 1 nodes = t1.tree(root_id) return dict(message=Count +str(len(nodes))) def test_add(): root_id = request.vars.root_id if request.vars.root_id else t1.roots()[0].id r1 = t1.add(root_id, name='1') r2 = t1.add(root_id, name='2') r3 = t1.add(root_id, name='3') t1.add(r1, name='11') t1.add(r1, name='12') return dict(message=Success) def test_create_roots(): ''' t1.create_root(name='root1') t1.create_root(name='root2') t1.create_root(name='root3') t1.create_root(name='root4') ''' roots = t1.roots() return dict(message=Roots count : + str(len(roots))) [nstree_model:] db.define_table('tree1', SQLField('name', string, 128), SQLField('lft','integer'), SQLField('rgt','integer'), SQLField('level','integer'), SQLField('root_id','integer'), SQLField('parent_id','reference tree1'), ) # # A Nested Sets implementation # need to pass a table with following fields: # lft, rgt, level, parent_id, root_id - all fields of type int # --- # Notes: # - table can contain multiple roots # class nstree: version = 1.0.0.04 def __init__(self, db, dbtable): self.db = db self.dbtable = dbtable #self.lft = dbtable.lft #self.rgt = dbtable.rgt #self.level = dbtable.level #self.parent_id = dbtable.parent_id #self.root_id = dbtable.root_id # # Methods for building tree (create, delete nodes) # def create_root(self, **fields): _id = self.dbtable.insert(lft=1, rgt=2, level=0, **fields) _root = self.dbtable[_id] _root.update_record(root_id = _id) return _root def add(self, parent_id, **fields): return self.add_last_child (parent_id, **fields) def add_last_child(self, parent_id, **fields): _parent = self.dbtable[parent_id] q1 = self.dbtable.rgt = _parent.rgt q2 = self.dbtable.lft = _parent.rgt q3 = self.dbtable.root_id == _parent.root_id self.db(q1)(q3).update(rgt=self.dbtable.rgt+2) self.db(q2)(q3).update(lft=self.dbtable.lft+2) return self.dbtable.insert( parent_id = parent_id, lft = _parent.rgt, rgt = _parent.rgt+1, level = _parent.level+1, root_id = _parent.root_id, **fields ) def delete(self, id): return self.remove(id) def remove(self, id): node = self.dbtable[id] delta = node.rgt - node.lft + 1 q1 = self.dbtable.lft = node.lft q2 = self.dbtable.rgt = node.rgt self.db(q1)(q2).delete() self.db(self.dbtable.lft node.rgt).update(lft = self.dbtable.lft - delta) self.db(self.dbtable.rgt node.rgt).update(rgt = self.dbtable.rgt - delta) return node def remove_descendants(self, id): node = self.dbtable[id] delta = node.rgt - node.lft + 1 q1 = self.dbtable.lft node.lft q2 = self.dbtable.rgt node.rgt self.db(q1)(q2).delete() self.db(self.dbtable.lft node.rgt).update(lft = self.dbtable.lft - delta) self.db(self.dbtable.rgt node.rgt).update(rgt = self.dbtable.rgt - delta) def remove_tree(self, id): self.db(self.dbtable.root_id == id).delete() # # Methods for retrieving nodes # def roots(self): return self.db(self.dbtable.lft == 1).select() def tree(self, root_id): return self.db(self.dbtable.root_id == root_id).select(orderby = self.dbtable.lft) def ancestors(self, id): node = self.dbtable[id] q1 = self.dbtable.lft node.lft q2 = self.dbtable.rgt node.rgt q3 = self.dbtable.root_id == node.root_id return self.db(q1)(q2)(q3).select(orderby = self.dbtable.lft) def path(self, id): node = self.dbtable[id] q1 = self.dbtable.lft = node.lft q2 = self.dbtable.rgt = node.rgt q3 = self.dbtable.root_id == node.root_id return self.db(q1)(q2)(q3).select(orderby =
[web2py:32383] Amf service doesn't work
Hi, I am pretty new to web2py and ... need help :) I am trying this and works (json service) def call(): return service() @service.json def getList(): return db().select(db.classifieds.ALL) but with amf doesn't work def call(): return service() @service.amfrpc def getList(): return db().select(db.classifieds.ALL) in logs I found this message: Traceback (most recent call last): File gluon/restricted.py, line 178, in restricted File C:/Documents and Settings/Vasile/Desktop/web2py_win/web2py/ applications/info777/controllers/classifieds.py, line 21, in module File gluon/globals.py, line 102, in lambda File C:/Documents and Settings/Vasile/Desktop/web2py_win/web2py/ applications/info777/controllers/classifieds.py, line 1, in call File gluon/tools.py, line 2426, in __call__ File gluon/tools.py, line 2369, in serve_amfrpc File C:\Documents and Settings\Vasile\Desktop\web2py_win\web2py \pyamf\remoting\__init__.py, line 634, in decode File C:\Documents and Settings\Vasile\Desktop\web2py_win\web2py \pyamf\util\__init__.py, line 322, in read_uchar File C:\Documents and Settings\Vasile\Desktop\web2py_win\web2py \pyamf\util\__init__.py, line 298, in _read File C:\Documents and Settings\Vasile\Desktop\web2py_win\web2py \pyamf\util\__init__.py, line 646, in read IOError: Attempted to read 1 bytes from the buffer but only 0 remain --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---