[web2py] c.r.m. source
hi i would like to examine the source code of http://web2py-crm.appspot.com/ but i can not find it on http://web2py.com/appliances/ andrej -- --- 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: Anyone used WHOOSH as search engine with web2py?
hi i was testing solr and whoosh now i'm using whoosh because it is python based and i can easily port my application (no need to intall java, tomcat etc) newer had any real problems most of the time i spend figuring out how to use stemmer/lematization (not for english), but this is not part of whoosh andrej On Tuesday, October 12, 2010 8:38:46 PM UTC+2, David Marko wrote: Is there anyone who has used the whoosh (http://bitbucket.org/mchaput/ whoosh/wiki/Home http://bitbucket.org/mchaput/whoosh/wiki/Home) for full text search? If so, can you share your experience? David -- --- 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] access control in view
hi i want to show link edit in view just for users in the group editors how to check that in view? or is there another way to do that? and another question: i want new users (signin in) to be part of a certain (default) group. how? andrej --
[web2py] postgres problem with crud.update
i've made app using wizzard i addes tags db.define_table('t_tag', Field('f_game_id', type='reference t_game', label=T('Game Id')), Field('f_name', type='string', label=T('Name')), auth.signature, format='%(f_game_id)s', migrate=settings.migrate) db.define_table('t_tag_archive',db.t_tag,Field('current_record','reference t_tag',readable=False,writable=False)) in controller i have crud.update form = make_taggable_eq(crud.update(db.t_game,record,onaccept=update_tags_eq)) if i want to delete game, there is an error: class 'psycopg2.IntegrityError' insert or update on table t_tag violates foreign key constraint t_tag_f_game_id_fkey DETAIL: Key (f_game_id)=(699) is not present in table t_game. update is OK is this related to postgres? what am i doing wrong? andrej --
[web2py] Re: Anyone using Sunburnt for Apache SOLR access from web2py?
Hi Did you implement this? After trying Whoosh (and finding dificult to implement stemmer/lematization for my language) i'm looking for another solution. Is sunburnt the best solution to use solr with python/web2py? Did you try solrpy? Andrej On Friday, July 6, 2012 8:45:21 PM UTC+2, David Marko wrote: Anyone using Sunburnt for Apache SOLR access from web2py? ( http://opensource.timetric.com/sunburnt ) Any caveats I should expect or no problems on the path? (I mean sunburt vs./in web2py) Thank you ... David --
Re: [web2py] Re: tags and speed
hi Thank you for your explanation. It is really helpful The address of the chapter in the book is Efficient search by tag and i choose this approach because i thought that search would be the most important thing of the application (that was right) The table tag is similar like in your example 2, but only one tag per row, so: game_id tag 1 excitement 1 funny I learned some lessons: - do usability testing ass soon as possible (it came as a surprise for me that using Datatables is the most useful) - be prepared for lots of data: my initial assumption was 200 games, and now i have more than 1000. I will try with cache first. andrej On Friday, October 19, 2012 1:21:37 AM UTC+2, Niphlod wrote: old mean bad thing about normalized vs denormalized model. Don't know what you read in the cookbok, but here's the thing. You have a game pacman that is tagged as arcade, and a game invaders tagged as horror First things first: you may want to change horror to needs parent around later in the future. That's why you may want to create an external tags table and reference it in your games one. tags table 1 arcade 2 horror game_name tags pacman 1 invaders 2 To display pacman arcade invaders horror you just need a simple join. Changing record 2 of the tags table allows you to have pacman arcade invaders needs parents around Next problem on the line: you want multiple tags for a single game (invaders needs both arcade and horror tags). Welcome to normalization hell. Books have been written about it in the last 60-70 years, with terms like 3NF and Cardinality all around ^_^ Let's take this by examples 1) you change the tags table like this id tag_name game_id 1 arcade 1 1 arcade 2 2 horror 2 getting tags for a single game is fast, change horror to needs parents around is fast, getting all possible tags is enough fast (depending on the number of rows of the tags table) but fetch the right tags for every game can be slow 2) you create a games table like this id game_name tags 1 pacman |arcade| 2 invaders |arcade|horror| getting tags for a single game is fast, updating a tag for a game is quite fast but changing all horror to needs parents around can be fast only if done outside web2py with a manual replace, getting all possible tags can be slow 3) you create a games table like this id game_name tags_id 1 pacman |1| 2 invaders |1|2| getting tags for a single game is fast, updating a tag for a game is quite fast, changing horrors is fast but changing all horror to needs parents around can be fast only if done outside web2py with a manual replace, getting all possible tags can be slow So, with no need to change tag names from horror to needs parents around, I'd say the right way for displaying your table is 2) (list:string), else 3) (list:reference). If you need to suggest previously entered tags (i.e. you don't want to end having arcade, arcady, arcadian, 'rcade spat all around), I'd still go for 2) + one separate table (or a cached list) holding all previously entered tags, just to speedup the suggestion phase (hoping users won't screw up). Method 1) is faster only when: - tags are more than the games - cleaning normalization logics are heavy - you need to update tag names often - the only need is displaying tags for a single game (direct query on a single table, the tags one) - you need to compute something like how many times the arcade tag is applied to all my games (i.e. for a tag cloud) There are several other methods, and all of them in the end do the job. You just need to see what are your requirements and choose carefully. Your agenda is: - spend the less time possible with queries you have to invoke often - pay the price of your model in high computations for other things (or, let's save the results of those computations externally once every hour) --
Re: [web2py] Re: tags and speed
should i use .select(..., cacheable=True) or cache.disk('games',lambda:games what is the difference? andrej On Friday, October 19, 2012 1:20:08 PM UTC+2, andrej burja wrote: hi Thank you for your explanation. It is really helpful The address of the chapter in the book is Efficient search by tag and i choose this approach because i thought that search would be the most important thing of the application (that was right) The table tag is similar like in your example 2, but only one tag per row, so: game_id tag 1 excitement 1 funny I learned some lessons: - do usability testing ass soon as possible (it came as a surprise for me that using Datatables is the most useful) - be prepared for lots of data: my initial assumption was 200 games, and now i have more than 1000. I will try with cache first. andrej On Friday, October 19, 2012 1:21:37 AM UTC+2, Niphlod wrote: old mean bad thing about normalized vs denormalized model. Don't know what you read in the cookbok, but here's the thing. You have a game pacman that is tagged as arcade, and a game invaders tagged as horror First things first: you may want to change horror to needs parent around later in the future. That's why you may want to create an external tags table and reference it in your games one. tags table 1 arcade 2 horror game_name tags pacman 1 invaders 2 To display pacman arcade invaders horror you just need a simple join. Changing record 2 of the tags table allows you to have pacman arcade invaders needs parents around Next problem on the line: you want multiple tags for a single game (invaders needs both arcade and horror tags). Welcome to normalization hell. Books have been written about it in the last 60-70 years, with terms like 3NF and Cardinality all around ^_^ Let's take this by examples 1) you change the tags table like this id tag_name game_id 1 arcade 1 1 arcade 2 2 horror 2 getting tags for a single game is fast, change horror to needs parents around is fast, getting all possible tags is enough fast (depending on the number of rows of the tags table) but fetch the right tags for every game can be slow 2) you create a games table like this id game_name tags 1 pacman |arcade| 2 invaders |arcade|horror| getting tags for a single game is fast, updating a tag for a game is quite fast but changing all horror to needs parents around can be fast only if done outside web2py with a manual replace, getting all possible tags can be slow 3) you create a games table like this id game_name tags_id 1 pacman |1| 2 invaders |1|2| getting tags for a single game is fast, updating a tag for a game is quite fast, changing horrors is fast but changing all horror to needs parents around can be fast only if done outside web2py with a manual replace, getting all possible tags can be slow So, with no need to change tag names from horror to needs parents around, I'd say the right way for displaying your table is 2) (list:string), else 3) (list:reference). If you need to suggest previously entered tags (i.e. you don't want to end having arcade, arcady, arcadian, 'rcade spat all around), I'd still go for 2) + one separate table (or a cached list) holding all previously entered tags, just to speedup the suggestion phase (hoping users won't screw up). Method 1) is faster only when: - tags are more than the games - cleaning normalization logics are heavy - you need to update tag names often - the only need is displaying tags for a single game (direct query on a single table, the tags one) - you need to compute something like how many times the arcade tag is applied to all my games (i.e. for a tag cloud) There are several other methods, and all of them in the end do the job. You just need to see what are your requirements and choose carefully. Your agenda is: - spend the less time possible with queries you have to invoke often - pay the price of your model in high computations for other things (or, let's save the results of those computations externally once every hour) --
Re: [web2py] Re: tags and speed
hi system: it is on linode 512, os ubuntu, server apache, database postgresql my initial design was using list:string, but than i saw example in the book (Application-Development-Cookbook) and i thought this is better purpose of that code: user testing reveals, that the best way to search the data is with Datatables (+individual column filtering). i have 1000 games with different attributes: name, for what age, how big the group can be, equipment, tags, instructions. I have to put all the attributes in table. .. and there is another problem: tags and equipment have both the same implementation - so actualy i do 2000 selects :( andrej On Thursday, October 18, 2012 4:09:59 AM UTC+2, rochacbruno wrote: I am using list:string for tags and it is working very well for my needs. --
Re: [web2py] Re: tags and speed
hi for all possible tags i use: all_tags = db().select(db.t_tag.f_name,distinct=True) in database i have first table games with filds title, age, group, instruction and i have also two other tables: tags and equipment and when i show the data, i'm using Datatables (with general search and searching in columns). in Datatables ( plug-in for the jQuery http://www.jquery.com/) i have columns: title, age, group, instruction, tags, equipment. id | title | age | group | instruction | tags | equipment --- 1 || | | | | and for Datatables (and efficient search) i have to get all the games (1000) with all attributes including equipment and tags for every game. and there i have 1 select for all games and 1000 selects for tags (for every game one select) and 1000 selects for equipment (for every game one) if it possible to make this faster with joins, how? do you recomend to chache this select? do you recomend going back to list:string for tags and equipment. what is the advantage of example in the book (what i'm using, tags in different table) over tags in list:string field andrej On Thursday, October 18, 2012 2:20:21 PM UTC+2, Massimo Di Pierro wrote: I understand you want to select all possible tags. I suggest you create a table that stores all posible tags and when a new tag is created you insert a new record there. You can get all possible tags with a single select from this table. You can also cache that select. On Thursday, 18 October 2012 02:56:17 UTC-5, andrej burja wrote: hi system: it is on linode 512, os ubuntu, server apache, database postgresql my initial design was using list:string, but than i saw example in the book (Application-Development-Cookbook) and i thought this is better purpose of that code: user testing reveals, that the best way to search the data is with Datatables (+individual column filtering). i have 1000 games with different attributes: name, for what age, how big the group can be, equipment, tags, instructions. I have to put all the attributes in table. .. and there is another problem: tags and equipment have both the same implementation - so actualy i do 2000 selects :( andrej On Thursday, October 18, 2012 4:09:59 AM UTC+2, rochacbruno wrote: I am using list:string for tags and it is working very well for my needs. --
[web2py] link to sqlform.factory
hi i have one page with links (in view1) {{=A(tag.f_name,_href=URL('games_with_tags_show',vars=dict(tags=tag.f_name )))}} and i have search form (in function2/view2): form = SQLFORM.factory( Field('tags_ava','list:string',label=T('Tags'), requires = IS_EMPTY_OR(IS_IN_SET(tags_ava_set)), widget=SQLFORM.widgets.options.widget), formstyle='divs', submit_button ='Search' ) reset = INPUT(_type='button',_id=reset_all,_value=T('Reset')) form.append(reset) if form.process().accepted: i would with click on the link in view 2: - open view2 - fill the field 'tags_ava' with URL arguments - click the button in view2 and i would like also to use the function2/view2 alone (without comming there from view1) is this possible? andrej --
[web2py] tags and speed
hi i have table games and they have tags i followed the example in the book and put tags in separate table now i want to show all games with all tags in the view: game.title, games.instruction, game.tags in fuction i have for game in games: equipment =[tag.name for tag in db(db.tag.game_id==game.id).select()] game.f_equipment =', '.join(equipment) having more than 1000 games (games is row object with more than 1000 entries), this is very slow. how can i make that faster? andrej --
[web2py] sqlform.factory, list string - pre-populate dropdown
hi i have page with form and rows. form = SQLFORM.factory(Field('tags_ava','list:string',label=T('Tags'),requires = IS_EMPTY_OR(IS_IN_SET(tags_ava_set)), widget=SQLFORM.widgets.options.widget), based on selected tag (tag1), i get list of entries (with at least tag1), and based on that i get new list of available tags (tags which are used alongside tag1). i save that list in session. session.new_tags_ava_set = new_tags_ava_set after reloading the page, i would like to have that new set in dropdown list (filed tags_ava). so this line comes before 'form =' tags_ava_set = session.new_tags_ava_set and there i have a problem. requires = ... works fine. i have to choose something from new_tags_ava_set or i get error but - the entries on dropdown list are not new_tags_ava_set - there are more entris. actualy they are from previous step. so i have to click the button twice (without changing the values in the form) to populate dropdown with the right values. my question is: how to prepopulate dropdown with right values (the logic of my aplication is filtering entries one tag at a time. probable something like this should be done with AJAX.:) andrej --
[web2py] checkboxes widget with list:string - request.vars type
hi i have SQLFORM with checkboxes (widget). if i choose one checkbox, type(request.varst.checkbox) is 'string' and if i choose more than one checkbox, tpye(request.vars.checkbox) is 'list' why choosing one checkbox does not return 'list'? form = SQLFORM.factory(Field('checkbox','list:string',label=T('Equipment'), requires=IS_EMPTY_OR(IS_IN_SET(some_set,multiple=True)), widget=SQLFORM.widgets.checkboxes.widget ) andrej --
[web2py] Re: SOLVED 'efficiently search by tag' with postgres
hi another question: there is number of tags: n = len(tags) and there is rows = db(data.id==link.record_id)\ (link.tag_id.belongs(subquery)).select( data.ALL, orderby=data.id, groupby=data.id, having=data.id.count()==n) so, if i have data1 with tags (news, sport) and data2 with tags (news, sport, football) and searching for tags: news, sport is the result data1 only or data1 and data2 if later, how to search for data with exactly entered tags (omit data with more tags) andrej On Monday, September 24, 2012 5:57:35 PM UTC+2, andrej burja wrote: hi it works thank you andrej On Sunday, September 23, 2012 12:18:32 AM UTC+2, Massimo Di Pierro wrote: Looks like postgres is picky and wants in groupby all the selected fields in distinct. This should work: rows = db(data.id==tag.record_id)\ (tag.name.belongs(tags)).select( data.ALL, orderby=data.id, groupby=data.id|data.value, distinct=True) On Saturday, 22 September 2012 15:00:07 UTC-5, andrej burja wrote: the code with problem: rows = db(data.id==tag.record_id)\ (tag.name.belongs(tags)).select( data.ALL, orderby=data.id, groupby=data.id, distinct=True) On Saturday, September 22, 2012 10:26:27 AM UTC+2, andrej burja wrote: hi i would like to use idea in book Application Development Cookbook - Efficienty search by tag. there are two functions: 'search_or' and 'search_and' everything is working fine on sqlite when i switch to postgres, there seems to be problem with 'groupby'. i got an error class 'psycopg2.ProgrammingError' column data.value must appear in the GROUP BY clause or be used in an aggregate function LINE 1: SELECT DISTINCT data.id, data.value FROM tag, data WHERE ((d... ^ when i remove 'groupby=id there is no error, but (of course) 'search_and' function doesn't work properly is this a bug related to postgres? andrej --
[web2py] Quick and dirty search form example: some improvements
hi there is a nice example of search form http://www.web2pyslices.com/slice/show/1552/search-form i would like to do some improvements. At the top there si a search form, and at the bottom are results. I would like to make results clickable - clicking on the result opens new function/view (just result details). going back from that function/view i would like to see the results of search i've performed. ideally without new search. what is the most elegant solution. should i store search variables in session? should i use cache? should i display details in new (popup) window? and one more thing: after hiting the Search button, i wuld like to write search parameters in URL (with args). is this possible? andrej --
[web2py] SOLVED 'efficiently search by tag' with postgres
hi it works thank you andrej On Sunday, September 23, 2012 12:18:32 AM UTC+2, Massimo Di Pierro wrote: Looks like postgres is picky and wants in groupby all the selected fields in distinct. This should work: rows = db(data.id==tag.record_id)\ (tag.name.belongs(tags)).select( data.ALL, orderby=data.id, groupby=data.id|data.value, distinct=True) On Saturday, 22 September 2012 15:00:07 UTC-5, andrej burja wrote: the code with problem: rows = db(data.id==tag.record_id)\ (tag.name.belongs(tags)).select( data.ALL, orderby=data.id, groupby=data.id, distinct=True) On Saturday, September 22, 2012 10:26:27 AM UTC+2, andrej burja wrote: hi i would like to use idea in book Application Development Cookbook - Efficienty search by tag. there are two functions: 'search_or' and 'search_and' everything is working fine on sqlite when i switch to postgres, there seems to be problem with 'groupby'. i got an error class 'psycopg2.ProgrammingError' column data.value must appear in the GROUP BY clause or be used in an aggregate function LINE 1: SELECT DISTINCT data.id, data.value FROM tag, data WHERE ((d... ^ when i remove 'groupby=id there is no error, but (of course) 'search_and' function doesn't work properly is this a bug related to postgres? andrej --
[web2py] 'efficiently search by tag' with postgres
hi i would like to use idea in book Application Development Cookbook - Efficienty search by tag. there are two functions: 'search_or' and 'search_and' everything is working fine on sqlite when i switch to postgres, there seems to be problem with 'groupby'. i got an error class 'psycopg2.ProgrammingError' column data.value must appear in the GROUP BY clause or be used in an aggregate function LINE 1: SELECT DISTINCT data.id, data.value FROM tag, data WHERE ((d... ^ when i remove 'groupby=id there is no error, but (of course) 'search_and' function doesn't work properly is this a bug related to postgres? andrej --
[web2py] Re: 'efficiently search by tag' with postgres
the code with problem: rows = db(data.id==tag.record_id)\ (tag.name.belongs(tags)).select( data.ALL, orderby=data.id, groupby=data.id, distinct=True) On Saturday, September 22, 2012 10:26:27 AM UTC+2, andrej burja wrote: hi i would like to use idea in book Application Development Cookbook - Efficienty search by tag. there are two functions: 'search_or' and 'search_and' everything is working fine on sqlite when i switch to postgres, there seems to be problem with 'groupby'. i got an error class 'psycopg2.ProgrammingError' column data.value must appear in the GROUP BY clause or be used in an aggregate function LINE 1: SELECT DISTINCT data.id, data.value FROM tag, data WHERE ((d... ^ when i remove 'groupby=id there is no error, but (of course) 'search_and' function doesn't work properly is this a bug related to postgres? andrej --
[web2py] pandas and web2py
hi is anybody using pandas with web2py i think i can do equipment = db().select.as_dict() df = DataFrame(equipment) but how to display pandas DataFrame object in web2py view? or how to convert in to something i can display in view? andrej --
[web2py] tag counting
with this statement i get list of all the tags tags = db().select(db.t_tag.f_name,distinct=True) t_tag has only reference - value what is the fastest way to count number of appearances for every tag i would like to dipslay tag (number of objects wit that tag) andrej --
[web2py] Re: How to add Row object to Rows
what if i want newrows to contain only duplicates? i want to display only rows which are in rows1 AND rows2 andrej On Tuesday, June 5, 2012 7:22:11 PM UTC+2, Anthony wrote: I think you can do: myrows.records.append(myrow) Note, I don't think this is part of the documented API, so probably not guaranteed to remain backward compatible (though I doubt it will change). You can also join two Rows objects: newrows = rows1 rows2 newrows = rows1 | rows2 # this one removes duplicates from rows2 before combining Anthony On Tuesday, June 5, 2012 1:10:58 PM UTC-4, Umpei Kurokawa wrote: Is it possible to insert or append Row objects to Rows? --
[web2py] Re: web2py book on github
i think there are some problems in chapter The database abstraction layerhttp://www.web2py.com/books/default/chapter/29/06 after belongs anrej On Saturday, September 1, 2012 7:00:49 PM UTC+2, Massimo Di Pierro wrote: The web2py book app has been rewritten http://www.web2py.com/book and the source of the app and the book itself is now on github https://github.com/mdipierro/web2py-book/tree/master/sources Hopefully this will make it easier to keep it updated. You can just send me patches. You can also try run it yourself and see how it looks. It is no more db based. it is file based. The syntax is markmin as documented in the bok itself. Massimo --
[web2py] plugin_detect_mobile in Coockbook
in the book Application development cookbock there is plugin_detec_mobile (page 324) and there is a line, if switch_view: view = '%(controller)s/%(function)s.mobile.%(extension)s' % request if os.path.exists(os.path.join(request.folder, 'views',view)): response.view = view there is something wrong, but i don know how to correct this andrej --
[web2py] upgrade ubuntu to 12.04.1
hi i installed web2py with script found here. currently i have ubuntu 10.04. has anybody upgraded ubuntu from 10.04 to 12.04.1? are there any problems (regarding web2py or postgres 8.4)? should i upgrade or wait some time? andrej --
SOLVED Re: [web2py] Re: matplotlib plugin
thank you this is working example controller: import os, tempfile os.environ['MPLCONFIGDIR'] = tempfile.mkdtemp() import cStringIO import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import numpy as np def draw(): x = np.array([10, 8, 13, 9, 11, 14, 6, 4, 12, 7, 5]) y = np.array([8.04, 6.95, 7.58, 8.81, 8.33, 9.96, 7.24, 4.26, 10.84, 4.82, 5.68]) matplotlib.pyplot.clf() plt.plot(x, y,'ro-') plt.ylabel('label y') body = cStringIO.StringIO() plt.savefig(body) return body.getvalue() def image(): return dict(a=IMG(_src=URL('draw'+'.png'))) view: {{extend 'layout.html'}} h1This is the graf/image.html template/h1 {{=a}} just one question: how can i omit function slika? how can i include 'return dict(...' in funtion draw()? andrej
[web2py] SOLVED Re: Inline image generation with matplotlib
this works controller: def image(): return dict(a=IMG(_src=URL('myimage'+'.png'))) view: {{extend 'layout.html'}} h1This is the graph/image.html template/h1 {{=a}} but this doesn't controller: def image(): return myimage() view: {{extend 'layout.html'}} h1This is the graph/slika1.html template/h1 {{=IMG(_src=URL('myimage'+'.png'))}}
[web2py] Re: matplotlib plugin
i've installed the latest verson of matplotlib (from source, also libpng and freetype) now matplotlib is working but using MATLAB a lot, i have one question: is it possible to usematplotlib.pyplot instead of matplotlib api (matplotlib.figure) and not saving the file (sendign directly to view)? or si pyplot only for gui programming? Andrej
[web2py] Re: Inline image generation with matplotlib
controller/myimage does not work for me, it displays content of png file controller/myimage.png does display html with included image it looks like the view has no effect so i tried {{=IMG(_src=URL('myimage.png'))}} it displays content of png file, overriding everythin else in the view any suggestions?
[web2py] Re: Inline image generation with matplotlib
controller: def myimage(): import cStringIO fig=Figure() canvas=FigureCanvas(fig) stream=cStringIO.StringIO() canvas.print_png(stream) return stream.getvalue() view: {{extend 'layout.html'}} h1This is the graph/myimage.html template/h1 {{=IMG(_src=URL('myimage'))}} resault (../graph/myimage): �PNG ��� IHDR���������5 ... it it the same if i remove the line {{=IMG(_src=URL('myimage'))}} from view adding .png to the url or response.headers['Content-Type']='image/png' to the controller displays the image, but nothing else
[web2py] Re: matplotlib plugin
probably problem with mod_wsgi any solutions? andrej
[web2py] Re: matplotlib plugin
the line #os.environ['MPLCONfigureDIR'] = tempfile.mkdtemp() should be os.environ['MPLCONFIGDIR'] = tempfile.mkdtemp() but now there is this error: * Traceback (most recent call last): File /home/www-data/web2py/gluon/restricted.py, line 194, in restricted exec ccode in environment File /home/www-data/web2py/applications/test/models/plugin_matplotlib.py, line 4, in module from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas File /home/www-data/web2py/gluon/custom_import.py, line 294, in __call__ fromlist, level) File /home/www-data/web2py/gluon/custom_import.py, line 78, in __call__ level) File /usr/lib/pymodules/python2.6/matplotlib/backends/backend_agg.py, line 28, in module from matplotlib.backend_bases import RendererBase,\ File /home/www-data/web2py/gluon/custom_import.py, line 294, in __call__ fromlist, level) File /home/www-data/web2py/gluon/custom_import.py, line 78, in __call__ level) File /usr/lib/pymodules/python2.6/matplotlib/backend_bases.py, line 29, in module import matplotlib.cbook as cbook AttributeError: 'module' object has no attribute 'cbook' *** import matplotlib.cbook as cbook works in cli andrej
[web2py] matplotlib plugin
using matplotlib plugin there http://web2py.com/plugins/static/web2py.plugin.matplotlib.w2p i get error RuntimeError: Failed to create /var/www/.matplotlib; consider setting MPLCONFIGDIR to a writable directory for matplotlib configuration data (it is on ubuntu+apache) (how) should i change the line os.environ['MPLCONfigureDIR'] = tempfile.mkdtemp() or which directory shoul i change (probably permissions) andrej
[web2py] Re: SOLVED join and sum - display in view
with row[sum] it doesn't work type 'exceptions.KeyError'('built-in function sum') Actually, the above will only work if the controller returns 'sum' in the dictionary -- otherwise it will be undefined in the view. what shoul i change in the controller?
[web2py] SOLVED join and sum - display in view
working example controller: def person(): sum = db.t_payement.f_value.sum() rows= db().select(db.t_person.f_name,db.t_person.f_surname,db.t_person.f_city, sum, groupby=db.t_person.id, left=db.t_payement.on(db.t_person.id==db.t_payement.f_person)) return dict(rows=rows, sum=sum) view: {{for row in rows:}} {{=TR(TD(row.t_person.f_name),TD(row[sum]))}} {{pass}}
[web2py] Re: join and sum - display in view
controller: def person(): sum = db.t_payement.f_value.sum() rows= db().select(db.t_person.f_name,db.t_person.f_surname,db.t_person.f_city, sum, groupby=db.t_person.id, left=db.t_payement.on(db.t_person.id==db.t_payement.f_person)) return dict(rows=rows) view: {{=TR(TD(row.t_person.f_name,' ',row.t_person.f_surname),TD())}} i want to display sum of payments for each person in headers of table ({{=BEAUTIFY(response._vars)}}) in default view this is shown as SUM(t_payement.f_value)
[web2py] SOLVED join and sum - display in view
this one works TD(row['SUM(t_payement.f_value)']) and also this TD(row._extra['SUM(t_payement.f_value)'])
[web2py] represent, format in view
requires = IS_IN_DB(db,'tag.id',db.tag._ format,multiple=True) displays format of tag in dropdown while editing how to display format in view. doing row.tag displays id is it different if format of tag is lambda function? andrej
[web2py] join and sum - display in view
in controler i do join and sum the result si rows object in response._vars the sum is displayed in SUM(t_table.f_field) what is the syntax to display that in view? andrej
[web2py] SOLVED: compute field and reference
there are two ways: db.define_table('quantity', Field('value','integer')) db.define_table('item', Field('unit_price','double'), Field('quantity',db.quantity), Field('total_price', compute=lambda r: r['unit_price']*db.quantity[r.quantity].value)) or compute=lambda r: r['unit_price'] *db.quantity(r['quantity']).value
[web2py] compute field and reference
what is the syntax of compute, if i use reference in the table definition db.define_table('item', Field http://www.web2py.com/book/default/docstring/Field('unit_price','double'), Field http://www.web2py.com/book/default/docstring/Field('quantity',db.quantity), Field http://www.web2py.com/book/default/docstring/Field('total_price', compute=lambda r: r['unit_price']*r['?'])) entering'quantity' it uses id of that field andrej
[web2py] Re: table, grid, smartgrid, getting better
hi how could i add a sum in the linked table? i have person, linked table payments. Opening the payments table from person table, displaying only payments from that person, i would like to display the sum for that person. How can i do that? and how to change the label on button 't_payments'? andrej
[web2py] smartgrid, linked tables and columns
hi i have def person_manage(): columns = ['t_person.id','t_person.f_name','t_oseba.f_surname','t_oseba.f_email'] linked_tables = ['t_message'] form = SQLFORM.smartgrid(db.t_oseba,linked_tables=linked_tables,columns=columns,onupdate=auth.archive) return locals() without columns=columns it works fine but adding columns=columns clicking on t_message displays grid without columns (no data) there are still buttons edit, view, delete and they work but there are no columns of data application was made by wizzard
[web2py] date field without year
hi i want to insert a date, bust just a day and a mont, without a year is that possible? andrej
[web2py] Odg.: Re: Web2py Full Text Search Options
why is the first part def keywords(record): return list(set(x.lower() for re.compile('\w +').findall(record.content or ''))) raising an error in syntax andrej
[web2py] crud.search results
hi crud.search returns form and rows 1. is it possible to set that rows object (result of search) contains all data from table, not just fields, that are checked in search form 2. after doing search, is it possible to display just a result (rows), without form so the result of searching for courses would be course1 edit viev clicking 'view' would display course1 and clicking the back button (in browser) would go to search result (without asking for doing a query again) is this possible? andrej
[web2py] jquery mobile switch in view
hi is it possible to create a site with a switch like chosing a language (http://vimeo.com/7520812) but instead of language i would like to select which version of a view i woul like to see: desktop or mobile so the first line in i view would be: extend layout.html or extend plugin_jqmobile/layout.html as i know i can not put {{extend ... inside if statement and {{extend ... should bee the first statement andrej
[web2py] date internationalization in view
in model i have T.force('sl-si') and db.course.date.requires = IS_DATE(T('%Y-%m-%d')) in language fiel i have %Y-%m-%d %d %m %y in SQLFORM (od crud) and also the calendar widget it si ok but how can i display date in right format in view where i have for row in TD(row.date) andrej
[web2py] date internationalization in view (solved)
it works, thank you but it is hardcoded this is better TD(row.date.strftime(str(T('%Y-%m-%d'))) andrej
[web2py] Odg.: Re: Odg.: Re: Odg.: Re: 1.95.1 - Field delete_this_record does not belong to the table
hi i'm running 1.97.1 now. the problem in table racun SyntaxError: Field delete_this_record does not belong to the table was gone in previosu version but the problem with table with images (upload filed) is still here the model db.define_table('izobrazevanje', Field('ime','string',label='ime izobraževanja'), Field('logo_raster','upload',label='logotip (web)'), Field('logo_vector','upload',label='logotip (vektor)'), Field('logo_highres','upload',label='logotip (print)'), Field('datum_zacetka','date',label='začetek'), Field('datum_konca','date',label='konec'), ... db.izobrazevanje.logo_raster.requires = IS_EMPTY_OR(IS_IMAGE(extensions=('jpeg', 'png', 'jpg'))) db.izobrazevanje.logo_vector.requires = IS_EMPTY_OR(IS_UPLOAD_FILENAME(extension=('svg|svgz'))) db.izobrazevanje.logo_highres.requires = IS_EMPTY_OR(IS_UPLOAD_FILENAME(extension=('jpg|tiff|jpeg|png|tif'))) the controler @auth.requires_login() def izobrazevanje_uredi(): form=crud.update(db.izobrazevanje,request.args(0)) if form.accepts(request.vars, session): session.flash = 'podatki o izobraževanju so posodobljeni' redirect(URL(izobrazevanja)) elif form.errors: response.flash = 'napaka' else: response.flash = 'uredi podatke o izobraževanju' return dict(form=form) + in the view: + {{extend 'layout.html'}} h2Uredi izbrano izobraževanje/h2 {{=form}} error: Traceback (most recent call last): File C:\db\Dropbox\web2py\gluon\restricted.py, line 192, in restricted exec ccode in environment File C:/db/Dropbox/web2py/applications/test7/controllers/izobrazevanje.py http://127.0.0.1:8000/admin/default/edit/test7/controllers/izobrazevanje.py, line 98, in module File C:\db\Dropbox\web2py\gluon\globals.py, line 137, in lambda self._caller = lambda f: f() File C:\db\Dropbox\web2py\gluon\tools.py, line 2448, in f return action(*a, **b) File C:/db/Dropbox/web2py/applications/test7/controllers/izobrazevanje.py http://127.0.0.1:8000/admin/default/edit/test7/controllers/izobrazevanje.py, line 15, in izobrazevanje_uredi if form.accepts(request.vars, session): File C:\db\Dropbox\web2py\gluon\sqlhtml.py, line 1203, in accepts self.table._db(self.table._id == self.record.id).update(**fields) File C:\db\Dropbox\web2py\gluon\dal.py, line 5403, in update fields = self.db[tablename]._listify(update_fields,update=True) File C:\db\Dropbox\web2py\gluon\dal.py, line 4679, in _listify raise SyntaxError, 'Field %s does not belong to the table' % name SyntaxError: Field logo_highres__delete does not belong to the table ++ request.vars +++ post_vars: cena: Prohibition against the latter part of things dr. It may. datum_konca: 2008-01-04 datum_zacetka: 2008-02-24 id: 23 ime: Joomla predloge info: Vitiated air to travel from 5. 10 000 of electricity. kraj_izvedbe: Mild temperatures; man 167 photo: mount wilson observatory. fig. logo_highres: logo_raster: logo_vector: metoda: Wasted in estuaries penetrated into the saying. It effected by. namenjen: Cocosadu narocnik: 27 odgovorna_oseba: 38 opis: Boxes golden age and mammals--with their muddy feet are made great invasions of amphibians which the flowing of the mind is passing through one on the case of hearing is that the absence of all thoughtful men. we have only or even more definitely the variations in part of natural death is a stone and in the climax in skeleton of expressing feelings and love hunger and began to. opomba: Churning water on the parts in the work. the centre in. organizator: Stuck together as distinguished man were born child of doing when. pomocnik: 31 pomocnik2: 24 stevilo_mest: 27 trajanje: 16 voditelj: 15 vsebine: Comet--the stellar system for a mass and that live on mars the development of the surface-atoms of water out a long history of the earth slowing down and hard work of the stream gripping teeth in the surface bodies are so long gripping teeth in the surface bodies are so long ipping teeth in the surface bodies are so long znanja: Aquatic locomotion 192 photo: rotating on the suggestion of some.
[web2py] Odg.: Re: Odg.: Re: Odg.: Re: 1.95.1 - Field delete_this_record does not belong to the table
i have changed form=crud.update(db.izobrazevanje,request.args(0)) to form=SQLFORM(db.izobrazevanje,request.args(0),deletable=True, upload=URLhttp://web2py.com/book/default/docstring/URL ('download')) now it is ok andrej
[web2py] web2py in dropbox folder
hi on win7 i have web2py in dropbox folder, so i can work on applications from two computers (and to have a backup) but now i'm getting this error quite often: IOError: [Errno 22] invalid mode ('w') or filename: 'C:..\\Dropbox\\...\\databases\\c8b669d15150d7109e5f7_izobrazevanje.table' Could this be because dropbox is *syncing the files? andrej *
[web2py] import reportlab
hi i installed web2py with a script setup-web2py-ubuntu.sh on ubuntu (vps) in the script, there is installation of reportlab on windows machine i have put the reportlab in site-packages folder and i have added some fonts when i move my application to vps ubuntu server and doing from reportlab.pdfbase import pdfmetrics does it import from site-packages or from ubuntu and pdfmetrics.registerFont(TTFont('DejaVuSerif', 'DejaVuSerif.ttf')) does this register font from site-packages? is it better to put reportlab in site-packages or using one installed on server does reportlab work (with fonts) on GAE? andrej
[web2py] date to datetime
i model i have Field('datum_start','date',label='začetek'), in controller i want to convert datum_start to datetime object (to manipulate it with python) how can i do that? andrej
[web2py] Odg.: Re: Odg.: Re: Odg.: Re: 1.95.1 - Field delete_this_record does not belong to the table
i'm sorry. my mistake here is the whole thing: in db.py + db.define_table('racun', Field('stevilka_racuna','integer',label='številka računa'), Field('datum_racuna','date',label='datum računa'), Field('datum_dobave','date',label='datum dobave'), Field('zapadlost','date',label='zapadlost'), Field('sklic','integer',label='sklic'), Field('placnik',db.oseba,label='plačnik'), Field('placano','boolean',label='plačano'), Field('opomba','string',label='opomba'), Field('sporocilo_kupcu','string',label='sporočilo kupcu'), format='%(stevilka_racuna)s %(datum_racuna)s') db.racun.stevilka_racuna.requires=IS_NOT_EMPTY() db.racun.zapadlost.requires = IS_EMPTY_OR(IS_DATE()) db.racun.placnik.requires=IS_IN_DB(db,'oseba.id','%(ime)s %(priimek)s') + in controller racun.py ++ @auth.requires_login() def racun_uredi(): # urejanje računa racun = db(db.racun.id==request.args(0)).select().first() form=crud.update(db.racun,request.args(0)) if form.accepts(request.vars, session): session.flash = 'račun je posodobljen' redirect(URL(racuni)) elif form.errors: response.flash = 'napaka' else: response.flash = 'uredi račun' return dict(form=form) + in view racun_uredi.html + {{extend 'layout.html'}} h2Uredi račun/h2 {{=form}} + ticket + Traceback (most recent call last): File ...gluon\restricted.py, line 181, in restricted exec ccode in environment File .../controllers/racun.py, line 65, in module File ...\web2py\gluon\globals.py, line 133, in lambda self._caller = lambda f: f() File ...\web2py\gluon\tools.py, line 2335, in f return action(*a, **b) File .../controllers/racun.py, line 26, in racun_uredi if form.accepts(request.vars, session): File ...\gluon\sqlhtml.py, line 1200, in accepts self.table._db(self.table.id == self.record.id).update(**fields) File ...\gluon\dal.py, line 5173, in update fields = self.db[tablename]._listify(update_fields,update=True) File ...gluon\dal.py, line 4464, in _listify raise SyntaxError, 'Field %s does not belong to the table' % name SyntaxError: Field delete_this_record does not belong to the table request.vars + post_vars: datum_dobave:2011-04-03 datum_racuna:2011-04-03 id:1 opomba: placnik:2 sklic:1 sporocilo_kupcu: stevilka_racuna:1 zapadlost: + get_vars is empty it is the same mistake in trunk and in current andrej
[web2py] Odg.: Re: Odg.: Re: 1.95.1 - Field delete_this_record does not belong to the table
vars: datum_dobave: 2011-04-03 datum_racuna: 2011-04-03 id: 1 opomba: placnik: 2 sklic: 1 sporocilo_kupcu: stevilka_racuna: 1 zapadlost: get_vars is empty
[web2py] 1.95.1 - Field delete_this_record does not belong to the table
After upgrading to 1.95.1 (on windows, from source) get error: Traceback (most recent call last): File ...\gluon\restricted.py, line 181, in restricted exec ccode in environment File .../controllers/racun.py http://127.0.0.1:8000/admin/default/edit/test7/controllers/racun.py, line 65, in module File ...\gluon\globals.py, line 133, in lambda self._caller = lambda f: f() File ...\gluon\tools.py, line 2335, in f return action(*a, **b) File .../controllers/racun.py, line 26, in racun_uredi if form.accepts(request.vars, session): File ...\gluon\sqlhtml.py, line 1200, in accepts self.table._db(self.table.id == self.record.id).update(**fields) File ...\gluon\dal.py, line 5173, in update fields = self.db[tablename]._listify(update_fields,update=True) File ...\gluon\dal.py, line 4464, in _listify raise SyntaxError, 'Field %s does not belong to the table' % name SyntaxError: Field delete_this_record does not belong to the table in controller i change crud.update() to crud.update( ,deletable=False) and the error is gone but in the form with upload fields i now get: Traceback (most recent call last): File ...\gluon\restricted.py, line 181, in restricted exec ccode in environment File .../controllers/izobrazevanje.py, line 98, in module File ...\gluon\globals.py, line 133, in lambda self._caller = lambda f: f() File ...\gluon\tools.py, line 2335, in f return action(*a, **b) File .../controllers/izobrazevanje.py, line 15, in izobrazevanje_uredi if form.accepts(request.vars, session): File ...\gluon\sqlhtml.py, line 1200, in accepts self.table._db(self.table.id == self.record.id).update(**fields) File ...\web2py\gluon\dal.py, line 5173, in update fields = self.db[tablename]._listify(update_fields,update=True) File ...\gluon\dal.py, line 4464, in _listify raise SyntaxError, 'Field %s does not belong to the table' % name SyntaxError: Field logo_highres__delete does not belong to the table logo_highres is upload filed this was not a problem in previous version (1.94)
[web2py] Odg.: Re: 1.95.1 - Field delete_this_record does not belong to the table
it is not (in 2011-05-05) but there is one difference: even when deletable is enabled, i first get the error (when there is an upload field) Field logo_highres__delete does not belong to the table andrej
[web2py] pluginwiki and meta-menu
in meta-menu page in plugin-wiki i define menu link as Person page:person and this leads to url application/plugin_wiki/page/person what if i want to add link to application/person (not inside plugin_wiki) what is the syntax, if i don't want to include http://www.example.com/application...; in meta-menu file? andrej
[web2py] IS_IMAGE vs IS_UPLOAD_FILENAME
in IS_IMAGE i can use extensions: iterable containing allowed image file extensions in lowercase in IS_UPLOAD_FILENAMe i can use extension: extension (after dot) regex is there a special reason why there is not an option to use iterable in IS_UPLOAD_FILENAME i want to chek if the file is svg or svgz. andrej
[web2py] include svg files in view
hi how can i include a svg (or maby even svgz) file in view? can i do something similar as with image img src={{=URL('download', args=row.table.logo_image)}} / i tried this object type=image/svg+xml data={{=URL('download', args=row.table.logo_svg)}} span//object but it doesn't work andrej
[web2py] Re: IS_IMAGE vs IS_UPLOAD_FILENAME
nice.
Re: [web2py] Re: Only 1 {{extend ...}} allowed in a view ?
as i have read, {{extends should be the first line in the view so it is not possible to do this? {{if condition:}} {{extends 'layout1.html'}} {{else:}} {{extends 'layout2.html'}} ... andrej
[web2py] Re: PDF writing under GAE
hi pyftpdf (included in web2py) does not have unicode support does anybody know are there some unicode problems in reportlab too? maby font problems? i would like to see code example for reportlab on gae (since the example in the book does not work :) andrej On Apr 5, 3:15 pm, Massimo Di Pierro massimo.dipie...@gmail.com wrote: It would be nice if fpdf were to work on GAE out of the box. Moreover I think PIL is available on GAE. On Apr 5, 5:19 am, Martín Mulone mulone.mar...@gmail.com wrote: Well I browse the code of fpdf.py and pil is only using to check is the file is and image format, I think is easy to do to support gae, changing in gae to api or make the check like IS_IMAGE from web2py. Anyways there are other tools you can use to write pdf reports like PISA, Reportlab. 2011/4/5 Arbie Samong phek...@gmail.com @martin - that helped me passed the try-except block at the beginning, but when the Image module is used on the other parts of the code it went haywire. I'll look into it probably more changes to make it adapt with GAE. @howesc - I was able to make it work without using the file system read and write, but this is like heaven sent :) On Apr 5, 3:11 am, howesc how...@umich.edu wrote: hopefully not a red herring, but google gave us gifts last week, one of them was file reading and writing from the blobstore: http://googleappengine.blogspot.com/2011/03/announcing-app-engine-143... i have not looked at how to connect things to it, but might help here. cfh -- My blog:http://martin.tecnodoc.com.ar Expert4Solution:http://www.experts4solutions.com/e4s/default/expert/6http://www.cvsta...
[web2py] list:reference - in which table, widget
hi as i understand on GAE many to many relationships should be done by list:reference. i have two questions: - having table with 1000 persons and another table with 100 courses (each person can attend multiple courses) what is better: putting list:reference in first table (person) or second (course)? - with 'list:reference table' and table having lots of data, the default widget (multiselect) it is not practical. what is the most effective way for selecting and adding (multiple) data andrej
[web2py] thinking in nosql (for GAE)
Hi I have some experience in RDB system (mysql, access), I have done some work in zope (object oriented database), and now I would like to try some things in nosql. So I have some questions 1. where can I find some useful resource for nosql 2. what can I do in design of my application to be nosql (GAE) friendly 3. I have read that sql is coming to GAE. is it worth bothering about nosql now
[web2py] Re: Crud.select
maby it should be like WebGrid :) On Nov 13, 7:14 am, mdipierro mdipie...@cs.depaul.edu wrote: Probably yes. I am not happy with crud.select. I think it should do pagination for example too and have sortable columns and perhaps have a an option to include crud.select(). Massimo On Nov 12, 10:47 pm, mr.freeze nat...@freezable.com wrote: I know. I'm asking if it should. Would you take a patch? On Nov 12, 10:42 pm, mdipierro mdipie...@cs.depaul.edu wrote: No it does not. On Nov 12, 8:41 pm, mr.freeze nat...@freezable.com wrote: Should Crud.select honor record level auth permissions when returning records? Right now it only filters by table.
[web2py] Re: linked tables and dropdown display
tank you that solves my problem andrej On 10 nov., 21:00, mdipierro mdipie...@cs.depaul.edu wrote: db.define.table('advanced' Field('name1',requires=IS_IN_DB(db,'basic.name1')), On Nov 10, 1:49 pm, andrej burja andrej.bu...@gmail.com wrote: hi is it possible to create a text field in table 'advandced' containing 'name1' (no reference, just characters) andrej On 10 nov., 15:22, mdipierro mdipie...@cs.depaul.edu wrote: ERRATA: do this: db.define.table('basic' Field('name1') ...,format='%(name1)s') db.define.table('advanced' Field('name2',db.basic) ...,format=lambda row: db.basic(row.name2).name1) # db.advanced.name.requires=IS_IN_DB(db,'basic.id','%(name1)s') db.define.table('data' Field('something',db.advanced) ...) but this is going to be SOOO slow. You are making two select per each row in the dropdown. On Nov 4, 8:59 am, mdipierro mdipie...@cs.depaul.edu wrote: do this: db.define.table('basic' Field('name1') ...,format='%(name1)s') db.define.table('advanced' Field('name2',db.basic) ...,format='%(name2)s') # db.advanced.name.requires=IS_IN_DB(db,'basic.id','%(name1)s') db.define.table('data' Field('something',db.advanced) ...)
[web2py] Re: readable=False not working with crud.select(db.table)
i'm using WebGrid for Web2py making a filed not readable (and writable) doesn't show them in edit or view but in grid, the fields are shown i know i can hide them by defining fields is this problem connected to that bug? On 22 okt., 15:07, Richard Vézina ml.richard.vez...@gmail.com wrote: ;-) Thank you! Richard On Fri, Oct 22, 2010 at 12:51 AM, mdipierro mdipie...@cs.depaul.edu wrote: It is a major bug. Fixed in trunk. On Oct 21, 9:22 am, Richard Vézina ml.richard.vez...@gmail.com wrote: Hello, I attach a demo app. http://127.0.0.1:8000/testapp/default/selection You can see all the columns although that sample_id is set to readable=False. Do I did something wrong? Richard web2py.app.testapp (1).w2p 104KViewDownload
[web2py] Re: validators order
thank you it is too obvious to see that i made replacement of the validators :) On Nov 4, 10:24 am, DenesL denes1...@yahoo.ca wrote: On Nov 3, 3:52 pm, andrej burja andrej.bu...@gmail.com wrote: hi why is order of validators important? i have db.tecaj.voditelj.requires=IS_NOT_EMPTY() db.tecaj.voditelj.requires=IS_IN_DB(db,'person.id','%(name)s') why does putting the IS_NOT_EMPTY() at the end doesn't produce dropdown list? Your code replaces one validator with another, it does not create a list with both. To have both and get a dropdown you need something like: db.tecaj.voditelj.requires=[IS_NOT_EMPTY(),IS_IN_DB(...)] do i need the IS_NOT_EMPTY() if i have IS_IN_DB validator? It depends on your data and model. In your case it is superfluous because you are storing an id which can not be empty. But if your requires was: IS_IN_DB(db,'person.name') and some entry in person.name was empty then you would need an IS_NOT_EMPTY validator to avoid having an empty entry. andrej
[web2py] Re: linked tables and dropdown display
does not work, still getting id and no name On Nov 4, 3:59 pm, mdipierro mdipie...@cs.depaul.edu wrote: do this: db.define.table('basic' Field('name1') ...,format='%(name1)s') db.define.table('advanced' Field('name2',db.basic) ...,format='%(name2)s') # db.advanced.name.requires=IS_IN_DB(db,'basic.id','%(name1)s') db.define.table('data' Field('something',db.advanced) ...)
[web2py] Re: linked tables and dropdown display
hi is it possible to create a text field in table 'advandced' containing 'name1' (no reference, just characters) andrej On 10 nov., 15:22, mdipierro mdipie...@cs.depaul.edu wrote: ERRATA: do this: db.define.table('basic' Field('name1') ...,format='%(name1)s') db.define.table('advanced' Field('name2',db.basic) ...,format=lambda row: db.basic(row.name2).name1) # db.advanced.name.requires=IS_IN_DB(db,'basic.id','%(name1)s') db.define.table('data' Field('something',db.advanced) ...) but this is going to be SOOO slow. You are making two select per each row in the dropdown. On Nov 4, 8:59 am, mdipierro mdipie...@cs.depaul.edu wrote: do this: db.define.table('basic' Field('name1') ...,format='%(name1)s') db.define.table('advanced' Field('name2',db.basic) ...,format='%(name2)s') # db.advanced.name.requires=IS_IN_DB(db,'basic.id','%(name1)s') db.define.table('data' Field('something',db.advanced) ...)
[web2py] linked tables and dropdown display
hi i have db.define.table('basic' Field('name1') ...) db.define.table('advanced' Field('name2',db.basic) ...) db.advanced.name.requires=IS_IN_DB(db,'basic.id','%(name1)s') db.define.table('data' Field('something',db.advanced) ...) db.data.something.requires=IS_IN_DB(db,'advanced.id','%(name2)s') In the dropdown for data (in appadmin) i don't see name2, i see id i would like to see name2, which is identical to name1 is this possible?
[web2py] validators order
hi why is order of validators important? i have db.tecaj.voditelj.requires=IS_NOT_EMPTY() db.tecaj.voditelj.requires=IS_IN_DB(db,'person.id','%(name)s') why does putting the IS_NOT_EMPTY() at the end doesn't produce dropdown list? do i need the IS_NOT_EMPTY() if i have IS_IN_DB validator? andrej
[web2py] Re: pdf template
hi i would like to store the generated pdf directly in the database on gae andrej On Oct 5, 4:03 am, Mariano Reingart reing...@gmail.com wrote: On Mon, Oct 4, 2010 at 12:18 PM, andrej burja andrej.bu...@gmail.com wrote: is it possible to use pdf made from DTP application (like indesign,scribus) and merge it to new pdf (on GAE) - withpyfpdfor any other tool Scribus and Inkscape uses XML file formats. Maybe you can use some XML parser to extract graphics element coordinates (you can look at pysimplesoap.simplexml also included with web2py now):http://code.google.com/p/pysimplesoap/wiki/SimpleXmlElement I'm working on this, a basic svg2fpdf converter, to desing templates using inkscape. Generating a new PDF is possible, merging it may be difficult (if any open source tool even supports that) Additionally, there are some tools to import SVG (inkscape/sodipodi) directly to PDF. like having a template (pdf file) and adding name, surname etc. Yes, web2py supports PDF templates like the ones you are commenting, usingpyfpdf, and you don't need a file with the xml format, you can store it at the database, see:http://code.google.com/p/pyfpdf/wiki/Web2Py is it possible on GAE to directly store new file in database? I don't fully understand what you mean, but web2py andpyfpdfshould work on GAE. Best Regards, Mariano Reingarthttp://www.sistemasagiles.com.arhttp://reingart.blogspot.com
[web2py] running web2py from source on windows
hi i'm running web2py, latest version, on windows 7 from source (on python 2.6). i'm using firefox for file editing. editing files in admin, i can save changes with button only once, after that the button is dimmed i can save with ctrl + s the situation is the same in chrome is this normal? andrej
[web2py] body = TBODY(*rows)
hi looking at pyfpdf sample report can samebody explain sytax body = TBODY(*rows) andrej
[web2py] Re: crud.select syntax
so the example in book, chapter 7 is wrong? # assuming db.define_table('person', Field('name')) def people(): form = crud.create(db.person, next=URL('index'), message=T(record created)) persons = crud.select(db.person, fields=['name'], headers={'person.name', 'Name'}) return dict(form=form, persons=persons) On Oct 9, 8:03 am, rochacbruno rochacbr...@gmail.com wrote: crud.select expects 2 arguments crud.select(db.tablename, query) returns a list of records selected from the table. persons=crud.select(db.person, db.person.id0) Em 09/10/2010, às 02:07, andrej burja andrej.bu...@gmail.com escreveu: hi in model.py i have db.define_table('person', Field('name'), format='%(name)s') in controllers/default.py i have def ustvari_oseba(): form=crud.create(db.person) persons=crud.select(db.person) return dict(form=form,persons=persons) form is ok, but persons is not
[web2py] book, chapter 07
hi in the section about crud should there be def data(): return dict(form=crud()) def create_tablename(): def update_tablename(): instead of def data: return dict(form=crud()) def create_tablename: def update_tablename: and in # assuming db.define_table('person', Field('name')) def people(): form = crud.create(db.person, next=URL('index'), message=T(record created)) persons = crud.select(db.person, fields=['name'], headers={'person.name', 'Name'}) return dict(form=form, persons=persons) should there be headers={'person.name': 'Name'})
[web2py] crud.select syntax
hi in model.py i have db.define_table('person', Field('name'), format='%(name)s') in controllers/default.py i have def ustvari_oseba(): form=crud.create(db.person) persons=crud.select(db.person) return dict(form=form,persons=persons) form is ok, but persons is not
[web2py] format=
how or where should i define format representation for records if i put it in db.define_table: db.define_table('oseba', Field('ime'), Field('priimek'), Field('naslov'), Field('email',label='Elektronski naslov'), format='%(ime)s %(priimek)s') there is a id reference in SQLTABLE (not ime priimek) but if i put it in requires db.tecaj.oseba.requires=IS_IN_DB(db,'oseba.id','%(ime)s %(priimek)s') there is a ime priimek reference in SQLTABLE so it should be put in requires. or am i doing/understanding something wrong? where does the setting in db.define_table come in use?
[web2py] pdf template
is it possible to use pdf made from DTP application (like indesign,scribus) and merge it to new pdf (on GAE) - with pyfpdf or any other tool like having a template (pdf file) and adding name, surname etc. is it possible on GAE to directly store new file in database?
[web2py] Re: googling web2py
109 000 from Slovenia On 28 mar., 15:48, Tito Garrido titogarr...@gmail.com wrote: *108.000 from Brazil* On Sun, Mar 28, 2010 at 10:13 AM, Mengu whalb...@gmail.com wrote: 109K from Turkey. On 28 Mart, 15:14, Alfonso de la Guarda alfons...@gmail.com wrote: Hello, 110,000 from Perú Alfonso de la Guarda Centro Open Source(COS)http://www.cos-la.nethttp://alfonsodg.net Telef. 991935157 1024D/B23B24A4 5469 ED92 75A3 BBDB FD6B 58A5 54A1 851D B23B 24A4 On Sat, Mar 27, 2010 at 21:23, mdipierro mdipie...@cs.depaul.edu wrote: When you google web2py how may hits do you get? from which country? When I do it from the US I get ~106,000. The number has been steady for one year. Before that is was much higher ~600,000. When I did it from India the number was about ~550,000. Not that the number means anything but I am interested in building some statistics from different countries. Massimo -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.comweb2py%2bunsubscr...@googlegroups.com . For more options, visit this group athttp:// groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.comweb2py%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/web2py?hl=en. -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___ -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.