[web2py] Virtual Fields not working on print.
I have this in the model... import uuid import os import pygeoip gi = pygeoip.GeoIP(os.path.join(request.folder, 'private', 'GeoIP.dat')) def get_country(row): return gi.country_code_by_addr(row.from_where) # -*- coding: utf-8 -*- db.define_table('melodigram_play', Field('melodigram_id', 'reference melodigram'), Field('when_opened', 'datetime', default = request.now), Field('from_where', 'string', default = request.client), Field.Virtual('from_country', lambda row: get_country(row)) ) db.melodigram_play.melodigram_id.requires = IS_NOT_EMPTY() db.melodigram_play.when_opened.requires = IS_NOT_EMPTY() I can insert data... but when I try to retrieve it, it tells me the row doesn't exist: h2From: {{=gram_details.from_where}} : {{=gram_details.from_country}}/h2 gram_details.from_where has always worked. gram_details.from_country doesn't work. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: creating a model of a table (with a large amount of data) in a mysql db. is taking a very long time
Hi Anthony, thanks very much for your reply. I am able to now create the models ok. However when selecting specific tables in the mysql database web2py seems to hang. What I don't understand is that web2py seems to hang for tables using a field name 'datetime' which is a decimal(13,0) UN PK. Could it be that web2py gets confused by the fieldname called datetime? example of table in mysql db : Tablename: evth Fieldname Type datetime decimal(13,0) UN PK eventid varchar(5) stream smallint(5) UN application varchar(11) workstation varchar(11) severity enum('INFORMATION','WARNING','ERROR', 'FATAL') typeenum('SYSTEM','SOFTWARE','MIB','LOG') message varchar(432) PK thanks again for your help! John On Tuesday, February 18, 2014 5:23:38 PM UTC+1, Anthony wrote: The amount of data doesn't affect how long it takes the appadmin home page to load, as no data are being pulled from the database at that point. Even when you do select a specific table, it only loads the first 100 records, so again, nothing should hang. Note, defining the model of the table (as in your code below) doesn't actually pull any of the data from the database -- it just tells web2py about the structure of the database table so it knows how to make selects, updates, inserts, etc. Anthony On Tuesday, February 18, 2014 11:15:06 AM UTC-5, John Philip wrote: Hi there, I am trying to access a mysql database table with a very large amount of data. dbsql = DAL('mysql://myusername:mypasswrd@host/dbname', migrate=False) dbsql.define_table('evth', Field('datetime', 'integer'), Field('eventid','text'), Field('stream','integer'), Field('application','text'), Field('workstation','text'), Field('severity','text'), Field('type','text'), Field('message','text'), primarykey=['datetime']) In theory this should work. However when I run the database administration button to create the models it seems to hang. I suspect because of the amount of data. Since I am only interested in the most recent data is there anyway of doing this without web2py having to model the entire table? any help would be much appreciated. many thanks and regards, John -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] How can I run postgresql VACUUM from web2py?
it's related to how postgresql handles transaction and how dbapi by default adopts an in-transaction that clashes with what postgresql expects for vacuum jobs since it's not related to web2py, you can google it :P http://stackoverflow.com/questions/1017463/postgresql-how-to-run-vacuum-from-code-outside-transaction-block -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Virtual Fields not working on print.
Can you upload your app? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Version Control advice
Well, I'm not very sophisticated but I have separate git repositories per app, I can't any advantages in having one repository for everything. On Wednesday, 19 February 2014 12:13:13 UTC+11, Carlos Zenteno wrote: Do you guys version control just the /applications directory or the whole web2py tree? What is better for auto-deployment when pushing to the production repo? Thanks... -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Virtual Field Problem
First, I'd make sure you are successfully selecting the record you think you are selecting, and there is no harm in being verbose until it works. For example, you might try: my_row = db(personal_data.uid == auth.user_id).select().first() response.flash = my_row.age if that seems to work, response.flash = db(personal_data.uid == auth.user_id).select().first().age (such code works) but this db.personal_data(uid=auth.user.id) doesn't select a record. Have a look again at http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Shortcuts -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] A query too far? Inner join with group by...
Hi Derek -- Thanks for your response. I had considered your approach, but just declaring min() for every column does not return the values I need. Take for example the min time and the minimum meet name. Yes, I could get the lexical minimum of a character string that represents the meet at which the best time was recorded -- only it wouldn't be correct. The min(time) and min(meet_name) would have no relationship to one another -- they would be from completely different rows. That's why I must find the minimum time in one query, then use it to probe the entire table to find the full row it came from and read the other values. I've been pouring over the web looking for an alternative, but I just can't find one for my situation. Fortunately, I've been able to create a string and use executesql to get the query I need. It took some doing, but I managed to get the query into a single inner join and with proper indexing it is amazingly fast. I clocked it at about 20ms for a typical query on my data set. I was still able to make the result a proper Rows object and use SQLTABLE to style the output. Warm regards, Joe B. On Tuesday, February 18, 2014 11:53:19 AM UTC-8, Derek wrote: Joe, it seems to me all you need is this part here: select course, event_code, min(finals) as min_time from times where id_competitor= and finals0 group by course, event_code Or are you interested in returning other columns within the 'times' table? if so, just use min(other columns) in the query, no need for a derived table. So, in any case, web2py works a little differently. Taking the book example and modifying it, here's what I get... for row in db(db.times.competitor==).select( db.times.course, db.times.event_code, min_time, groupby=(db.times.course,db.times.event_code)): print row.times.course, row[min_time] What you need to do before that can work is to create the min_time operator... min_time = db.times.finals.min() oh, but you wanted to only select non negative numbers, and finals has some negatives in it... (add a where clause to the select) Good luck! -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] A query too far? Inner join with group by...
Hi Richard -- Well, it wasn't the solution I was originally thinking of, but you clued me into the solution that works. I used executesql and a big 'ol triple-quoted SQL string to get the query working. And the surprise (for me) was how easy it was to get the output into a Rows object where I could use the power of web2py to format the output for my view. The DAL is amazing and very broad in what it covers, but there are just certain corner-cases of SQL which will always elude it. I've decided that's a good thing. Software systems that try to do *everything* in a new paradigm tend to become so bloated with corner-cases that they lose their way. Our little web2py has such sparse beauty it would be a shame to see it try to turn into SQL part deux. Thanks for your help and for spending some of your thought-photons on my problem. -- Joe B. On Tuesday, February 18, 2014 6:59:45 AM UTC-8, Richard wrote: So... You seem to be ready for a stored procedure... Or you need to thought to your problem into more then one step, maybe having a view for the sub query... I was to porpose the multiple subquery, since your query is already slow, I would try this option, just to see if it couldn't be a bit faster... For slow query that for which I don't want to invest more time to create a function or stored procedure, I generally create a view and cache it with web2py... Richard -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: postgres beginner questions: passwords, peer authentication, dev/production
Thanks. I didn't know about fabric. Now I do, what a time saver. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Virtual Fields not working on print.
most likely get_country is failing for some reason Marin On Wed, Feb 19, 2014 at 9:40 AM, Jason Brower encomp...@gmail.com wrote: I have this in the model... import uuid import os import pygeoip gi = pygeoip.GeoIP(os.path.join(request.folder, 'private', 'GeoIP.dat')) def get_country(row): return gi.country_code_by_addr(row.from_where) # -*- coding: utf-8 -*- db.define_table('melodigram_play', Field('melodigram_id', 'reference melodigram'), Field('when_opened', 'datetime', default = request.now), Field('from_where', 'string', default = request.client), Field.Virtual('from_country', lambda row: get_country(row)) ) db.melodigram_play.melodigram_id.requires = IS_NOT_EMPTY() db.melodigram_play.when_opened.requires = IS_NOT_EMPTY() I can insert data... but when I try to retrieve it, it tells me the row doesn't exist: h2From: {{=gram_details.from_where}} : {{=gram_details.from_country}}/h2 gram_details.from_where has always worked. gram_details.from_country doesn't work. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Virtual Fields not working on print.
To try to triage the bug I did the following... import os import pygeoip #gi = pygeoip.GeoIP(os.path.join(request.folder, 'private', 'GeoIP.dat')) def get_country(row): return what? # -*- coding: utf-8 -*- db.define_table('melodigram_play', Field('melodigram_id', 'reference melodigram'), Field('when_opened', 'datetime', default = request.now), Field('from_where', 'string', default = request.client), Field.Virtual('from_country', lambda row: get_country(row)) ) db.melodigram_play.melodigram_id.requires = IS_NOT_EMPTY() db.melodigram_play.when_opened.requires = IS_NOT_EMPTY() --- Basically I just remove everything and returned a text object. This still gives me the same error. File /home/encompass/Projects/melodigram/web2py/applications/melodigram/views/administration/browser.html, line 101, in module File /home/encompass/Projects/melodigram/web2py/gluon/dal.py, line 7267, in __getitem__ raise ae AttributeError: 'Row' object has no attribute 'from_country' On Wednesday, February 19, 2014 1:47:45 PM UTC+2, Marin Pranjić wrote: most likely get_country is failing for some reason Marin On Wed, Feb 19, 2014 at 9:40 AM, Jason Brower enco...@gmail.comjavascript: wrote: I have this in the model... import uuid import os import pygeoip gi = pygeoip.GeoIP(os.path.join(request.folder, 'private', 'GeoIP.dat')) def get_country(row): return gi.country_code_by_addr(row.from_where) # -*- coding: utf-8 -*- db.define_table('melodigram_play', Field('melodigram_id', 'reference melodigram'), Field('when_opened', 'datetime', default = request.now), Field('from_where', 'string', default = request.client), Field.Virtual('from_country', lambda row: get_country(row)) ) db.melodigram_play.melodigram_id.requires = IS_NOT_EMPTY() db.melodigram_play.when_opened.requires = IS_NOT_EMPTY() I can insert data... but when I try to retrieve it, it tells me the row doesn't exist: h2From: {{=gram_details.from_where}} : {{=gram_details.from_country}}/h2 gram_details.from_where has always worked. gram_details.from_country doesn't work. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: SQLFORM.grid Search
I tried this. It returns empty on grid.element('#w2p_directory_keywords'). Not that it matters. I've decided to keep the Search function as is. On Monday, 17 February 2014 23:18:28 UTC-5, Anthony wrote: Note, if you don't want to create a new search widget but just want to remove the default Javascript widget and instead have a basic search input field, you can do: search_input = grid.element('#w2p_directory_keywords') search_input and search_input.attributes.pop('_onfocus') That simply removes the _onfocus event handler, which disables the Javascript functionality of the widget. Anthony On Monday, February 17, 2014 11:12:52 PM UTC-5, Anthony wrote: Yes. The searchable argument can be a callable that builds a query based on the keywords, and there is a search_widget argument you can use to generate a custom search widget. I suggest you check out the SQLFORM.grid code in gluon.sqlhtml to see how they work. Anthony On Monday, February 17, 2014 11:02:03 PM UTC-5, horridohobbyist wrote: I'm using SQLFORM.grid for my application. It's very powerful and saves me a lot of work. However, I would like to alter/customize the search function in the grid. Is there a way for me to do this? Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] REF: Boolean in MYSQL
I have noticed in web2py boolean is represented in mysql as Char(1) when boolean is defined in the DAL model as follow: db.define_table(test, Field(latest, boolean)) mysql field shows as follows: latest char(1) when i test a query in mysql db.executesql(select * from test where latest is true) is failing. Any ideas!? -- ... Teddy Lubasi Nyambe Opensource Zambia Lusaka, ZAMBIA Cell: +260 97 7760473 website: http://www.opensource.org.zm ~/ Human Knowledge belongs to the world! - AntiTrust Man is a tool-using animal. Without tools he is nothing, with tools he is all - Thomas Carlyle 1795-1881 /~ -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: SQLFORM.grid Search
Looks like it has been changed to #w2p_keywords. Anyway, it may be better to use the name attribute: grid.element(_name='keywords') Anthony On Wednesday, February 19, 2014 7:44:36 AM UTC-5, horridohobbyist wrote: I tried this. It returns empty on grid.element('#w2p_directory_keywords'). Not that it matters. I've decided to keep the Search function as is. On Monday, 17 February 2014 23:18:28 UTC-5, Anthony wrote: Note, if you don't want to create a new search widget but just want to remove the default Javascript widget and instead have a basic search input field, you can do: search_input = grid.element('#w2p_directory_keywords') search_input and search_input.attributes.pop('_onfocus') That simply removes the _onfocus event handler, which disables the Javascript functionality of the widget. Anthony On Monday, February 17, 2014 11:12:52 PM UTC-5, Anthony wrote: Yes. The searchable argument can be a callable that builds a query based on the keywords, and there is a search_widget argument you can use to generate a custom search widget. I suggest you check out the SQLFORM.grid code in gluon.sqlhtml to see how they work. Anthony On Monday, February 17, 2014 11:02:03 PM UTC-5, horridohobbyist wrote: I'm using SQLFORM.grid for my application. It's very powerful and saves me a lot of work. However, I would like to alter/customize the search function in the grid. Is there a way for me to do this? Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Virtual Fields not working on print.
In virtual field functions, you must refer to the table name and field name within each row object, so: return gi.country_code_by_addr(row.melodigram_play.from_where) should be: return gi.country_code_by_addr(row.from_where) That doesn't explain the problem below, but I wonder if something else is going on there (e.g., is the app compiled, and you didn't re-compile after making the change?). As an aside, if you already have a function, no need to wrap it in a lambda -- just do: Field.Virtual('from_country', get_country) Anthony On Wednesday, February 19, 2014 7:32:41 AM UTC-5, Encompass solutions wrote: To try to triage the bug I did the following... import os import pygeoip #gi = pygeoip.GeoIP(os.path.join(request.folder, 'private', 'GeoIP.dat')) def get_country(row): return what? # -*- coding: utf-8 -*- db.define_table('melodigram_play', Field('melodigram_id', 'reference melodigram'), Field('when_opened', 'datetime', default = request.now), Field('from_where', 'string', default = request.client), Field.Virtual('from_country', lambda row: get_country(row)) ) db.melodigram_play.melodigram_id.requires = IS_NOT_EMPTY() db.melodigram_play.when_opened.requires = IS_NOT_EMPTY() --- Basically I just remove everything and returned a text object. This still gives me the same error. File /home/encompass/Projects/melodigram/web2py/applications/melodigram/views/administration/browser.html, line 101, in module File /home/encompass/Projects/melodigram/web2py/gluon/dal.py, line 7267, in __getitem__ raise ae AttributeError: 'Row' object has no attribute 'from_country' On Wednesday, February 19, 2014 1:47:45 PM UTC+2, Marin Pranjić wrote: most likely get_country is failing for some reason Marin On Wed, Feb 19, 2014 at 9:40 AM, Jason Brower enco...@gmail.com wrote: I have this in the model... import uuid import os import pygeoip gi = pygeoip.GeoIP(os.path.join(request.folder, 'private', 'GeoIP.dat')) def get_country(row): return gi.country_code_by_addr(row.from_where) # -*- coding: utf-8 -*- db.define_table('melodigram_play', Field('melodigram_id', 'reference melodigram'), Field('when_opened', 'datetime', default = request.now), Field('from_where', 'string', default = request.client), Field.Virtual('from_country', lambda row: get_country(row)) ) db.melodigram_play.melodigram_id.requires = IS_NOT_EMPTY() db.melodigram_play.when_opened.requires = IS_NOT_EMPTY() I can insert data... but when I try to retrieve it, it tells me the row doesn't exist: h2From: {{=gram_details.from_where}} : {{=gram_details.from_country}}/h2 gram_details.from_where has always worked. gram_details.from_country doesn't work. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Virtual Field Problem
Should be: Field.Virtual('age', lambda row: diff_in_years(row.personal_data.dob)) Virtual field functions must reference the table name as well as the field name. Anthony On Tuesday, February 18, 2014 5:28:26 PM UTC-5, Leandro E. Colombo Viña wrote: Hi Guys! I've got a little problem trying to use Virtual Fields. I can't make them work. I follow the example in the book and nothing, I don't have a clue of what I'm doing wrong... The idea is to have a virtual field that calculates the age of the person based on his day of birth... Here is the model: db.define_table('personal_data', ., # another fields Field('dob', 'date', requires=IS_DATE()), ., # more fields auth.signature ) db.personal_data.age = Field.Virtual('age', lambda row: diff_in_years(row.dob)) Where the auxiliary function is: from dateutil import relativedelta as rdelta def diff_in_years(date): try: return rdelta.relativedelta(datetime.datetime.today().date(), date).years except: return None And here is my test controller: def prueba(): response.flash = db.personal_data(uid=auth.user.id).age The traceback says that Row doesn't have the attribute age. I've also tried with a method (Field.Method), with no luck. I always have the same error Any help would be appreciated! LEO -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: Angular.js And other js lib
Your question is vague... I suggest you to listen a couple of video on youtube about Angular.js... There is many talk about what the limitation you face using Angular.js and jQuery for instance, since Angular.js use a different paradigm at generating dom instead of manipulating it. So there is thing that works if you manipulate dom with angular and thing that don't work and make thing disconnected. I just start learning Angular so can't help you that much... Richard On Tue, Feb 18, 2014 at 8:39 PM, Arvind Gupta arvind.bernau...@gmail.comwrote: @derek and @richard if we have to create generic support of other javascript libraries, what are the efforts one have to make? On Wed, Feb 19, 2014 at 2:48 AM, Richard Vézina ml.richard.vez...@gmail.com wrote: Good point Derek, I saw it in angular.js file when I test the slice (that at least work), as you say it is a cleaner approach... :) Richard On Tue, Feb 18, 2014 at 4:01 PM, Derek sp1d...@gmail.com wrote: no, no, no, do not use that slice, it's a waste of time to edit the angular.js file itself. you want to do that every time a new version is released? also why not just use a cdn for angular.js? http://docs.angularjs.org/api/ng/provider/$interpolateProvider# startSymbol The above link shows how to do it properly. Here's a snippet from their 'sample' code... var customInterpolationApp = angular.module('customInterpolationApp', []); customInterpolationApp.config(function($interpolateProvider) { $interpolateProvider.startSymbol('//'); $interpolateProvider.endSymbol('//'); That changes the start and end symbols to '//' but you could just as easily change them to '[[' and ']]' or '||' and '||' or whatever you want. On Tuesday, February 18, 2014 1:19:14 PM UTC-7, Richard wrote: http://www.web2pyslices.com/slice/show/1922/web2py-angularjs Change angular {{ }} for {! !} Having to type to different character bug me though, but you need a closing tag... :( Richard On Tue, Feb 18, 2014 at 3:05 PM, Derek sp1...@gmail.com wrote: and to note you can change the brackets in angular to use something else... see here: http://docs.angularjs.org/api/ng/service/$interpolate by default it uses {{ and }} as starting and ending brackets. On Tuesday, February 18, 2014 12:59:48 PM UTC-7, Derek wrote: Well, the problem you have is that if you put angular tags in your views, they will be parsed with the template parser of web2py and error. The way to avoid that is to use the angular classes instead. For example, all the 'ng-app' and 'ng-controller' and 'ng-repeat' attributes ( http://docs.angularjs.org/tutorial/step_02). Keep in mind that the python template language will get parsed first, and only after that will the angular template parser be used. On Tuesday, February 18, 2014 12:49:42 PM UTC-7, Arvind Gupta wrote: Can we use angular.js with web2py, if yes can u point me to appropriate resources? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) -
Re: [web2py] A query too far? Inner join with group by...
:) Richard On Wed, Feb 19, 2014 at 6:35 AM, Joe Barnhart joe.barnh...@gmail.comwrote: Hi Richard -- Well, it wasn't the solution I was originally thinking of, but you clued me into the solution that works. I used executesql and a big 'ol triple-quoted SQL string to get the query working. And the surprise (for me) was how easy it was to get the output into a Rows object where I could use the power of web2py to format the output for my view. The DAL is amazing and very broad in what it covers, but there are just certain corner-cases of SQL which will always elude it. I've decided that's a good thing. Software systems that try to do *everything* in a new paradigm tend to become so bloated with corner-cases that they lose their way. Our little web2py has such sparse beauty it would be a shame to see it try to turn into SQL part deux. Thanks for your help and for spending some of your thought-photons on my problem. -- Joe B. On Tuesday, February 18, 2014 6:59:45 AM UTC-8, Richard wrote: So... You seem to be ready for a stored procedure... Or you need to thought to your problem into more then one step, maybe having a view for the sub query... I was to porpose the multiple subquery, since your query is already slow, I would try this option, just to see if it couldn't be a bit faster... For slow query that for which I don't want to invest more time to create a function or stored procedure, I generally create a view and cache it with web2py... Richard -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: expand_one not working
What is the HTML code generated in this case? Have you verified that you can successfully download the file in question at your URL? Anthony On Tuesday, February 18, 2014 11:08:57 AM UTC-5, sasogeek wrote: in db.py, the table status is defined as follows db.define_table( 'status', Field('status', 'text'), Field('file', 'upload'), Field('userid'), ) and in default.py, the download function is defined as def download(): allows downloading of uploaded files http:///[app]/default/download/[filename] return response.download(request, db) just like in the tutorial book. and in the views, i have this code {{from gluon.contrib.autolinks import expand_one}} ... {{updates=db().select(db.status.ALL, orderby=~db.status.id)}} {{if updates:}} {{for update in updates:}} {{=XML(expand_one(URL('download', args=update.file,),cache.ram('mycache',lambda:dict(),3600)))}} {{pass}} {{pass}} if update.file is an image, it works fine and the image is rendered just fine, but when it's a pdf, it doesn't work, I get this error Sorry, we were unable to find the document at the original source. Verify that the document still exists. You can also try to download the original document by clicking here When I click on the link that says here, it opens a google docs page in a new window with the same error statement in it how do i fix this? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Treat Datetime field as Date?
Really, the overcomplication is just for aesthetics, to avoid displaying 00:00:00 on forms and in the widget. The field settings I have seem to work well, so I'll just splat them into all necessary fields. On Saturday, February 15, 2014 1:27:30 PM UTC, Niphlod wrote: why the overcomplication ? as other backends that don't support date every date field in DAL gets turned to a datetime (with 0 hours, minutes and seconds) and it's automatically handled. On Wednesday, February 12, 2014 6:31:06 PM UTC+1, Tim Nyborg wrote: I'm connecting to an MSSQL 2005 db, which only has the Datetime format (Date was added in 2008). Is there a standard way to treat a Datetime as a Date in web2py for forms and formatting? I've done the following, and it works thus far, but it seems a bit hackish. Field('BirthDte', 'datetime', widget=SQLFORM.widgets.date.widget, requires=IS_DATE(), represent = lambda value, row: value.strftime(%#d %b %Y)) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] String-keyed tables, SQLFORM, and query shortcuts?
I'm connecting to a legacy MSSQL database, and have an important table which has an alphanumeric primary key: db.define_table('module', Field('modid', 'string'), ... primarykey=['modid']) When I generate an update SQLFORM (form = SQLFORM(db.module, index)), it generates an Object Not Found error unless the key happens to be an integer. Likewise, I can't do shortcut lookups a la db.module(index), but must use db(db.module.modid==index).select().first() Am I missing the correct method of using a string primary key, or is it always a problem in web2py? Adding a new autoincrement key to the module solves these, but there enough tables and legacy processes relying on the existing key that I can't possibly make a full switch. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] python web2py request encoding character in string
Hello, first salute all those who belong to this group and thanks in advance. I have a question that I've been trying to solve: I'm using web2py for a project and one of the drivers I have to detect the characters of a string as parameter to pick the url. The problem is that I need a text encoding latin1 ex: raíz. then I call: URL / application? Text = raíz text = request.vars.text return text = raíz return text[0] = r return text [2] =� when return the character string in the position, I returned that character, but return the entire string, encoding it well I try request.vars.text.decode('latin1') but return: return text [2] =Ã What solution can give me to show either that character? I need the number of encoding types with ord () but always goes 195 for any character with an accent, because it gives this error. excuse my writing, I'm Spanish, thanks! -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: REF: Boolean in MYSQL
db.executesql(select * from test where latest = 'T';) or better db(db.test.latest==True).select() On Wednesday, 19 February 2014 07:41:03 UTC-6, software.ted wrote: I have noticed in web2py boolean is represented in mysql as Char(1) when boolean is defined in the DAL model as follow: db.define_table(test, Field(latest, boolean)) mysql field shows as follows: latest char(1) when i test a query in mysql db.executesql(select * from test where latest is true) is failing. Any ideas!? -- ... Teddy Lubasi Nyambe Opensource Zambia Lusaka, ZAMBIA Cell: +260 97 7760473 website: http://www.opensource.org.zm ~/ Human Knowledge belongs to the world! - AntiTrust Man is a tool-using animal. Without tools he is nothing, with tools he is all - Thomas Carlyle 1795-1881 /~ -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: Angular.js And other js lib
There is enough buzz around Angular over net, I haven't program web2py also. I have to choose django vs web2py for a personal project, I m evaluating my options, Which is easy to get started, Angular or Jquery? -arvind On Wed, Feb 19, 2014 at 7:53 PM, Richard Vézina ml.richard.vez...@gmail.com wrote: Your question is vague... I suggest you to listen a couple of video on youtube about Angular.js... There is many talk about what the limitation you face using Angular.js and jQuery for instance, since Angular.js use a different paradigm at generating dom instead of manipulating it. So there is thing that works if you manipulate dom with angular and thing that don't work and make thing disconnected. I just start learning Angular so can't help you that much... Richard On Tue, Feb 18, 2014 at 8:39 PM, Arvind Gupta arvind.bernau...@gmail.comwrote: @derek and @richard if we have to create generic support of other javascript libraries, what are the efforts one have to make? On Wed, Feb 19, 2014 at 2:48 AM, Richard Vézina ml.richard.vez...@gmail.com wrote: Good point Derek, I saw it in angular.js file when I test the slice (that at least work), as you say it is a cleaner approach... :) Richard On Tue, Feb 18, 2014 at 4:01 PM, Derek sp1d...@gmail.com wrote: no, no, no, do not use that slice, it's a waste of time to edit the angular.js file itself. you want to do that every time a new version is released? also why not just use a cdn for angular.js? http://docs.angularjs.org/api/ng/provider/$interpolateProvider# startSymbol The above link shows how to do it properly. Here's a snippet from their 'sample' code... var customInterpolationApp = angular.module('customInterpolationApp', []); customInterpolationApp.config(function($interpolateProvider) { $interpolateProvider.startSymbol('//'); $interpolateProvider.endSymbol('//'); That changes the start and end symbols to '//' but you could just as easily change them to '[[' and ']]' or '||' and '||' or whatever you want. On Tuesday, February 18, 2014 1:19:14 PM UTC-7, Richard wrote: http://www.web2pyslices.com/slice/show/1922/web2py-angularjs Change angular {{ }} for {! !} Having to type to different character bug me though, but you need a closing tag... :( Richard On Tue, Feb 18, 2014 at 3:05 PM, Derek sp1...@gmail.com wrote: and to note you can change the brackets in angular to use something else... see here: http://docs.angularjs.org/api/ng/service/$interpolate by default it uses {{ and }} as starting and ending brackets. On Tuesday, February 18, 2014 12:59:48 PM UTC-7, Derek wrote: Well, the problem you have is that if you put angular tags in your views, they will be parsed with the template parser of web2py and error. The way to avoid that is to use the angular classes instead. For example, all the 'ng-app' and 'ng-controller' and 'ng-repeat' attributes ( http://docs.angularjs.org/tutorial/step_02). Keep in mind that the python template language will get parsed first, and only after that will the angular template parser be used. On Tuesday, February 18, 2014 12:49:42 PM UTC-7, Arvind Gupta wrote: Can we use angular.js with web2py, if yes can u point me to appropriate resources? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google
Re: [web2py] Re: Angular.js And other js lib
jQuery vs Angular you can't make that kind of simple comparaison they both design for solving different kind of problem. jQuery is good as manipulating DOM element. Angular is design to make very easy the development of SPA... Richard On Wed, Feb 19, 2014 at 10:46 AM, Arvind Gupta arvind.bernau...@gmail.comwrote: There is enough buzz around Angular over net, I haven't program web2py also. I have to choose django vs web2py for a personal project, I m evaluating my options, Which is easy to get started, Angular or Jquery? -arvind On Wed, Feb 19, 2014 at 7:53 PM, Richard Vézina ml.richard.vez...@gmail.com wrote: Your question is vague... I suggest you to listen a couple of video on youtube about Angular.js... There is many talk about what the limitation you face using Angular.js and jQuery for instance, since Angular.js use a different paradigm at generating dom instead of manipulating it. So there is thing that works if you manipulate dom with angular and thing that don't work and make thing disconnected. I just start learning Angular so can't help you that much... Richard On Tue, Feb 18, 2014 at 8:39 PM, Arvind Gupta arvind.bernau...@gmail.com wrote: @derek and @richard if we have to create generic support of other javascript libraries, what are the efforts one have to make? On Wed, Feb 19, 2014 at 2:48 AM, Richard Vézina ml.richard.vez...@gmail.com wrote: Good point Derek, I saw it in angular.js file when I test the slice (that at least work), as you say it is a cleaner approach... :) Richard On Tue, Feb 18, 2014 at 4:01 PM, Derek sp1d...@gmail.com wrote: no, no, no, do not use that slice, it's a waste of time to edit the angular.js file itself. you want to do that every time a new version is released? also why not just use a cdn for angular.js? http://docs.angularjs.org/api/ng/provider/$interpolateProvider# startSymbol The above link shows how to do it properly. Here's a snippet from their 'sample' code... var customInterpolationApp = angular.module('customInterpolationApp', []); customInterpolationApp.config(function($interpolateProvider) { $interpolateProvider.startSymbol('//'); $interpolateProvider.endSymbol('//'); That changes the start and end symbols to '//' but you could just as easily change them to '[[' and ']]' or '||' and '||' or whatever you want. On Tuesday, February 18, 2014 1:19:14 PM UTC-7, Richard wrote: http://www.web2pyslices.com/slice/show/1922/web2py-angularjs Change angular {{ }} for {! !} Having to type to different character bug me though, but you need a closing tag... :( Richard On Tue, Feb 18, 2014 at 3:05 PM, Derek sp1...@gmail.com wrote: and to note you can change the brackets in angular to use something else... see here: http://docs.angularjs.org/api/ng/service/$interpolate by default it uses {{ and }} as starting and ending brackets. On Tuesday, February 18, 2014 12:59:48 PM UTC-7, Derek wrote: Well, the problem you have is that if you put angular tags in your views, they will be parsed with the template parser of web2py and error. The way to avoid that is to use the angular classes instead. For example, all the 'ng-app' and 'ng-controller' and 'ng-repeat' attributes ( http://docs.angularjs.org/tutorial/step_02). Keep in mind that the python template language will get parsed first, and only after that will the angular template parser be used. On Tuesday, February 18, 2014 12:49:42 PM UTC-7, Arvind Gupta wrote: Can we use angular.js with web2py, if yes can u point me to appropriate resources? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For
[web2py] Re: Pack on OSX, Import on Windows bug (binary only)
My bad, thanks M. On Tuesday, February 18, 2014 6:58:56 PM UTC-8, Massimo Di Pierro wrote: It isn't that. The problem is that when you use py2pp, the latter freezes the path of the build machine for the purpose of reporting errors. I hate it but I have not fund a solution. This is not cause of errors. This is case of incorrect paths in reported errors. The error is in your engine5.py from html import FORM, INPUT, LABEL, OPTION, SELECT, BUTTON should be from gluon import FORM, INPUT, LABEL, OPTION, SELECT, BUTTON or from gluon.html import FORM, INPUT, LABEL, OPTION, SELECT, BUTTON because html is not in path. gluon is. On Tuesday, 18 February 2014 20:08:09 UTC-6, Brando wrote: Ticket ID 127.0.0.1.2014-02-18.20-21-14.5e42032d-3fa0-4fc5-8a93-9ca1ef22e89f type 'exceptions.ImportError' No module named html Version web2py™ Version 2.8.2-stable+timestamp.2013.11.28.13.54.07 Python Python 2.7.5: \\vmware-host\Shared Folders\Desktop\web2py\web2py.exe (prefix: C:\Python27) Traceback 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. Traceback (most recent call last): File /home/mdipierro/make_web2py/web2py/gluon/restricted.py, line 217, in restricted File //vmware-host/Shared Folders/Desktop/web2py/applications/c2/controllers/devices2.py, line 3, in module from engine5 import Formulator, Uploader, maketable File /home/mdipierro/make_web2py/web2py/gluon/custom_import.py, line 86, in custom_importer File /home/mdipierro/make_web2py/web2py/gluon/custom_import.py, line 125, in __call__ File applications\c2\modules\engine5.py, line 4, in module from html import FORM, INPUT, LABEL, OPTION, SELECT, BUTTON File /home/mdipierro/make_web2py/web2py/gluon/custom_import.py, line 86, in custom_importer File /home/mdipierro/make_web2py/web2py/gluon/custom_import.py, line 125, in __call__ ImportError: No module named html OSX version is Mavericks. Pack all and import it into Windows 7 binary version of Web2py (latest). This bug is not present in the Windows source version. Massimo, it looks like it's trying to load modules from your personal computer. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: Angular.js And other js lib
http://stackoverflow.com/questions/18414012/why-use-angularjs-instead-of-jquery http://stackoverflow.com/questions/13151725/how-is-angular-js-different-from-jquery http://stackoverflow.com/questions/14994391/how-do-i-think-in-angularjs-if-i-have-a-jquery-background Richard On Wed, Feb 19, 2014 at 11:04 AM, Richard Vézina ml.richard.vez...@gmail.com wrote: jQuery vs Angular you can't make that kind of simple comparaison they both design for solving different kind of problem. jQuery is good as manipulating DOM element. Angular is design to make very easy the development of SPA... Richard On Wed, Feb 19, 2014 at 10:46 AM, Arvind Gupta arvind.bernau...@gmail.com wrote: There is enough buzz around Angular over net, I haven't program web2py also. I have to choose django vs web2py for a personal project, I m evaluating my options, Which is easy to get started, Angular or Jquery? -arvind On Wed, Feb 19, 2014 at 7:53 PM, Richard Vézina ml.richard.vez...@gmail.com wrote: Your question is vague... I suggest you to listen a couple of video on youtube about Angular.js... There is many talk about what the limitation you face using Angular.js and jQuery for instance, since Angular.js use a different paradigm at generating dom instead of manipulating it. So there is thing that works if you manipulate dom with angular and thing that don't work and make thing disconnected. I just start learning Angular so can't help you that much... Richard On Tue, Feb 18, 2014 at 8:39 PM, Arvind Gupta arvind.bernau...@gmail.com wrote: @derek and @richard if we have to create generic support of other javascript libraries, what are the efforts one have to make? On Wed, Feb 19, 2014 at 2:48 AM, Richard Vézina ml.richard.vez...@gmail.com wrote: Good point Derek, I saw it in angular.js file when I test the slice (that at least work), as you say it is a cleaner approach... :) Richard On Tue, Feb 18, 2014 at 4:01 PM, Derek sp1d...@gmail.com wrote: no, no, no, do not use that slice, it's a waste of time to edit the angular.js file itself. you want to do that every time a new version is released? also why not just use a cdn for angular.js? http://docs.angularjs.org/api/ng/provider/$interpolateProvider# startSymbol The above link shows how to do it properly. Here's a snippet from their 'sample' code... var customInterpolationApp = angular.module('customInterpolationApp', []); customInterpolationApp.config(function($interpolateProvider) { $interpolateProvider.startSymbol('//'); $interpolateProvider.endSymbol('//'); That changes the start and end symbols to '//' but you could just as easily change them to '[[' and ']]' or '||' and '||' or whatever you want. On Tuesday, February 18, 2014 1:19:14 PM UTC-7, Richard wrote: http://www.web2pyslices.com/slice/show/1922/web2py-angularjs Change angular {{ }} for {! !} Having to type to different character bug me though, but you need a closing tag... :( Richard On Tue, Feb 18, 2014 at 3:05 PM, Derek sp1...@gmail.com wrote: and to note you can change the brackets in angular to use something else... see here: http://docs.angularjs.org/api/ng/service/$interpolate by default it uses {{ and }} as starting and ending brackets. On Tuesday, February 18, 2014 12:59:48 PM UTC-7, Derek wrote: Well, the problem you have is that if you put angular tags in your views, they will be parsed with the template parser of web2py and error. The way to avoid that is to use the angular classes instead. For example, all the 'ng-app' and 'ng-controller' and 'ng-repeat' attributes ( http://docs.angularjs.org/tutorial/step_02). Keep in mind that the python template language will get parsed first, and only after that will the angular template parser be used. On Tuesday, February 18, 2014 12:49:42 PM UTC-7, Arvind Gupta wrote: Can we use angular.js with web2py, if yes can u point me to appropriate resources? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com -
Re: [web2py] Re: Virtual Field Problem
Thanks Tim!!! You are rigth! I have a problem selecting my records properly!! Thanks Anthony!!! I didn't know that virtual fields must reference the table name too.. Now it works!!! 2014-02-19 11:01 GMT-03:00 Anthony abasta...@gmail.com: Should be: Field.Virtual('age', lambda row: diff_in_years(row.personal_data.dob)) Virtual field functions must reference the table name as well as the field name. Anthony On Tuesday, February 18, 2014 5:28:26 PM UTC-5, Leandro E. Colombo Viña wrote: Hi Guys! I've got a little problem trying to use Virtual Fields. I can't make them work. I follow the example in the book and nothing, I don't have a clue of what I'm doing wrong... The idea is to have a virtual field that calculates the age of the person based on his day of birth... Here is the model: db.define_table('personal_data', ., # another fields Field('dob', 'date', requires=IS_DATE()), ., # more fields auth.signature ) db.personal_data.age = Field.Virtual('age', lambda row: diff_in_years(row.dob)) Where the auxiliary function is: from dateutil import relativedelta as rdelta def diff_in_years(date): try: return rdelta.relativedelta(datetime.datetime.today().date(), date).years except: return None And here is my test controller: def prueba(): response.flash = db.personal_data(uid=auth.user.id).age The traceback says that Row doesn't have the attribute age. I've also tried with a method (Field.Method), with no luck. I always have the same error Any help would be appreciated! LEO -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] License? Is it ok to distribute commerciallly without restriction?
I'm new to licensing and I want to make sure I stay within license scope: Here's what I want to do: Distribute a stand-alone app that uses the built in rocket server and sqlite db. I plan on building the app so that there is no start-up dialogjust launch the app and it opens the login page. I don't plan on significantly editing source (maybe some default CSS or something) Here's what I need to know: 1. What web2py branding is required within my app (if any). 2. Are there any restrictions distributing this app commercially? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Updating a distributed web2py app.
I assume this is a dumb question, but here goes.If I distribute my web2py app what is the best way to push updates to my clients that are spread out all over the place? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Updating a distributed web2py app.
if the client is not same network (lan), i think you can pack web2py app and upload it on your client via web2py appadmin (if you use sqlite, please ensure backup and edit database, because it store on the same folder databases). if the client is on the lan, i usually use configuration management to push the web2py app and it's setting. best regards, stifan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: License? Is it ok to distribute commerciallly without restriction?
The web2py license says the following: ### On Commercial Redistribution In accordance with LGPL you may: - redistribute web2py with your apps (including official web2py binary versions) - release your applications which use official web2py libraries under any license you wish But you must: - make clear in the documentation that your application uses web2py - release any modification of the web2py libraries under the LGPLv3 license Keep in mind that open source licenses such as the LGPL that web2py uses don't generally restrict whether you can distribute applications commercially and charge customers for the applications. Rather, the license speaks to the rights the customer will then have once they have been given the application (and what exactly you have to give them, such as the source code). In the case of web2py, the framework itself must be distributed with an LGPL license, so your customer would have the rights granted under LGPL with regard to the framework. However, your application itself is considered separate from the framework, so you can distribute the application with whatever license you wish. The only requirement is as stated above -- if distributing your app with web2py, you must make clear in the license/documentation that it is using web2py. Also, note that the welcome app is in the public domain (no license), so you can modify it and distribute the modification with whatever license you wish (though you should check the licenses of the various included third party JS and CSS, such as jQuery and Bootstap to make sure you are in compliance). Massimo may have more to say. Anthony On Wednesday, February 19, 2014 11:17:28 AM UTC-5, Brando wrote: I'm new to licensing and I want to make sure I stay within license scope: Here's what I want to do: Distribute a stand-alone app that uses the built in rocket server and sqlite db. I plan on building the app so that there is no start-up dialogjust launch the app and it opens the login page. I don't plan on significantly editing source (maybe some default CSS or something) Here's what I need to know: 1. What web2py branding is required within my app (if any). 2. Are there any restrictions distributing this app commercially? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Updating a distributed web2py app.
Updating would happen have to happen over the WAN. I would prefer to update realtime/in the background (like chrome). Is this possible? On Wednesday, February 19, 2014 8:34:56 AM UTC-8, 黄祥 wrote: if the client is not same network (lan), i think you can pack web2py app and upload it on your client via web2py appadmin (if you use sqlite, please ensure backup and edit database, because it store on the same folder databases). if the client is on the lan, i usually use configuration management to push the web2py app and it's setting. best regards, stifan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] A query too far? Inner join with group by...
I don't get what you are talking about. you are grouping by the event_code and the course, then the min should give you the minimum for that particular event code and course. You want more columns then group by them as well. On Wednesday, February 19, 2014 4:29:55 AM UTC-7, Joe Barnhart wrote: Hi Derek -- Thanks for your response. I had considered your approach, but just declaring min() for every column does not return the values I need. Take for example the min time and the minimum meet name. Yes, I could get the lexical minimum of a character string that represents the meet at which the best time was recorded -- only it wouldn't be correct. The min(time) and min(meet_name) would have no relationship to one another -- they would be from completely different rows. That's why I must find the minimum time in one query, then use it to probe the entire table to find the full row it came from and read the other values. I've been pouring over the web looking for an alternative, but I just can't find one for my situation. Fortunately, I've been able to create a string and use executesql to get the query I need. It took some doing, but I managed to get the query into a single inner join and with proper indexing it is amazingly fast. I clocked it at about 20ms for a typical query on my data set. I was still able to make the result a proper Rows object and use SQLTABLE to style the output. Warm regards, Joe B. On Tuesday, February 18, 2014 11:53:19 AM UTC-8, Derek wrote: Joe, it seems to me all you need is this part here: select course, event_code, min(finals) as min_time from times where id_competitor= and finals0 group by course, event_code Or are you interested in returning other columns within the 'times' table? if so, just use min(other columns) in the query, no need for a derived table. So, in any case, web2py works a little differently. Taking the book example and modifying it, here's what I get... for row in db(db.times.competitor==).select( db.times.course, db.times.event_code, min_time, groupby=(db.times.course,db.times.event_code)): print row.times.course, row[min_time] What you need to do before that can work is to create the min_time operator... min_time = db.times.finals.min() oh, but you wanted to only select non negative numbers, and finals has some negatives in it... (add a where clause to the select) Good luck! -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Pagination example from book. Make pages start at 1?
He means that he wants the page numbers to start at 1, not zero. My original reply has the fixed code. It's subtle, so you have to look for it. On Tuesday, February 18, 2014 11:56:43 PM UTC-7, mweissen wrote: What do you mean with it reports as page 1? Do you mean the page number which is part of the URL? Or do you have a page numberin your view like {{=page}} 2014-02-18 23:18 GMT+01:00 HittingSmoke hittin...@gmail.com javascript: : I followed the pagination tutorial in the web2py book and I have the following controller: def index(): if len(request.args): page=int(request.args[0]) else: page=0 items_per_page=6 limitby=(page*items_per_page,(page+1)*items_per_page+1) posts=db().select(db.post.ALL, orderby=~db.post.date, limitby=limitby ) return dict(posts=posts, page=page, items_per_page=items_per_page) ...and this view controlling navigation: div class=pagination pagination-centered ul {{if page:}} lia href={{=URL(args=[page-1])}}Prev/a/li {{pass}} {{if len(posts)items_per_page:}} lia href={{=URL(args=[page+1])}}Next/a/li {{pass}} /ul /div The only problem I have with it is when you go to the second page it reports as page 1. I would like the first page to be page 1. Is that possible without completely rewriting the pagination function? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Updating a distributed web2py app.
Sure, you could update the files backing the site... use git or svn or something of the sort. As long as it's not compiled it should work. On Wednesday, February 19, 2014 9:50:18 AM UTC-7, Brando wrote: Updating would happen have to happen over the WAN. I would prefer to update realtime/in the background (like chrome). Is this possible? On Wednesday, February 19, 2014 8:34:56 AM UTC-8, 黄祥 wrote: if the client is not same network (lan), i think you can pack web2py app and upload it on your client via web2py appadmin (if you use sqlite, please ensure backup and edit database, because it store on the same folder databases). if the client is on the lan, i usually use configuration management to push the web2py app and it's setting. best regards, stifan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: creating a model of a table (with a large amount of data) in a mysql db. is taking a very long time
I doubt that the name of it is an issue. datetime is not in the reserved list. http://web2py.com/examples/static/epydoc/web2py.gluon.reserved_sql_keywords-pysrc.html your modeling of the database could be better. Why are you saying that datetime is an int, when it's actually a decimal? On Wednesday, February 19, 2014 3:16:56 AM UTC-7, John Philip wrote: Hi Anthony, thanks very much for your reply. I am able to now create the models ok. However when selecting specific tables in the mysql database web2py seems to hang. What I don't understand is that web2py seems to hang for tables using a field name 'datetime' which is a decimal(13,0) UN PK. Could it be that web2py gets confused by the fieldname called datetime? example of table in mysql db : Tablename: evth Fieldname Type datetime decimal(13,0) UN PK eventid varchar(5) stream smallint(5) UN application varchar(11) workstation varchar(11) severity enum('INFORMATION','WARNING','ERROR', 'FATAL') typeenum('SYSTEM','SOFTWARE','MIB','LOG') message varchar(432) PK thanks again for your help! John On Tuesday, February 18, 2014 5:23:38 PM UTC+1, Anthony wrote: The amount of data doesn't affect how long it takes the appadmin home page to load, as no data are being pulled from the database at that point. Even when you do select a specific table, it only loads the first 100 records, so again, nothing should hang. Note, defining the model of the table (as in your code below) doesn't actually pull any of the data from the database -- it just tells web2py about the structure of the database table so it knows how to make selects, updates, inserts, etc. Anthony On Tuesday, February 18, 2014 11:15:06 AM UTC-5, John Philip wrote: Hi there, I am trying to access a mysql database table with a very large amount of data. dbsql = DAL('mysql://myusername:mypasswrd@host/dbname', migrate=False) dbsql.define_table('evth', Field('datetime', 'integer'), Field('eventid','text'), Field('stream','integer'), Field('application','text'), Field('workstation','text'), Field('severity','text'), Field('type','text'), Field('message','text'), primarykey=['datetime']) In theory this should work. However when I run the database administration button to create the models it seems to hang. I suspect because of the amount of data. Since I am only interested in the most recent data is there anyway of doing this without web2py having to model the entire table? any help would be much appreciated. many thanks and regards, John -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Accessing views in Legacy tables
sure, add them as tables, but chances are you'll get weird things happening if any updates or deletes are done. On Monday, February 17, 2014 12:53:00 PM UTC-7, pythonic...@gmail.com wrote: Hi List, So, I have a sqlite database which has some views in that I want to access. The database isn't a web2py one (and can't be made so). I use the web2py extract_sqlite_models.py script to create the models. This creates a long file looking something like this: legacy_db = DAL('sqlite://db.sqlite') legacy_db.define_table('table1', migrate=False) # legacy_db.define_table('table1', migrate=False) But I can't see any Views referenced in there. Can I use web2py to access views in a legacy database? Thanks -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Web2py instead of MS Access?
friends don't let friends use mysql. It's not standards compliant, and has a lot more gotchas. use Postgres, example: http://sql-info.de/postgresql/postgres-gotchas.html http://sql-info.de/mysql/gotchas.html On Saturday, February 15, 2014 3:22:59 PM UTC-7, NeoToren wrote: Web2Py is the glue between a database and the user interface - say a web site, HTML pages. It doesn't have a database, so you'll need to use either SQLite (built in every Mac) or some other DB. Personally I suggest using MySQL - it is open source, industrial strength and will help you grow out of MS Access into a real-world database. When you'll have everything up and running on your local machine - you'll need to deploy to a hosting service so people can access your app over the web. Creating a phone book like you have mentioned is really easy - both on the DB side and the Web2Py side. I have managed to create one in several hours when I've started learning Web2Py. I have tried other glue frameworks before W2P, such as Django, PHP and others. W2P is by far the most friendly one I have tried and it will take you from 0 to a reasonable level in literally a couple of days. Good luck and have fun On Saturday, February 15, 2014 9:35:49 AM UTC-5, jimbo wrote: Hi I am thinking of using web2py for a small database instead of MS Access. It is for a charity and would have only several hundred records of employees and a table for clients. It would run on a local network with probably only two computers using it. The usual name, address , tel no. and some certificate and photo. It would avoid licence fees for a start and I think easier to use via a browser I know a little about Access but very basic. Are there any simple examples of where I could start, or some web2py appliance available? If any you can help or have something I can look at I would be very grateful. It's as much a learing thing for myself as I know virtually nothing aobut DB's. Thanks, Jim -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Updating a distributed web2py app.
For tools, there's a python-based tool fabric which helps with automation. It's easy to learn. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Problems with submenus in combination with iframe
My web2py app uses menus with submenus which works fine. But when I place an iframe like iframe src=http://www.klm-nuernberg.de; width=100% height=600px in my view the submenu does not pop up when a place the mouse on the menu containing the submenu. Does anyone know the reason for that? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] A query too far? Inner join with group by...
Hi Derek -- Yes, I need more columns. I need the name of the meet where the best time was achieved. And the club the athlete was a member of, and the date of the fastest time, etc. I can't put all of those columns in the group and ask for min of each because the min of each column will be from different rows of the table. I want the minimum time, AND the name of that exact meet -- not the minimum time and then the min across all meet names. That's why I need to find the min time in one query and then use that to look up the row where it occurs, so I can get the rest of the data. See my finished page in my response to Richard and maybe it will make more sense. It's hard to put database stuff into words! https://groups.google.com/d/msg/web2py/iQQ3lm7E9wg/aqUnMhR60s8J Warm regards, Joe B. On Wednesday, February 19, 2014 9:53:28 AM UTC-8, Derek wrote: I don't get what you are talking about. you are grouping by the event_code and the course, then the min should give you the minimum for that particular event code and course. You want more columns then group by them as well. On Wednesday, February 19, 2014 4:29:55 AM UTC-7, Joe Barnhart wrote: Hi Derek -- Thanks for your response. I had considered your approach, but just declaring min() for every column does not return the values I need. Take for example the min time and the minimum meet name. Yes, I could get the lexical minimum of a character string that represents the meet at which the best time was recorded -- only it wouldn't be correct. The min(time) and min(meet_name) would have no relationship to one another -- they would be from completely different rows. That's why I must find the minimum time in one query, then use it to probe the entire table to find the full row it came from and read the other values. I've been pouring over the web looking for an alternative, but I just can't find one for my situation. Fortunately, I've been able to create a string and use executesql to get the query I need. It took some doing, but I managed to get the query into a single inner join and with proper indexing it is amazingly fast. I clocked it at about 20ms for a typical query on my data set. I was still able to make the result a proper Rows object and use SQLTABLE to style the output. Warm regards, Joe B. On Tuesday, February 18, 2014 11:53:19 AM UTC-8, Derek wrote: Joe, it seems to me all you need is this part here: select course, event_code, min(finals) as min_time from times where id_competitor= and finals0 group by course, event_code Or are you interested in returning other columns within the 'times' table? if so, just use min(other columns) in the query, no need for a derived table. So, in any case, web2py works a little differently. Taking the book example and modifying it, here's what I get... for row in db(db.times.competitor==).select( db.times.course, db.times.event_code, min_time, groupby=(db.times.course,db.times.event_code)): print row.times.course, row[min_time] What you need to do before that can work is to create the min_time operator... min_time = db.times.finals.min() oh, but you wanted to only select non negative numbers, and finals has some negatives in it... (add a where clause to the select) Good luck! -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: postgres beginner questions: passwords, peer authentication, dev/production
I have a model file 0_globals.py which I have under source control. It defines overall constants for the site, including the connection string. On each development machine I have a file 1_locals.py which overrides selected variables in the globals file. It is NOT under source control and is unique for each development machine (since I code from a variety of machines). Model files are loaded in alphabetical order, so the 0_globals file is loaded first, then some constants are overwritten by 1_locals. This is simple and grut but it works amazingly well. It also works without any special features of the source code control system (I don't use git but mercurial). -- Joe B. Globals # coding: utf8 from gluon import current from gluon.storage import Storage from gluon.custom_import import track_changes settings = Storage() current.settings=settings # Override any settings in a file called 1-locals.py # but do NOT include the local file in the HG repo # AVOID changing this file, which IS in the repo. settings.title = 'My Wunnerful Website' settings.subtitle = XML('Some clever tagline goes here!') settings.author = 'me_ofcourse' settings.author_email = 'ad...@mysite.com' settings.keywords = '' settings.description = '' settings.layout_theme = 'Default' settings.formstyle = 'bootstrap' settings.table_page_size = 25 settings.upload = None settings.fake = False settings.scheduler = True settings.use_blob = False settings.migrate = True settings.migrate2 = True settings.lazy = True settings.database_uri = 'postgres://wouldntyoulike:toknow@localhost/mydb' settings.pool_size = 10 track_changes(True) # stripe DEVELOPMENT keys. settings.stripe_secret = 'sk_test_sorrynocanseesecretkey' settings.stripe_public = 'pk_test_sorrynocanseepublickey' # janrain keys. settings.janrain_key = 'somebiggobbledygookkeyhere' settings.janrain_domain = 'secure-swim-smarter.com' settings.janrain_appid = 'anotherrandomlookingthinghere' T.current_languages = ['null'] Locals: # code: utf8 # Settings for site on my iMac computer settings.migrate = False settings.migrate2 = False #settings.lazy = False #settings.database_uri = 'postgres://mylocalname:andpassword@localhost/mydb' #settings.pool_size = 10 #track_changes(False) #settings.use_blob = False settings.scheduler = False #settings.fake = True On Sunday, February 16, 2014 1:20:05 PM UTC-8, Tim Richardson wrote: postgres has peer authentication. If I have mapped OS user www-data to a postgres role, and if apache runs as www-data, can I use peer authentication in web2py and therefore not code a password in? It seems that the connection string is parsed for user and password. The main reason I want to avoid a password is that it having a different password in development and production becomes a nuisance. However, everyone must have this inconvenience; what's the solution that I'm missing? (I use git between development and production) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] CMS vs VCS
After reading a discussion on another list, I thought I'd poll people here (at least those who haved worked with one or more CMS) about what you'd expect from a Content Management System that you wouldn't get from Version Control System. This is more for my edification (or education) than because I expect to enter the discussion on the other list. The now-antique CMS mentioned in that there discussion was Quark Publishing System. What would a modern CMS have that QPS didn't? Is MS Sharepoint a CMS? Thanks, and sorry for the distraction. /dps -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Updating a distributed web2py app.
Hi Brando -- Here is the python tool called Fabric that Tim mentioned: http://docs.fabfile.org/en/1.8/ There is also puppet, which may be overkill: http://puppetlabs.com/puppet/what-is-puppet And a competitor to puppet in Python called Salt (puppet is Ruby): http://www.saltstack.com/community/ -- Joe B. On Wednesday, February 19, 2014 8:21:04 AM UTC-8, Brando wrote: I assume this is a dumb question, but here goes.If I distribute my web2py app what is the best way to push updates to my clients that are spread out all over the place? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Buttons vs Text Links
Is there a way to render a (standard graphical) button as a text link? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: How to multi-line session.flash
Rather than putting \n put br On Thursday, January 24, 2013 1:51:23 AM UTC-8, Yebach wrote: I send string to flash from my model on auth.messages.registration_pending. Since it is quite long i want to make it multiline. \n in my string do not work how to handle that? thank you best regarst On Tuesday, November 24, 2009 5:23:38 PM UTC+1, mdipierro wrote: response.flash = DIV(hello,BR(),world) On Nov 24, 3:53 am, hamdy.a.farag hamdy.a.fa...@inbox.com wrote: Hi How can I make response.flash display a message containing new line characters ? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Buttons vs Text Links
Not sure I understand, what the context? Can you show some code? If you want a button tag display like a a tag, better try the inverse, I mean make a look like a button tag... Bootstrap help a lot in that : a ... class=btn btn-small /a Richard On Wed, Feb 19, 2014 at 3:53 PM, horridohobbyist horrido.hobb...@gmail.comwrote: Is there a way to render a (standard graphical) button as a text link? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Making a phone call from within Web2Py
Thank you Derek! You are right -making a phone call from Web2Py - it is as simple as you've mentioned... Just tried it and it works like charm from a mobile device (like a native app !) and it will work from a desktop as well - if you install a third-party dialer (and use a phone line or a VOIP service) If you do not mind I am going to quote your solution on StackOverflow. Last but not least - what seems to be the security concern that you mentioned ? Thanks Neo On Tuesday, February 18, 2014 4:33:16 PM UTC-5, Derek wrote: well, that could introduce security issues as far as automatically dialing. a href=tel:555-555-555-555-/a that will bring up the dialer with the phone number already filled out. On Monday, February 17, 2014 9:11:15 PM UTC-7, NeoToren wrote: Maybe I am pushing the limits here...but I wonder, if we have an address book, with phone numbers ...and today most apps (W2P included) run quite well in browsers (NOT as native app but HTML)then can user just click on the number and the smart phone will make the call ? Like a ...native app ? ;-)) Did anyone have an idea if the above is doable in W2P ? I know W2P can send emails and SMS - but what about making a phone call ? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Updating a distributed web2py app.
Did it with a bit of turnarounds, but it's pretty solid. Check out https://github.com/niphlod/w2p_tvseries/blob/master/private/w2p_tvseries_installer.py a tiddle bit of tl/dr: - somewhere on the internet there's an updated version of the app. in my case, a tagged github zipball - somewhere on the internet there's a version file that can be fetched and compared to the local one to initiate the upgrade process (in my case, a file stored on github) - there is an upgrade process defined . in my case, a bit of turnarounds but you can safely assume the following: - compare versions - download new archive - backup current app - overwrite with new archive - initialize what needs to be initialized -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Web2py instead of MS Access?
The gotchas on MySQL are quite scary but also ...quite old. They relate to version 4.1 and most of us are using 5.x so I am not sure how relevant these gotchas are. I feel I am pretty good with SQL in general - but not that good as to start a discussion on which DB is better: Postgres vs. MySQL besides - W2P is not the forum for that, right ? Hope you'll agree though, that for somebody coming from MS Access (been there, done that) - ANY RDBMS is better and a true opportunity to grow... ;-)) On Wednesday, February 19, 2014 1:48:05 PM UTC-5, Derek wrote: friends don't let friends use mysql. It's not standards compliant, and has a lot more gotchas. use Postgres, example: http://sql-info.de/postgresql/postgres-gotchas.html http://sql-info.de/mysql/gotchas.html On Saturday, February 15, 2014 3:22:59 PM UTC-7, NeoToren wrote: Web2Py is the glue between a database and the user interface - say a web site, HTML pages. It doesn't have a database, so you'll need to use either SQLite (built in every Mac) or some other DB. Personally I suggest using MySQL - it is open source, industrial strength and will help you grow out of MS Access into a real-world database. When you'll have everything up and running on your local machine - you'll need to deploy to a hosting service so people can access your app over the web. Creating a phone book like you have mentioned is really easy - both on the DB side and the Web2Py side. I have managed to create one in several hours when I've started learning Web2Py. I have tried other glue frameworks before W2P, such as Django, PHP and others. W2P is by far the most friendly one I have tried and it will take you from 0 to a reasonable level in literally a couple of days. Good luck and have fun On Saturday, February 15, 2014 9:35:49 AM UTC-5, jimbo wrote: Hi I am thinking of using web2py for a small database instead of MS Access. It is for a charity and would have only several hundred records of employees and a table for clients. It would run on a local network with probably only two computers using it. The usual name, address , tel no. and some certificate and photo. It would avoid licence fees for a start and I think easier to use via a browser I know a little about Access but very basic. Are there any simple examples of where I could start, or some web2py appliance available? If any you can help or have something I can look at I would be very grateful. It's as much a learing thing for myself as I know virtually nothing aobut DB's. Thanks, Jim -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: new matplotlib tcl problem
Ekhm. In a version 2.8 we go back to the very same problem from 1.99. Did I miss something in matplotlib handling? search of the group didn't come with anything useful... there is a discussion on setting MPLCONFIGDIR setting to some tmp dir, but hey, in 2.5.1 everything works smoothly without it. Very best regards, On Wednesday, 17 July 2013 10:54:21 UTC+1, Marian Siwiak wrote: Solved. Explanation below is for future reference, if someone will experience similar problem (as Massimo pointed it in a very gentle way, maybe not that obvious to an external reader, and this solution is applicable I guess to a very wide range of problems). *Solution: It is always worth updating web2py to a newest version. * I was a bit afraid it may screw something with my app, but I was S wrong! Problem existed in version 1.99 and magically (yeach, sure!) disappeared in 2.5.1. Thanks, Marian TAG: library problem, compatibility issues, environment variables, external library, matplotlib On Wed, Jul 17, 2013 at 11:06 AM, Massimo Di Pierro wrote: Based on this: github.com/web2py/web2py you are right On Tuesday, 16 July 2013 14:21:51 UTC-5, Marian Siwiak wrote: Hi, I try to run a module starting with: def mymodule(*variables*): import matplotlib matplotlib.use('Agg') from pymol import * When I call it, I get error - piece of traceback is included below. File /usr/lib/pymodules/python2.7/matplotlib/pyplot.py, line 343, in figure **kwargs) File /usr/lib/pymodules/python2.7/matplotlib/backends/backend_tkagg.py, line 80, in new_figure_manager window = Tk.Tk() File /usr/lib/python2.7/lib-tk/Tkinter.py, line 1712, in __init__ self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use) TclError: no display name and no $DISPLAY environment variable Google says this tclerror usually means that tk tries to get interactive, but I thought matplotlib.use('Agg') should prevent that. Any advice? Thanks in advance. -- --- You received this message because you are subscribed to a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/bNsGtWbV7AU/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] pass values in state parameter oauth
Thanx a lot.. it worked On Monday, February 17, 2014 3:39:40 AM UTC+5:30, Michele Comitini wrote: inside the user() action in controllers/default.py you can add: if request.vars.state: auth_provider = cgi.parse_qs(request.vars.state)['auth_provider'][0] then you can do what you need with auth_provider 2014-02-16 12:13 GMT+01:00 ssuresh sureshs...@gmail.com javascript:: I am using google oauth login as explained here https://groups.google.com/forum/#!msg/web2py/fjpbFxRAGJM/pxvoBJKk2UkJ.. I am trying to use the state parameter to pass some additional values to google. As I understand we should get the values back in the response from google. My authentication is working fine and I am able to retrieve first name last name etc.. But I am not able toget the state values... Any ideas? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: username and email login (auth)
I tried using this code to let a user login with either username or email. Previously it was only allowing email. It's still trying to validate the entry as an email address though, and if I enter a username it gives me an error Invalid Email. How can I eliminate or circumvent that email validation? On Saturday, June 1, 2013 7:27:05 PM UTC-7, Gustavo Souza wrote: Worked for me the following code: if 'login' in request.args: auth.settings.login_userfield = 'username' if request.vars.username and not IS_EMAIL()(request.vars.username)[1]: auth.settings.login_userfield = 'email' request.vars.email = request.vars.username request.post_vars.email = request.vars.email request.vars.username = None request.post_vars.username = None return dict(form=auth.login()) Em sexta-feira, 9 de dezembro de 2011 10h22min57s UTC-2, Francisco Costa escreveu: lots of users on login form submit their email instead of the username.. it seems that auth.define_tables(username=True) forces username login but it is possible to have both? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Can I use win32com.client under Web2Py?
Do you have a product that integrates quickbooks to web2py as in a CRM? I would be interested in that... On Sunday, August 23, 2009 6:01:20 PM UTC-7, poematrix wrote: Hi. I have a Python script that utilizes win32com.client services in order to connect to Quickbooks. Is it possible to run such a script from within Web2Py on a Windows XP machine? The relevant lines of code are: import win32com.client . . . q = win32com.client.Dispatch(QBXMLRP.RequestProcessor) q.OpenConnection(Grab Data, Grab Data) t = q.BeginSession(,0) . . .Thanks. Elan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: expand_one not working
This is my other account. I found the problem, the url structure was bad cos i checked with the google docs viewer syntax and it needed the url to be url encoded, http://blablabla, but the url that gets submitted when i do URL('download', args=update.file) is sent in the form /[app]/default/download/file without the http://domain.com, i changed that to the absolute path and it worked. what i have a problem with now is being able to resize the embedded document... it appears in a small box and i don't know how to resize it help please? On Wednesday, February 19, 2014 2:36:10 PM UTC, Anthony wrote: What is the HTML code generated in this case? Have you verified that you can successfully download the file in question at your URL? Anthony On Tuesday, February 18, 2014 11:08:57 AM UTC-5, sasogeek wrote: in db.py, the table status is defined as follows db.define_table( 'status', Field('status', 'text'), Field('file', 'upload'), Field('userid'), ) and in default.py, the download function is defined as def download(): allows downloading of uploaded files http:///[app]/default/download/[filename] return response.download(request, db) just like in the tutorial book. and in the views, i have this code {{from gluon.contrib.autolinks import expand_one}} ... {{updates=db().select(db.status.ALL, orderby=~db.status.id)}} {{if updates:}} {{for update in updates:}} {{=XML(expand_one(URL('download', args=update.file,),cache.ram('mycache',lambda:dict(),3600)))}} {{pass}} {{pass}} if update.file is an image, it works fine and the image is rendered just fine, but when it's a pdf, it doesn't work, I get this error Sorry, we were unable to find the document at the original source. Verify that the document still exists. You can also try to download the original document by clicking here When I click on the link that says here, it opens a google docs page in a new window with the same error statement in it how do i fix this? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: Angular.js And other js lib
I am learning Angular.js and the more I read about it the more I love it. Yet I think Angular.js is not web2py but Angular.js may be for web3py (or however we call it). Web2py has a design which is MVC and the V(iews) are created serverside using a template language. Angular is not a replacement for jQuery. It is a replacement for the template language. The purpose of angular is that building one page applications that talk to the server using almost exclusively web services. So Angular aims to replace something that is fundamental in web2py, its server side MVC architecture. Yet I can imagine a future where we retain: - the web IDE - the dal.py (because it is great) - a lighter version of dispathing and routing (perhaps bottle.py) - the web2py form generation (or the new form.py in gluino) and server side form validation - the web2py RESTful services (or something better) But we ditch web2py templates completely, we use angular for client-side templates, and we only communicate data from client-server using json. A minor problem with all of this is that some times one needs to generate HTML based on the value of variables that should not be exposed to the user. For example I may have a green button if I have a positive bank account balance and a red button if the balance is negative, but I may not want to show the balance. In web2py this is easy. In Angular one would have to create a new variable (boolean) pass it to the client and have the client decide the color based on the boolean. Angular constrains you more but forces you to be more disciplined. Massimo On Wednesday, 19 February 2014 10:06:03 UTC-6, Richard wrote: http://stackoverflow.com/questions/18414012/why-use-angularjs-instead-of-jquery http://stackoverflow.com/questions/13151725/how-is-angular-js-different-from-jquery http://stackoverflow.com/questions/14994391/how-do-i-think-in-angularjs-if-i-have-a-jquery-background Richard On Wed, Feb 19, 2014 at 11:04 AM, Richard Vézina ml.richa...@gmail.comjavascript: wrote: jQuery vs Angular you can't make that kind of simple comparaison they both design for solving different kind of problem. jQuery is good as manipulating DOM element. Angular is design to make very easy the development of SPA... Richard On Wed, Feb 19, 2014 at 10:46 AM, Arvind Gupta arvind.b...@gmail.comjavascript: wrote: There is enough buzz around Angular over net, I haven't program web2py also. I have to choose django vs web2py for a personal project, I m evaluating my options, Which is easy to get started, Angular or Jquery? -arvind On Wed, Feb 19, 2014 at 7:53 PM, Richard Vézina ml.richa...@gmail.comjavascript: wrote: Your question is vague... I suggest you to listen a couple of video on youtube about Angular.js... There is many talk about what the limitation you face using Angular.js and jQuery for instance, since Angular.js use a different paradigm at generating dom instead of manipulating it. So there is thing that works if you manipulate dom with angular and thing that don't work and make thing disconnected. I just start learning Angular so can't help you that much... Richard On Tue, Feb 18, 2014 at 8:39 PM, Arvind Gupta arvind.b...@gmail.comjavascript: wrote: @derek and @richard if we have to create generic support of other javascript libraries, what are the efforts one have to make? On Wed, Feb 19, 2014 at 2:48 AM, Richard Vézina ml.richa...@gmail.comjavascript: wrote: Good point Derek, I saw it in angular.js file when I test the slice (that at least work), as you say it is a cleaner approach... :) Richard On Tue, Feb 18, 2014 at 4:01 PM, Derek sp1...@gmail.comjavascript: wrote: no, no, no, do not use that slice, it's a waste of time to edit the angular.js file itself. you want to do that every time a new version is released? also why not just use a cdn for angular.js? http://docs.angularjs.org/api/ng/provider/$interpolateProvider# startSymbol The above link shows how to do it properly. Here's a snippet from their 'sample' code... var customInterpolationApp = angular.module('customInterpolationApp', []); customInterpolationApp.config(function($interpolateProvider) { $interpolateProvider.startSymbol('//'); $interpolateProvider.endSymbol('//'); That changes the start and end symbols to '//' but you could just as easily change them to '[[' and ']]' or '||' and '||' or whatever you want. On Tuesday, February 18, 2014 1:19:14 PM UTC-7, Richard wrote: http://www.web2pyslices.com/slice/show/1922/web2py-angularjs Change angular {{ }} for {! !} Having to type to different character bug me though, but you need a closing tag... :( Richard On Tue, Feb 18, 2014 at 3:05 PM, Derek sp1...@gmail.com wrote: and to note you can change the brackets in angular to use something else... see here: http://docs.angularjs.org/api/ng/service/$interpolate by default
[web2py] DAL Join
Hi, Maybe a stupid question but here goes. I am trying to do the following join. row = db(db.weets.posted_by==user).select(join=db.auth_user.on(db.weets.posted_by==db.auth_user.id)) its seems to work and row does return. The example in the book then shows you can use attributes but when i try: row.auth_user.name or other field it says no attribute auth_user. i am not sure why this is? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: DAL Join
Should be rows = db(db.weets.posted_by==user).select(join=db.auth_user.on(db.weets.posted_by== db.auth_user.id)) row = rows.first() print row.auth_user.name Does it work? Also try (should be the same): rows = db(db.weets.posted_by==user)(db.weets.posted_by==db.auth_user.id). select() row = rows.first() print row.auth_user.name On Wednesday, 19 February 2014 23:18:33 UTC-6, contact.ur...@gmail.com wrote: Hi, Maybe a stupid question but here goes. I am trying to do the following join. row = db(db.weets.posted_by==user).select(join=db.auth_user.on(db.weets.posted_by== db.auth_user.id)) its seems to work and row does return. The example in the book then shows you can use attributes but when i try: row.auth_user.name or other field it says no attribute auth_user. i am not sure why this is? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: DAL Join
A select always returns a Rows object, not a Row object, even if there is always one record. So, instead, do: row = db(db.weets.posted_by == user).select( join=db.auth_user.on(db.weets.posted_by == db.auth_user.id)).first() Anthony On Thursday, February 20, 2014 12:18:33 AM UTC-5, contact.ur...@gmail.com wrote: Hi, Maybe a stupid question but here goes. I am trying to do the following join. row = db(db.weets.posted_by==user).select(join=db.auth_user.on(db.weets.posted_by== db.auth_user.id)) its seems to work and row does return. The example in the book then shows you can use attributes but when i try: row.auth_user.name or other field it says no attribute auth_user. i am not sure why this is? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: DAL Join
I tried both suggestions by yourself and the suggestion by Anthony. They all return a dictionary as before but my i am still getting the attribute error. may be it is something i am doing ? Here is the error output if it helps Traceback (most recent call last): File /home/www-data/web2py/gluon/restricted.py, line 217, in restricted exec ccode in environment File /home/www-data/web2py/applications/init/controllers/api.py https://urban-gatherer.ca/admin/default/edit/init/controllers/api.py, line 124, in module File /home/www-data/web2py/gluon/globals.py, line 372, in lambda self._caller = lambda f: f() File /home/www-data/web2py/applications/init/controllers/api.py https://urban-gatherer.ca/admin/default/edit/init/controllers/api.py, line 8, in call return service() File /home/www-data/web2py/gluon/tools.py, line 4915, in __call__ return self.serve_json(request.args[1:]) File /home/www-data/web2py/gluon/tools.py, line 4603, in serve_json s = universal_caller(self.json_procedures[args[0]], *args[1:], **d) File /home/www-data/web2py/gluon/tools.py, line 4274, in universal_caller return f(**arg_dict) File /home/www-data/web2py/applications/init/controllers/api.py https://urban-gatherer.ca/admin/default/edit/init/controllers/api.py, line 117, in news company = row.auth_user.company_name AttributeError: 'NoneType' object has no attribute 'auth_user' On Wednesday, February 19, 2014 10:15:16 PM UTC-8, Massimo Di Pierro wrote: Should be rows = db(db.weets.posted_by==user).select(join=db.auth_user.on(db.weets.posted_by== db.auth_user.id)) row = rows.first() print row.auth_user.name Does it work? Also try (should be the same): rows = db(db.weets.posted_by==user)(db.weets.posted_by==db.auth_user.id). select() row = rows.first() print row.auth_user.name On Wednesday, 19 February 2014 23:18:33 UTC-6, contact.ur...@gmail.comwrote: Hi, Maybe a stupid question but here goes. I am trying to do the following join. row = db(db.weets.posted_by==user).select(join=db.auth_user.on(db.weets.posted_by== db.auth_user.id)) its seems to work and row does return. The example in the book then shows you can use attributes but when i try: row.auth_user.name or other field it says no attribute auth_user. i am not sure why this is? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] How can I restrict an input field to latin alphabet characters only?
How can I restrict an input field to (extended) latin alphabet characters only? I'm thinking a validator that will return an error message if characters are not extended Latin characters Basically I want to allow: Zürich or Cancún but reject: 上海市 or دبي -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Version Control advice
I also agree with separate repositories per app. My web2py folder is a mercurial repository (I cloned the web2py repository http://code.google.com/p/web2py/source/checkout) Then for each application I want to make, I create a new repository for that application in the web2py/applications folder. So you end up with a nested repository structure but they actually play nicely and don't interfere with each other (thanks to the ignore files) This way I can update web2py as needed to get new versions or bug fixes. And my applications are in separate repositories because they really have nothing to do with web2py core. On Wednesday, February 19, 2014 6:00:37 AM UTC-5, Tim Richardson wrote: Well, I'm not very sophisticated but I have separate git repositories per app, I can't any advantages in having one repository for everything. On Wednesday, 19 February 2014 12:13:13 UTC+11, Carlos Zenteno wrote: Do you guys version control just the /applications directory or the whole web2py tree? What is better for auto-deployment when pushing to the production repo? Thanks... -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.