[web2py] Re: jQuery UI tabs selected tab.
Hi Richard, Thanks for your reply. I tried in web2py_ajax.html: script type=text/javascript $(function(){ // Tabs $('#tabs').tabs(); $(.selector).tabs({selected: 3}); }); /script (for convenience I used the constant 3) ... and in the view I tried: script type=text/javascript var actual_day = {{=weekday}} $(.selector).tabs(option, selected, actual_day ); /script Neither of these solutions work. Do you have any idea why not? Hi Cliff, Thanks for your reply. You need landing areas for your data. That's what I thought, however, from the ajax example I learned I somehow don't need them. The plugin creates landing areas for every tab with the id set to: id=ui-tabs-1, id=ui-tabs-2 etc. Which in my case is quite convenient for all tabs but the last have the same content: class times for a specific day. So the controller and the view are rather simple: rows=db((db.lesrooster.bedrijf_id==1)(db.lesrooster.dag_id==request.args(0))).select(db.lesrooster.ALL,orderby=db.lesrooster.tijd) and the view a table with class times. Also note you don't need to use line continuation inside a tuple, list, or dictionary. URL doesn't need the list delimiters if there's only one arg. Thanks, I removed them all. Kind regards, Annet.
[web2py] CouchDB NoSQLAdapter.represent for datetime
Hi I am just testing the CouchDB Adapter and it fails when registering a new user. I tired both w2py's default auth and janrain. The problem appears to be the time_stamp field. - w2py Version 1.99.2 (2011-09-26 06:55:33) stable - driver CouchDB-0.8-py2.6.egg Traceback File /home/hcvst/web2py/gluon/dal.py, line 3510, in insert ctable.save(values) File /usr/local/lib/python2.6/dist-packages/CouchDB-0.8-py2.6.egg/ couchdb/client.py, line 407, in save _, _, data = func(body=doc, **options) File /usr/local/lib/python2.6/dist-packages/CouchDB-0.8-py2.6.egg/ couchdb/http.py, line 405, in put_json status, headers, data = self.put(*a, **k) File /usr/local/lib/python2.6/dist-packages/CouchDB-0.8-py2.6.egg/ couchdb/http.py, line 384, in put return self._request('PUT', path, body=body, headers=headers, **params) File /usr/local/lib/python2.6/dist-packages/CouchDB-0.8-py2.6.egg/ couchdb/http.py, line 419, in _request credentials=self.credentials) File /usr/local/lib/python2.6/dist-packages/CouchDB-0.8-py2.6.egg/ couchdb/http.py, line 239, in request resp = _try_request_with_retries(iter(self.retry_delays)) File /usr/local/lib/python2.6/dist-packages/CouchDB-0.8-py2.6.egg/ couchdb/http.py, line 196, in _try_request_with_retries return _try_request() File /usr/local/lib/python2.6/dist-packages/CouchDB-0.8-py2.6.egg/ couchdb/http.py, line 222, in _try_request chunk = body.read(CHUNK_SIZE) AttributeError: 'dict' object has no attribute 'read' DAL CODE (dal.py at line 3510) = def insert(self,table,fields): id = uuid2int(web2py_uuid()) ctable = self.connection[table._tablename] values = dict((k.name,NoSQLAdapter.represent(self,v,k.type)) for k,v in fields) values['_id'] = str(id) ctable.save(values) # line 3510 DRIVER CODE (..egg/couchdb/http.py in _try_request at line 222) if body is not None: if isinstance(body, str): conn.sock.sendall(body) else: # assume a file-like object and send in chunks while 1: chunk = body.read(CHUNK_SIZE) # line 222 BODY VARIABLE == {'_id': '156782505411822007491552899341462059095', 'client_ip': u'127.0.0.1', 'description': u'Group 128304130898558275345572010972780625739 created', 'origin': u'auth', 'time_stamp': datetime.datetime(2011, 10, 22, 3, 48, 48, 413381), 'user_id': None} The problem is probably that the BODY time_stamp attribute of type datetime cannot be JSON serialized but I don't know dal.py well enough to say what NoSQLAdapter.represent should return. Best regards, HC
[web2py] dal aggregation sum fields None
I am summing some data using the DAL: cash_price = db.orderline.cash_price.sum() lines = db(db.orderline.order_ == id).select(cash_price).first() However if there are no lines then lines[cash_price] is None. So I added: lines[cash_price]=lines[cash_price] or 0 But this does not work either. You have to do: lines[cash_price]=lines._extra[cash_price] or 0 This is OK as it works. But wouldn't it be better if the sum were 0 in the first place? Or if there is some logical reason for it to None then one should to be able to say: lines[cash_price]=lines[cash_price] or 0
[web2py] Help making nav menu work please!
Hey guys I am in the process of making an online store. My products are stored in the db with basic table. db.define_table('products', Field('MainCategory', 'string'), Field('SubCategory', 'string'), Field('Title', 'string'), Field('Price', 'double'), Field('image', 'upload', uploadfield='image_field'), Field('image_field', 'blob') ) Every product has a main category and a subcategory. for the means of a simple example lets say ANIMAL is a main category, CAT and DOG are subcategories. In my view I have a jQuery accordion style navigation menu that has my MainCategory and under them their SubCategories. I need the navigation menu to take the MainCategory and the SubCategory and then query the DB to select only the products that belong to those categories. Then loop through the results placing them in a table in a div of my page. I have no troubles setting everything statically to achieve what I want to do. But I would love to setup a function that i can pass arguments to to achieve the desired results. So that the website is easily expandable in the future. Thank you in advance to anyone that helps me out I will be forever greatful!
Re: [web2py] dal aggregation sum fields None
for me it is a case for coalesce in pure SQL. I know dal offers coalesce support but I did not try yet. http://zerp.ly/rochacbruno Em 22/10/2011 09:47, apple simo...@gmail.com escreveu: I am summing some data using the DAL: cash_price = db.orderline.cash_price.sum() lines = db(db.orderline.order_ == id).select(cash_price).first() However if there are no lines then lines[cash_price] is None. So I added: lines[cash_price]=lines[cash_price] or 0 But this does not work either. You have to do: lines[cash_price]=lines._extra[cash_price] or 0 This is OK as it works. But wouldn't it be better if the sum were 0 in the first place? Or if there is some logical reason for it to None then one should to be able to say: lines[cash_price]=lines[cash_price] or 0
[web2py] Re: dal aggregation sum fields None
On Saturday, October 22, 2011 7:47:08 AM UTC-4, apple wrote: I am summing some data using the DAL: cash_price = db.orderline.cash_price.sum() lines = db(db.orderline.order_ == id).select(cash_price).first() However if there are no lines then lines[cash_price] is None. So I added: lines[cash_price]=lines[cash_price] or 0 But this does not work either. You have to do: lines[cash_price]=lines._extra[cash_price] or 0 This is OK as it works. But wouldn't it be better if the sum were 0 in the first place? Or if there is some logical reason for it to None then one should to be able to say: lines[cash_price]=lines[cash_price] or 0 I don't think you necessarily want it to default to 0 whenever no records are found, as you might want to distinguish between that case (None) and when there are records but the sum is truly 0. However, it would be nice if the assignment above worked without needing to refer to _extra. Anthony
[web2py] Re: Foreign key name getting other value, images app
Check out http://web2py.com/book/default/chapter/06#Record-Representation. Perhaps the format argument of the image table is set to %(title)s, which will display the title of the referenced image record rather than the id in dropdowns and tables. Anthony On Saturday, October 22, 2011 12:40:41 AM UTC-4, Paul wrote: When I use appadmin to display the COMMENT table, the comment.image_id field displays the title field from the image table. Looking in sql.log, I see that comment.image_id is an integer referencing image.id. image_id INTEGER REFERENCES image(id) ON DELETE CASCADE, I was expecting to see the integer id value, but the text of the title field is displayed. How/why does the comment.image_id field display the text of title? What in db.py connects those two?
[web2py] Registration Password
Why is password not a required field in registration? I just found that if you don't enter a password, you can't login, even though registration was successful. Apparently, login will not accept an empty password. Richard
[web2py] Re: Registration Password
Actually, by default, Auth requires a password of at least 4 characters, which is enforced by the CRYPT validator. If you enter 1-3 characters, you'll get an error. However, it you leave it blank, it appears that CRYPT will automatically insert a uuid as the password (I'm not sure why). If you want to allow empty passwords (probably not), you can do: auth.settings.password_min_length = 0 If you want to enforce a minimum length but ensure an empty password isn't submitted, you can probably do: auth.settings.table_user[auth.settings.password_field].requires.insert(0, IS_NOT_EMPTY()) or auth.settings.table_user[auth.settings.password_field].requires.insert(0, IS_STRONG(...)) That will insert a validator before the CRYPT validator to make the sure the password isn't empty or satisfies some minimal requirements. Anthony On Saturday, October 22, 2011 9:11:02 AM UTC-4, horridohobbyist wrote: Why is password not a required field in registration? I just found that if you don't enter a password, you can't login, even though registration was successful. Apparently, login will not accept an empty password. Richard
[web2py] How to port this simple game to a web2py app?
Hi Group, I've been looking for an excuse to get started with web and python. Finally I thought up this little game for a friend, but how to port it to web2py? The game is like one of those old adventure books. There is a story, but at some point the player must decide on an action. For each option the story then forks. this happens again and again, until the story finishes, one way or the other. (actually in this particular case we are writing a poem... But the principle is the same). This game is being built for my friends birthday party. The plan is to have each of the attending friends each write three chapters of the story. The script assumes that the friends will upload / mail me the chapters as a yaml file. The yaml template looks like this. ChapterTitel: Whatever # The title is not really used in this version. txt: | # Write chapter text below. The text must be indented This is the chapter text. Notice the first line is indented? And so forth. You can make paragraphs, and what ever you like. Just keep the text indented. Option: a: option_txt: Write option one next: option_file_name.yaml #the name of the next chapter (file name) b: option_txt: Option two next: fantastic_option_yes.yaml c: option_txt: You get the idea... next: You_got_right.yaml #dont use spaces or weird punctuation in file names This is the script. I am sure it can and should be improved in countless ways. Please tell me which :-) from sys import exit import yaml class Spil(object): def __init__(self,start=start.yaml): self.start = start def play(self): next = self.start while True: print \n next = self.show_poem(next) def show_poem(self,next): with open(next) as digt: digt = yaml.load(digt) print(digt[txt]) print(-\n) print(A +digt[option][a][option_txt]) print(B +digt[option][b][option_txt]) print(C +digt[option][c][option_txt]) user = raw_input(What do you choose (A, B or C)? ).lower() if user in [a,b,c]: next = digt[option][user][next] if next == end.yaml: print(Finished :-) Thanks for playing :-)) exit(1) else: return next I hope that makes sense. Now to my question. What would be the best strategy to move move forward here? In the terminal it works fine, but I guess each new part of the story must be presented as a new html page? Prefereable I'd like to show each new chapter as an extension of the first, so that the player can see the story as one whole. And preferable with out a new page loading... How ever - simplicity is priority number one. So how to display the next chapter, and how to collect user input? Would it be better to use a database than yaml files? Should I make a webform to collect stories instead of asking people to mail me the yaml files? This is completely new for me. But I guess the task it simple. So for starters I hope to get some advice about good practice and maybe specific pointers to relevant sections/chapters in the web2py book. E.g if I need to make a new web page for each html, I need to create that dynamically? Sincerely and thanks in advance, Andreas
[web2py] Re: RIA Framework Recomendation
No flex!! Nor Silverlight...:(( I think the standard Javascript/html5 is the right direcction you have to looking for.. On 22 oct, 00:10, Ialejandro ialejandr...@gmail.com wrote: Hi everyone!! This time, I really need your help. I need to build a true RIA with web2py, we have several intranet applications running with web2py. I must unify them and make them look like this: http://dev.sencha.com/deploy/ext-4.0.0/examples/sandbox/sandbox.html we need real time charts, drag drop operations.. well a true RIA. The question is what should I use? The only restriction is time, I need something that really works with web2py and something fast. I've been searching and I found several frameworks, such as ExtJS, Qooxdoo, pyjamas... even flex.. Sincerely, what do you recomend me? Thank You!
[web2py] Re: Foreign key name getting other value, images app
Anthony, many thanks. I see that it is the image table format = '%(title)s that causes this to display. I originally though it was the constraint db.comment.image_id.requires line with specified '%(title)s', but it does not seem to be. Thank you for your help along this path. My apologies for such trivial beginner questions.
Re: [web2py] Re: RIA Framework Recomendation
arguments for flex: - layouts: horizontal, vertical, absolute, circular etc - lots of ready components (titlewindow, datagrid, charts, form elements, ) - easy skinning (fxg - via flash cs tools) - no cross browser issues - flash ubiquity including mobile devices
Re: [web2py] Re: RIA Framework Recomendation
What you said will be true 5 years ago , and i would say the same if I haven't wrote an app in Qooxdoo. On 10/22/11, Vasile Ermicioi elff...@gmail.com wrote: if your only restriction is time then go with flex, you will be able to export your app as a native iphone app, will work on browser via flash and on android, desktops (linux, win, mac) via adobe air developing with html5 is not trivial, I agree that there are awesome jquery plugins, but developing with drag drop and drawing is not the way to go with html5 also with html5 you can have cross browser issues for web2py you can use remoteobject with @servise.amf3rpc I have kind of cms in flex (administration part) for my website ( http://www.fermer.md) and it works great with web2py and pyamf http://dev.sencha.com/deploy/ext-4.0.0/examples/sandbox/sandbox.html this looks like a desktop app, and flex is used both for RIA (flash) and desktop (AIR)
Re: [web2py] Re: RIA Framework Recomendation
What you said will be true 5 years ago ie7 still the most used browser so it still true the only restriction is time, so I still advise flex, it is a proved technology 1) best argument for flex is why people use flex over pure as3 qooxdoo have many good things, but it is like coding in pur actionscript 3 flex is a markup language, you do youre UI in declarative way 2) tooling for flex u can use flashdevelop with flexsdk and u can do ur UI in flash builder using designer mode 3) no easy skinning for qooxdoo, please prove me wrong
Re: [web2py] Re: RIA Framework Recomendation
mxml is a markup language: flex = mxml+as3
Re: [web2py] Re: RIA Framework Recomendation
Yes i have build a Webcam chat side like chatroulette in MXML +AS3 + Red5 and i hated it. WIth qooxdoo , theres ZERO need for HTML / any markup at all. On 10/23/11, Vasile Ermicioi elff...@gmail.com wrote: mxml is a markup language: flex = mxml+as3
Re: [web2py] Re: RIA Framework Recomendation
seems you miss the beauty of flex: binding, layout and user interface in mxml and logic in as3 I don't want to argue, this man asked for recommendation, I told him my point
Re: [web2py] Re: RIA Framework Recomendation
I just venting my opinion too :). Take it easy. On 10/23/11, Vasile Ermicioi elff...@gmail.com wrote: seems you miss the beauty of flex: binding, layout and user interface in mxml and logic in as3 I don't want to argue, this man asked for recommendation, I told him my point
Re: [web2py] Re: RIA Framework Recomendation
I love AS3 a lot but i just hate MXML. Theres no really need for that markup language at all. On 10/23/11, Phyo Arkar phyo.arkarl...@gmail.com wrote: I just venting my opinion too :). Take it easy. On 10/23/11, Vasile Ermicioi elff...@gmail.com wrote: seems you miss the beauty of flex: binding, layout and user interface in mxml and logic in as3 I don't want to argue, this man asked for recommendation, I told him my point
[web2py] Getting Too many tables error on GAE , HELP!
def get_totals(): response.generic_patterns = ['json'] query=(db.item.id==db.sale.id_items) total_price = 0 total_cost = 0 total_items = 0 rows = db(query).select(db.item.base_price,db.item.price,db.sale.total_items) for r in rows: total_price += r.item.price * r.sale.total_items total_cost += r.item.base_price * r.sale.total_items total_items += r.sale.total_items profit = total_price - total_cost return dict(total_price = str(total_price) , total_profit = str(profit) , total_items = str(total_items)) This is waht i am doing. and i am getting this : Traceback (most recent call last): File /base/data/home/apps/s~herspos/1.354149753338895814/gluon/restricted.py, line 192, in restricted exec ccode in environment File /base/data/home/apps/s~herspos/1.354149753338895814/applications/HersPOS/controllers/default.py:get_totals, line 218, in module File /base/data/home/apps/s~herspos/1.354149753338895814/gluon/globals.py, line 145, in lambda self._caller = lambda f: f() File /base/data/home/apps/s~herspos/1.354149753338895814/applications/HersPOS/controllers/default.py:get_totals, line 168, in get_totals File /base/data/home/apps/s~herspos/1.354149753338895814/gluon/dal.py, line 5481, in select return self.db._adapter.select(self.query,fields,attributes) File /base/data/home/apps/s~herspos/1.354149753338895814/gluon/dal.py, line 3292, in select (items, tablename, fields) = self.select_raw(query,fields,attributes) File /base/data/home/apps/s~herspos/1.354149753338895814/gluon/dal.py, line 3240, in select_raw tablename = self.get_table(query) File /base/data/home/apps/s~herspos/1.354149753338895814/gluon/dal.py, line 1052, in get_table raise RuntimeError, Too many tables selected RuntimeError: Too many tables selected How to not use 2 tables to make a relationship ? Just no relationship at all GRR! ?
[web2py] Re: SQLFORM.grid / Powergrid
I appreciate all the help and leads. I wish I was at a point where I could adopt or add functionality to the widgets! but I am not there!! :-) I tried powergrid and was very impressed with it. It is indeed very very nice. Thanks again Dan On Oct 21, 8:02 pm, Bruno Rocha rochacbr...@gmail.com wrote: I created PowerTable and it has edit in place with Jquery Jeditable. but this project is frozen and I have not tested with new w2p version so I did not created any documentation. (someone wants to adopt it?) I also created PowerGrid and it is being developed (I have made a lot of improvements this week). SQLFORM.grid has more features than PowerGrid and I think .grid is better because it is under web2py core development. Althrough, PowerGrid is more flexible because it is fully Ajax JSON/JSONP and JQuery template based. The grid itself is all client side. the server only deal with JSON processing. PowerGrid uses a default json callback and you can write your own the way you want. It also has easy way to add buttons, modals and a customizable search also it is cacheable in client side. You can also create a blog or do any kind of pagination with it ( miaudota.com.br/blog) and (miaudota.com.br/prestacao-de-contas). I will some major changes to PowetGrid repo very soon. - user_signature as default - filtering by column - replace nyromodal with jqueryui - selectable with checkbox - and I will try to include Jeditable examples. but, it is made for the developer to maintain and create your own callbacks. (I only responsible for the client side code) if you want a powerful and solid grid system use the SQLFORM.grid and I think it is easy to add Jeditable to it. http://zerp.ly/rochacbruno Em 21/10/2011 21:26, greenpoise danel.sega...@gmail.com escreveu: This is great but is there a grid that I can do an edit in place of a field??? thanks dan On Oct 21, 6:56 am, Massimo Di Pierro massimo.dipie...@gmail.com wrote: On Oct 20, 11:07 pm, greenpoise danel.sega...@gmail.com wrote: I have a few questions regarding the grids. 1. Is SQLFORM.grid the implementation of Powergrid? No but was inspired but it meaning, does SQLFORM.grid has all the features of Powergrid? Not sure. martin should answer that. 2. Is there an option to edit a value on the fly rather than using an edit button? sort of like edit in place pyslice. No. because it uses no ajax. 3. Is search as you type an option (type ahead)? No. Thanks Dan
[web2py] Re: Getting Too many tables error on GAE , HELP!
Anyone get this problem? I am using web2py 1.98.2 on GAE . WHat is the work around for it? On 10/23/11, Phyo Arkar phyo.arkarl...@gmail.com wrote: def get_totals(): response.generic_patterns = ['json'] query=(db.item.id==db.sale.id_items) total_price = 0 total_cost = 0 total_items = 0 rows = db(query).select(db.item.base_price,db.item.price,db.sale.total_items) for r in rows: total_price += r.item.price * r.sale.total_items total_cost += r.item.base_price * r.sale.total_items total_items += r.sale.total_items profit = total_price - total_cost return dict(total_price = str(total_price) , total_profit = str(profit) , total_items = str(total_items)) This is waht i am doing. and i am getting this : Traceback (most recent call last): File /base/data/home/apps/s~herspos/1.354149753338895814/gluon/restricted.py, line 192, in restricted exec ccode in environment File /base/data/home/apps/s~herspos/1.354149753338895814/applications/HersPOS/controllers/default.py:get_totals, line 218, in module File /base/data/home/apps/s~herspos/1.354149753338895814/gluon/globals.py, line 145, in lambda self._caller = lambda f: f() File /base/data/home/apps/s~herspos/1.354149753338895814/applications/HersPOS/controllers/default.py:get_totals, line 168, in get_totals File /base/data/home/apps/s~herspos/1.354149753338895814/gluon/dal.py, line 5481, in select return self.db._adapter.select(self.query,fields,attributes) File /base/data/home/apps/s~herspos/1.354149753338895814/gluon/dal.py, line 3292, in select (items, tablename, fields) = self.select_raw(query,fields,attributes) File /base/data/home/apps/s~herspos/1.354149753338895814/gluon/dal.py, line 3240, in select_raw tablename = self.get_table(query) File /base/data/home/apps/s~herspos/1.354149753338895814/gluon/dal.py, line 1052, in get_table raise RuntimeError, Too many tables selected RuntimeError: Too many tables selected How to not use 2 tables to make a relationship ? Just no relationship at all GRR! ?
Re: [web2py] Re: RIA Framework Recomendation
On Saturday, October 22, 2011 3:38:10 PM UTC-4, elffikk wrote: ie7 still the most used browser so it still true http://marketshare.hitslink.com/browser-market-share.aspx?qprid=2qpcustomd=0 http://www.w3counter.com/globalstats.php?year=2011month=9 http://www.getclicky.com/marketshare/global/web-browsers/internet-explorer/
[web2py][GAE]BadValueError: Incomplete key found for reference property
Here is another GAE error: While i am doing this : def get_items(): response.generic_patterns = ['json'] query=(db.item.id=0) #out=[{name: Fusion Noodle}, {name: Burger Jumbo}, {name: Sushi}] return response.json(db(query).select(db.item.id,db.item.name)) I get: Traceback (most recent call last): File /base/data/home/apps/s~herspos/1.354149753338895814/gluon/restricted.py, line 192, in restricted exec ccode in environment File /base/data/home/apps/s~herspos/1.354149753338895814/applications/HersPOS/controllers/default.py:get_items, line 218, in module File /base/data/home/apps/s~herspos/1.354149753338895814/gluon/globals.py, line 145, in lambda self._caller = lambda f: f() File /base/data/home/apps/s~herspos/1.354149753338895814/applications/HersPOS/controllers/default.py:get_items, line 160, in get_items File /base/data/home/apps/s~herspos/1.354149753338895814/gluon/dal.py, line 5481, in select return self.db._adapter.select(self.query,fields,attributes) File /base/data/home/apps/s~herspos/1.354149753338895814/gluon/dal.py, line 3296, in select for item in items] File /base/python_runtime/python_lib/versions/1/google/appengine/ext/db/__init__.py, line 2029, in __iter__ return self.run() File /base/python_runtime/python_lib/versions/1/google/appengine/ext/db/__init__.py, line 2012, in run raw_query = self._get_query() File /base/python_runtime/python_lib/versions/1/google/appengine/ext/db/__init__.py, line 2376, in _get_query _app=self._app) File /base/python_runtime/python_lib/versions/1/google/appengine/api/datastore.py, line 1328, in __init__ self.update(filters) File /base/python_runtime/python_lib/versions/1/google/appengine/api/datastore.py, line 1783, in update self.__setitem__(filter, value) File /base/python_runtime/python_lib/versions/1/google/appengine/api/datastore.py, line 1726, in __setitem__ datastore_types.ValidateProperty(' ', value, read_only=True) File /base/python_runtime/python_lib/versions/1/google/appengine/api/datastore_types.py, line 1478, in ValidateProperty prop_validator(name, v) File /base/python_runtime/python_lib/versions/1/google/appengine/api/datastore_types.py, line 1392, in ValidatePropertyKey 'Incomplete key found for reference property %s.' % name) BadValueError: Incomplete key found for reference property
Re: [web2py] Re: RIA Framework Recomendation
Wow Nice statistics! So IE have 80% market share is no longer true! GG! On Sun, Oct 23, 2011 at 3:09 AM, Anthony abasta...@gmail.com wrote: On Saturday, October 22, 2011 3:38:10 PM UTC-4, elffikk wrote: ie7 still the most used browser so it still true http://marketshare.hitslink.com/browser-market-share.aspx?qprid=2qpcustomd=0 http://www.w3counter.com/globalstats.php?year=2011month=9 http://www.getclicky.com/marketshare/global/web-browsers/internet-explorer/
[web2py] DAL total record count
hello one and all, i think this is easy. how do you get the actual record/row total/ count for a particular table in web2py under DAL? thank you in advance and have a great weekend. lucas
Re: [web2py] Re: RIA Framework Recomendation
as you see ie6+ie7+ie8 is about 1/3 of the market I use html (including html5) only for websites: widescreen, tablets, or phones here goes jquery co I use flex for administration, drag drop and/or other interactive parts we need real time charts, drag drop operations.. well a true RIA this sounds to me like flex and nothing else
Re: [web2py] DAL total record count
query=(db.item.id0) db(query).count() On 10/23/11, lucas sjluk...@gmail.com wrote: hello one and all, i think this is easy. how do you get the actual record/row total/ count for a particular table in web2py under DAL? thank you in advance and have a great weekend. lucas
Re: [web2py] DAL total record count
Now you can also do db(db.item) instead of db(db.item.id0), so db(db.item).count(). You can also use count() as an aggregate function in a select, as described here: http://web2py.com/book/default/chapter/06#Grouping-and-Counting. If you just need to check whether a table is empty, a more efficient method is db(db.item).is_empty(). Anthony On Saturday, October 22, 2011 6:25:02 PM UTC-4, Phyo Arkar wrote: query=(db.item.id0) db(query).count() On 10/23/11, lucas sjlu...@gmail.com wrote: hello one and all, i think this is easy. how do you get the actual record/row total/ count for a particular table in web2py under DAL? thank you in advance and have a great weekend. lucas
[web2py] Re: Getting Too many tables error on GAE , HELP!
So because of join operation , it have problem with DAL over GAE right? What is recommend work around for one to many relationship ? Just use single table? That gonna be awful.. On 10/23/11, Phyo Arkar phyo.arkarl...@gmail.com wrote: Anyone get this problem? I am using web2py 1.98.2 on GAE . WHat is the work around for it? On 10/23/11, Phyo Arkar phyo.arkarl...@gmail.com wrote: def get_totals(): response.generic_patterns = ['json'] query=(db.item.id==db.sale.id_items) total_price = 0 total_cost = 0 total_items = 0 rows = db(query).select(db.item.base_price,db.item.price,db.sale.total_items) for r in rows: total_price += r.item.price * r.sale.total_items total_cost += r.item.base_price * r.sale.total_items total_items += r.sale.total_items profit = total_price - total_cost return dict(total_price = str(total_price) , total_profit = str(profit) , total_items = str(total_items)) This is waht i am doing. and i am getting this : Traceback (most recent call last): File /base/data/home/apps/s~herspos/1.354149753338895814/gluon/restricted.py, line 192, in restricted exec ccode in environment File /base/data/home/apps/s~herspos/1.354149753338895814/applications/HersPOS/controllers/default.py:get_totals, line 218, in module File /base/data/home/apps/s~herspos/1.354149753338895814/gluon/globals.py, line 145, in lambda self._caller = lambda f: f() File /base/data/home/apps/s~herspos/1.354149753338895814/applications/HersPOS/controllers/default.py:get_totals, line 168, in get_totals File /base/data/home/apps/s~herspos/1.354149753338895814/gluon/dal.py, line 5481, in select return self.db._adapter.select(self.query,fields,attributes) File /base/data/home/apps/s~herspos/1.354149753338895814/gluon/dal.py, line 3292, in select (items, tablename, fields) = self.select_raw(query,fields,attributes) File /base/data/home/apps/s~herspos/1.354149753338895814/gluon/dal.py, line 3240, in select_raw tablename = self.get_table(query) File /base/data/home/apps/s~herspos/1.354149753338895814/gluon/dal.py, line 1052, in get_table raise RuntimeError, Too many tables selected RuntimeError: Too many tables selected How to not use 2 tables to make a relationship ? Just no relationship at all GRR! ?
Re: [web2py][GAE]BadValueError: Incomplete key found for reference property
what's the model? what version of web2py are you using?
[web2py] Re: Getting Too many tables error on GAE , HELP!
the default datastore for GAE is a NOSQL system of key-value pairs. it does not have the full concept of referenced tables, and does not support a join operation. your options are to flatten your schema, putting all the necessary data in a single record rather than splitting it into many table, or to query the first table and then query the second table for the items referenced. I use a combination of both. if you are not in a hurry, sign up for the beta access to SQL on GAE (my invite was not yet approved so i have not used it yet). Massimo says it's great. :) cfh
Re: [web2py] Re: Getting Too many tables error on GAE , HELP!
Oh Hell, To join programatically!! Ewww!! Finally bad (relational) database designs are gonna look good in GAE,, I think i am gonna brainwash myself and Jump onto NoSQL Bandwagon too On Sun, Oct 23, 2011 at 5:46 AM, howesc how...@umich.edu wrote: the default datastore for GAE is a NOSQL system of key-value pairs. it does not have the full concept of referenced tables, and does not support a join operation. your options are to flatten your schema, putting all the necessary data in a single record rather than splitting it into many table, or to query the first table and then query the second table for the items referenced. I use a combination of both. if you are not in a hurry, sign up for the beta access to SQL on GAE (my invite was not yet approved so i have not used it yet). Massimo says it's great. :) cfh
Re: [web2py][GAE]BadValueError: Incomplete key found for reference property
I am using 1.98.2 here is my model : db.define_table(item, SQLField(name, text, length=512, notnull=True, default=None), SQLField(base_price, integer, notnull=True, default=None), SQLField(price, integer, notnull=True, default=None) ) Table definition from datetime import date import time db.define_table(sale, SQLField(id_items, db.item), SQLField(date, date, notnull=True, default=date.today()), SQLField(sale_time, datetime, notnull=True, default=request.now), SQLField(total_items, integer, notnull=True, default=None), SQLField(description, text, notnull=False, default=None)) On Sun, Oct 23, 2011 at 5:43 AM, howesc how...@umich.edu wrote: what's the model? what version of web2py are you using?
[web2py] HersPOS - New Version released 0.03 Web2py + Qooxdoo POS
New Features : -FIltering by date -Added tabs and seperated items tables / Sales table. -Demo avaliable on Gae , partially workling (No Sales Table working but Item table works). Due to no join avaliable , please suggest me a work around. Thanks Phyo.
[web2py] Re: Web2py and Rest
there is a video tutorial and a post by Massimo on reddit showing how to use this feature, I was not able to make post request but used @services.run to make post requests. The book covers section on services but not the @restful feature. On Oct 21, 12:53 pm, BrendanC bren...@gmail.com wrote: I know this has probably come up before, but I'd like to get my head around the options to use Restful URLs with Web2py. Are there any (recent) docs I can reference? I know there are some old threads, but would like to get an idea where things stand currently. (BTW - I'm not totally sold on rest, but restful url design seems to have captured a lot of mindshare with developers (possibly due to rails support) and seems to be a potential issue when choosing a webframework for a new project. Maybe this is something that could be added to the faq. Brendan
[web2py] Ajax question: In a controller, how do I format data by a view so that I can return HTML from the controller back to ajax function?
Hi all, I need some help please. I have a function/controller which is called by ajax calls. In the function I want to get some data from a model, format the data into html, and then return the HTML. It makes sense that I should be able to pass the model data to a view and then pass the html from the view back to the ajax function. I cant work out how to do this. This is what I would expect to happen: Ajax call to controller -- Controller gets data from model -- controller passes data to view -- View does its thing and passes back HTML to controller (rather than the browser) -- controller returns the HTML to the ajax call. Any help on this would be appreciated. Thanks,
[web2py] Re: a couple of related questions
About [1] the user_signature=True is default but the signature only works if you are logged in. I do not understand [2] On Oct 20, 9:40 pm, niknok nikolai...@gmail.com wrote: I have a person table[1] with a parent field with a clickable representation view of the record. If I put this on a grid and click on the link, I get a not authorized error message. I thought I need to pass the signature so I can make it viewable. (This works fine if parameter user_signature=False) Also, I have defined a default representation for the person table but in my validation statement, note that I had to specify the same format again. I'm wondering if there's a way to tell the validator to use the default representation of the person (which I thought was web2py's default behavior.) In my grid, I specified a new button [2] in the links parameter, how do I specificy an icon for this button? For example I want to use what's already in base.css (book, heart, cross etc.) /r Nik [1] db.define_table('person' ,Field('birth_date', 'date', requires=IS_DATE()) ,Field('last_name', notnull=True) ,Field('given_name', notnull=True) ,Field('parent', 'list:reference person' ,requires=IS_EMPTY_OR(IS_IN_DB(db, 'person.id' ,'%(last_name)s, %(given_name)s [%(birth_date)s]' ,multiple=True ,zero=T('pick one'))) ,represent = lambda value, row: [A(' ▸'+ db.person[v].given_name , _href = URL('index/view/person', args=[v])) for v in value]) ,auth.signature ,format='%(last_name)s, %(given_name)s [%(birth_date)s]' ) [2] form=SQLFORM.grid( db.person ,fields=[db.person.id, db.person.last_name, db.person.given_name ,db.person.middle_name, db.person.gender, db.person.birth_date, db.person.parent] ,showbuttontext=False ,sorter_icons=('[▴]','[▾]') ,onvalidation=person_processing ,links = [lambda row: A('X', _href=URL(args=[view, db.person, row.id] ))] )
Re: [web2py] Re: RIA Framework Recomendation
Usage of browsers is next /for September 2011/ IE - 51% Firefox - 21% Chrome - 15% Safari - 8% others - 5% Browsers from mobile devices are 10% and 90% from notebook and net-book ... - - Miroslav Gojic - - On Sun, Oct 23, 2011 at 00:02, Vasile Ermicioi elff...@gmail.com wrote: as you see ie6+ie7+ie8 is about 1/3 of the market I use html (including html5) only for websites: widescreen, tablets, or phones here goes jquery co I use flex for administration, drag drop and/or other interactive parts we need real time charts, drag drop operations.. well a true RIA this sounds to me like flex and nothing else
Re: [web2py] Re: RIA Framework Recomendation
On my last post I was use data from Wikipedia but on next link statistics are different 2011 Internet Explorer Firefox Chrome Safari Opera September 22.9 % 39.7 %30.5 % 4.0 % 2.2 % August 22.4 % 40.6 %30.3 % 3.8 % 2.3 % http://www.w3schools.com/browsers/browsers_stats.asp - - Miroslav Gojic - - + 381 64 014 8868 On Sun, Oct 23, 2011 at 07:26, Miroslav Gojic miroslavgo...@gmail.com wrote: Usage of browsers is next /for September 2011/ IE - 51% Firefox - 21% Chrome - 15% Safari - 8% others - 5% Browsers from mobile devices are 10% and 90% from notebook and net-book ... - - Miroslav Gojic - - On Sun, Oct 23, 2011 at 00:02, Vasile Ermicioi elff...@gmail.com wrote: as you see ie6+ie7+ie8 is about 1/3 of the market I use html (including html5) only for websites: widescreen, tablets, or phones here goes jquery co I use flex for administration, drag drop and/or other interactive parts we need real time charts, drag drop operations.. well a true RIA this sounds to me like flex and nothing else