[web2py] Re: Are there conditions under which labels are not shown in SQLForm ?
show us the code you're using to override them, and the model of the underlying table On Friday, January 18, 2013 3:54:15 AM UTC+1, GeeksRule wrote: I have an SQLForm, and have a dictionary of labels, but they aren't been overriden : {'fname':'First name: ', 'lname':'Last name : ', 'Published_Datetime':'Date when you published : '} here fname is the column name in th database. are there any conditions where the labels I provide won't work ? --
[web2py] Re: Problems with auth.login_bare when using postgres
but as soon as you change the dal uri with the same model the first request will create the database tables. then you can import the data with a csv.. On Friday, January 18, 2013 12:20:29 AM UTC+1, Daniel Gonzalez wrote: M, not really: I still need to create the database. Maybe web2py can do that for me if I start with a blank postgres database, but I am not familiar with that, so this was an easier path for me. By the way, I found out another problem: we need serial PRIMARY KEY, so the sed script must be changed to include: s/INTEGER PRIMARY KEY AUTOINCREMENT/serial PRIMARY KEY/ And the postgres sequences must be initialized after import: select setval(pg_get_serial_sequence('auth_user' , 'id'), (selectmax (id) from auth_user) ); select setval(pg_get_serial_sequence('fulluser', 'id'), (selectmax (id) from fulluser) ); select setval(pg_get_serial_sequence('auth_group' , 'id'), (selectmax (id) from auth_group) ); select setval(pg_get_serial_sequence('auth_membership' , 'id'), (selectmax (id) from auth_membership) ); select setval(pg_get_serial_sequence('auth_permission' , 'id'), (selectmax (id) from auth_permission) ); select setval(pg_get_serial_sequence('auth_event' , 'id'), (selectmax (id) from auth_event) ); select setval(pg_get_serial_sequence('auth_cas', 'id'), (selectmax (id) from auth_cas) ); On Thursday, January 17, 2013 8:52:03 PM UTC+1, Niphlod wrote: yep, probably exporting all to csv and reimporting would have you saved a bit of hassle. On Wednesday, January 16, 2013 5:43:09 PM UTC+1, Daniel Gonzalez wrote: I found the problem: CHAR fields in postgres (the default that the .dump command in sqlite is generating) will be extended with spaces to fill the available length in postgres, so that username/password do not match anymore. I have modified my import script like this: import_from_sqlite_ ( ) { # Set the following: # WEB2PY_PG_DB : the name of the database in postgres to import to # SQLITE_FILE: the location of the sqlite file # PG_USER : the postgres user # PG_PWD : the potgres password # sql_dump=/tmp/from_sqlite.sql # Dump the data: # - PRAGMA and AUTOINCREMENT are not supported in postgres # - sqlite_sequence is specific to sqlite # - CHAR will have fixed size in postgres, so it will be filled with empty spaces. Use VARCHAR instead. sqlite3 $SQLITE_FILE .dump | sed -e '/^PRAGMA/d;/sqlite_sequence/d;s/AUTOINCREMENT//;s/ CHAR/ VARCHAR/' $sql_dump # Drop / recreate database sudo -u postgres dropdb $WEB2PY_PG_DB sudo -u postgres createdb -O $PG_USER -E UTF8 $WEB2PY_PG_DB # Import the data sudo -u postgres PGPASSWORD=$PG_PWD psql -h localhost -U $PG_USER -d $WEB2PY_PG_DB $sql_dump # Show some data, to see if the import worked fine sudo -u postgres psql -l echo \dt | sudo -u postgres psql -d $WEB2PY_PG_DB echo select * from auth_user; | sudo -u postgres psql -d $WEB2PY_PG_DB rm -f $sql_dump } Be careful with this, since it will drop and recreate the database. Also, the changes to the sqlite dump are very specific to my situation. YMMV. On Wednesday, January 16, 2013 4:06:23 PM UTC+1, Daniel Gonzalez wrote: Hi, The following code was working when using SQLite, and now that I have moved to postgres it is failing: auth.login_bare(request.vars.email, request.vars.password) I have the passwords for the time being in plaintext, both in postgres and SQLite. I have imported the data to postgres like this: # PRAGMA and AUTOINCREMENT are not supported in postgres # sqlite_sequence is specific to sqlite sqlite3 storage.sqlite .dump | sed -e '/^PRAGMA/d;/sqlite_sequence/d;s/AUTOINCREMENT//' /tmp/from_sqlite. sql sudo -u postgres PGPASSWORD=mypass psql -h localhost -U myuser -d web2py_wavportal /tmp/from_sqlite.sql I have verified that the data in postgres looks fine: web2py_wavportal=# \dt List of relations Schema | Name | Type | Owner +-+---+--- public | auth_cas| table | wavportal public | auth_event | table | wavportal public | auth_group | table | wavportal public | auth_membership | table | wavportal public | auth_permission | table | wavportal public | auth_user | table | wavportal public | fulluser| table | wavportal (7 rows) The credentials in auth_user are as expected, but auth.login_bare is failing. Why could that be? Thanks, Daniel --
[web2py] Re: How do you change memcache session expiry?
Hi all, I have just tried the solution proposed on the issue but it doen't work. This is a really annoying bug not only because I have to login several times in a day but also because I can lose my edits if I don't save my changes in time (i.e, editing a wiki page). It might be better to remove from the book the advise of storing the session in memcached unless we find a solution Paolo Il giorno domenica 30 settembre 2012 00:54:03 UTC+2, Robert Clark ha scritto: Thanks everyone, have added an issue http://code.google.com/p/web2py/issues/detail?id=1049 On Sunday, September 30, 2012 3:51:10 AM UTC+13, Massimo Di Pierro wrote: It also looks to me memdb should not be implemented as it is. It should be implemented as a plugin_adapter for DAL. On Saturday, 29 September 2012 09:50:37 UTC-5, Massimo Di Pierro wrote: I would prefer the syntax: session.connect(request, response, db=MEMDB(cache.memcache, session_expiry=3600)) On Saturday, 29 September 2012 07:11:10 UTC-5, Niphlod wrote: yep, open a bug on http://code.google.com/p/web2py/issues/list On Saturday, September 29, 2012 5:24:07 AM UTC+2, Robert Clark wrote: Thanks, I am not having any problems with the memcached api python interface, that part all works as advertised. The problem is that if you follow the deployment recipe for storing sessions in Memcached, then they always expire after 300s and there's no way to provide an expiry. Here's what's the code from deployment recipe chapter of web2py book: from gluon.contrib.memcache import MemcacheClientmemcache_servers = ['127.0.0.1:11211'] cache.memcache = MemcacheClient(request, memcache_servers) cache.ram = cache.disk = cache.memcache ..and.. from gluon.contrib.memdb import MEMDB session.connect(request,response,db=MEMDB(cache.memcache)) If you do this and connect to memcached with e.g. -vv you can see that session data is passed in with 300s expiry. I may be missing something obvious. Can I suggest altering the API to be something like this: session.connect(request, response, db=MEMDB(cache.memcache), session_expiry=3600) Thanks! On Saturday, September 29, 2012 12:27:55 AM UTC+12, Jose C wrote: The only way I've found to change this is to explicitly modify the default value from this source file. Is there a better way to configure this value for session expiry from within application code? Cheers. Far as I know it's done like this: set(key=key, value=value, time=seconds) where (from the source): @param time: Tells memcached the time which this value should expire,either as a delta number of seconds, or an absolute unix time-since- the-epoch value. See the memcached protocol docs section Storage Commands for more info on exptime. We default to 0 == cache forever. Are you saying that doesn't work? --
Re: [web2py] Re: Strange behavior storing data - web2py 2.3.2 - Mac OS X 10.7.5
Hi guys, You were right, first I've removed the try/except so the error tickets appeared. birthday= datetime.strptime(data['birthday'],'%d/%m/%Y' ).strftime('%Y-%m-%d'), ---this is the problem. The issue was involved with dates format(locale), due that facebook users can be es_LA, es_ES, en_US, etc; the date formats are different so now I'm doing some research about how to deal with them and convert them automatically to db 'date' format: -MM-DD. Lot of thanks for your help :) -- Atte Luciano Laporta Podazza --
[web2py] Specify my own controller for @auth.requires_login()
Hi, Whenever my login expires, web2py redirects to application/default/user/login?_next=next_url. Since I have a customized login controller, I would like to redirect to it whenever the login expires. Is it possible to configure @auth.requires_login() to point to my own controller? Thanks, Daniel --
Re: [web2py] Specify my own controller for @auth.requires_login()
auth = Auth(db, controller=foo, function=bar) --
[web2py] Need webvtt entry in gluon/contenttype.py
http://dev.w3.org/html5/webvtt/#text/vtt http://www.w3.org/community/texttracks/2012/08/23/webvtt-support-in-browsers/ I know the format is still pretty bleeding edge, but it seems to be gaining support amongst browser manufacturers. I can see why. It is a very good concept I find. I think supporting it would be a good proactive move (and would save me the trouble of having to update the contenttype.py file each time I download the latest version of web2py :P). Thanks. --
[web2py] latex plugin and software for website template
- I am building a QA site using web2py and need to create a web page template. What software do you guys recommend ( I am a complete newbie in template designing)? - Does web2py have a Latex editor plugin that I can use in my comment editor? Thanks, Neel Sheyal --
[web2py] how to support video in an app
at the moment, i can let users upload pictures and use the img tag to allow the image to be displayed on a page, when users upload videos, how do i allow the videos to display and play on the page... and if users submit a youtube link, how do i grab the embed code to display the video on the page? --
[web2py] restful api :field behaviour change
Hello all, currently the :field placeholder in a restful pattern will retrieve said field only for the first record from the resulting set. I believe that this should be changed so that it retrieves the field for all records in the set. To illustrate using the latest trunk, this pattern (note the new syntax that can now include a query): ('/dogs[pet]', db.pet.genus=='dog') will retrieve all dogs from the pet table, but adding a :field to the pattern: ('/dogs[pet]/:field', db.pet.genus=='dog') will only retrieve the specified field for the first dog in the previous set. This also begs the question: how to retrieve more than one field?. Should it be another parameter in the pattern? e.g. ('/dogs[pet]', db.pet.genus=='dog', [list-of-field-names]) Your input is welcome. Denes --
[web2py] Re: SQLFORM.grid with multiple LEFT OUTER JOINs
Hi Jim, from the book: Multiple left joins can be combined by passing a list or tuple of db.mytable.on(...) to the left attribute. Denes --
[web2py] SQLFORM.grid and the maxtextlength parameter: The parameter doesnt work in my code
I have the controller: def commodities(): tbl = db.commodities fields = [tbl.itemcode,tbl.name,tbl.unit,tbl.supplier,tbl.contact] query = (tbl.id0) order = [tbl.itemcode] maxlen = {'commodities.itemcode':2,'commodities.name':2,'commodities.unit':2,'commodities.supplier':2,'commodities.contact':2} return dict(grid=SQLFORM.grid(query,fields=fields, csv=False, orderby=order,maxtextlength=maxlen)) The grid is working well, but not the maxtextlength parameter. If I set the parameter to 2, it's working but not when I'm setting all field individually. Has someone an idea? --
[web2py] Re: Grid with multiple left joins
Did anyone saw it? On Monday, January 14, 2013 5:41:36 PM UTC-2, Felipe Meirelles wrote: Please desconsider the sorter_icons parameter, its a custom implementation of mine. I can post this patch too if you think its relevant. Thanks! On Monday, January 14, 2013 5:38:53 PM UTC-2, Felipe Meirelles wrote: Hi, When you try to make more than one left join on a SQLFORM.grid as: grid = SQLFORMCustom.grid(db.device, fields=[db.device.serial, db.device.device_type, db.device.vehicle, db.vehicle.plate, db.chip.imei, ], field_id=db.device.id, left=[db.chip.on(db.chip.id==db.device.chip), db.vehicle.on( db.vehicle.id==db.device.vehicle)], paginate=max_results, showbuttontext=False, formstyle='divs', paginate_icons=paginate_icons, sorter_icons=sorter_icons ) it can't display the join fields as it dosen't find the fields on the query in sqlhtml.py line 1083. Can you apply this patch on line 1083? if left is not None: if isinstance(left, (list)): for l in left: tablenames += db._adapter.tables(l) else: tablenames += db._adapter.tables(left) --
[web2py] Re: how to call sqlform from a view
Hi Alex, you can't call the function from the view, you would have to pass it somehow or re-define it there, but the question is why?. Normally you would just write {{=form}} in the view to display the form returned form the function. Regards, Denes --
[web2py] Re: crud+auth question
Hi Babu, do you also have a login function that would set your current user before any of this is run?. Regards, Denes --
Re: [web2py] SQLFORM.grid and the maxtextlength parameter: The parameter doesnt work in my code
Hello maxtextlength is for all fields, you need use maxtextlengths http://web2py.com/book/default/chapter/07#SQLFORM.grid-and-SQLFORM.smartgrid On Fri, Jan 18, 2013 at 9:40 AM, Sverre sverreodeg...@gmail.com wrote: I have the controller: def commodities(): tbl = db.commodities fields = [tbl.itemcode,tbl.name,tbl.unit,tbl.supplier,tbl.contact] query = (tbl.id0) order = [tbl.itemcode] maxlen = {'commodities.itemcode':2,'commodities.name ':2,'commodities.unit':2,'commodities.supplier':2,'commodities.contact':2} return dict(grid=SQLFORM.grid(query,fields=fields, csv=False, orderby=order,maxtextlength=maxlen)) The grid is working well, but not the maxtextlength parameter. If I set the parameter to 2, it's working but not when I'm setting all field individually. Has someone an idea? -- --
[web2py] Problem: SQLFORM.grid and setting a value for a field when a new dataset is created
I have a contact table that includes our employees too. To make a difference I have a cclass field to make the difference. When I want to create an employee the user should not have a choice to set the cclass field, but when he is creating a customer or supplier. So I tried in SQLFORM.grid the oncreate callback with this function: def setEmployeeClass(form): form.vars.cclass = 2 But this doesn't work. Has someone a tip? --
[web2py] Re: SQLFORM.grid with multiple LEFT OUTER JOINs
I tried that, but then I don't get any of my joined fields in the result. Here is what I used for the join. left = [db.feedOrder.on(db.feedLoad.feedLoadId==db.feedOrder.feedLoadId), db.feedOrderLine.on(db.feedOrder.feedOrderId==db.feedOrderLine.feedOrderId)] I get no fields from either feedOrder or the feedOrderLine tables, only fields from feedLoad. -Jim On Friday, January 18, 2013 5:39:03 AM UTC-6, DenesL wrote: Hi Jim, from the book: Multiple left joins can be combined by passing a list or tuple of db.mytable.on(...) to the left attribute. Denes --
[web2py] Re: SQLFORM.grid with multiple LEFT OUTER JOINs
I just saw this post as well: https://groups.google.com/forum/#!topic/web2py/T1TkWEu2cX4 Can we get his fix implemented? -Jim On Friday, January 18, 2013 8:21:35 AM UTC-6, Jim S wrote: I tried that, but then I don't get any of my joined fields in the result. Here is what I used for the join. left = [db.feedOrder.on(db.feedLoad.feedLoadId==db.feedOrder.feedLoadId), db.feedOrderLine.on(db.feedOrder.feedOrderId==db.feedOrderLine.feedOrderId)] I get no fields from either feedOrder or the feedOrderLine tables, only fields from feedLoad. -Jim On Friday, January 18, 2013 5:39:03 AM UTC-6, DenesL wrote: Hi Jim, from the book: Multiple left joins can be combined by passing a list or tuple of db.mytable.on(...) to the left attribute. Denes --
[web2py] Re: how to call sqlform from a view
Thanks Denes, but it seems that form doesn't uniquely identify anything, or is the return dict(form=form) the part that gives the output a unique name? I mean would other functions in the same controller have syntax to give distinguishing names such as return dict(form2=form2), and return dict(form3=form3), and return dict(form4=form4)? Thanks, Alex Glaros On Friday, January 18, 2013 3:48:29 AM UTC-8, DenesL wrote: Hi Alex, you can't call the function from the view, you would have to pass it somehow or re-define it there, but the question is why?. Normally you would just write {{=form}} in the view to display the form returned form the function. Regards, Denes --
[web2py] Re: how to call sqlform from a view
In web2py, each request runs only one action from a controller -- from within a view, you do not call other controller actions. If you want to display a form within a given page, you should create and return the form within the action for that page. If you need to re-use the code for the form, you can define a separate function to create the form and then simply call it from the main page's action. As an alternative, if you do really need to compose a single page from multiple separate re-usable actions, you can use componentshttp://web2py.com/books/default/chapter/29/12#Components . Anthony On Friday, January 18, 2013 2:06:17 AM UTC-5, Alex Glaros wrote: The example at http://web2py.com/books/default/chapter/29/07#SQLFORMshows this function below. But what is the syntax for calling a function from a view? Would it be this? {{=display_form()}} thanks, Alex Glaros def display_form(): form = SQLFORM(db.person) if form.process().accepted: response.flash = 'form accepted' elif form.errors: response.flash = 'form has errors' else: response.flash = 'please fill out the form' return dict(form=form) --
[web2py] Re: how to call sqlform from a view
a controller can contain multiple function, each one of them can have a return dict(afixedname=avalue) . when you use an url like /app/controller/display_a_form or /app/controller/display_a_form2 you may return the same dict with the same keys for both, the values are the one that will be different instances and will be serialized accordingly, generally using to your views/controller/display_a_form.html or views/controller/display_a_form2.html On Friday, January 18, 2013 3:47:28 PM UTC+1, Alex Glaros wrote: Thanks Denes, but it seems that form doesn't uniquely identify anything, or is the return dict(form=form) the part that gives the output a unique name? I mean would other functions in the same controller have syntax to give distinguishing names such as return dict(form2=form2), and return dict(form3=form3), and return dict(form4=form4)? Thanks, Alex Glaros On Friday, January 18, 2013 3:48:29 AM UTC-8, DenesL wrote: Hi Alex, you can't call the function from the view, you would have to pass it somehow or re-define it there, but the question is why?. Normally you would just write {{=form}} in the view to display the form returned form the function. Regards, Denes --
[web2py] Re: how to call sqlform from a view
SQLFORM names the form based on the name of the db table (as well as the type of form -- create or update). If you have multiple forms on the page, their names will not conflict unless they are based on the same db table, and in that case, you can specify your own unique form names via the formname argument to the .process() method. Anthony On Friday, January 18, 2013 9:47:28 AM UTC-5, Alex Glaros wrote: Thanks Denes, but it seems that form doesn't uniquely identify anything, or is the return dict(form=form) the part that gives the output a unique name? I mean would other functions in the same controller have syntax to give distinguishing names such as return dict(form2=form2), and return dict(form3=form3), and return dict(form4=form4)? Thanks, Alex Glaros On Friday, January 18, 2013 3:48:29 AM UTC-8, DenesL wrote: Hi Alex, you can't call the function from the view, you would have to pass it somehow or re-define it there, but the question is why?. Normally you would just write {{=form}} in the view to display the form returned form the function. Regards, Denes --
[web2py] Re: how to call sqlform from a view
Also, it might help if you indicate what you are trying to do. Anthony On Friday, January 18, 2013 9:57:23 AM UTC-5, Anthony wrote: SQLFORM names the form based on the name of the db table (as well as the type of form -- create or update). If you have multiple forms on the page, their names will not conflict unless they are based on the same db table, and in that case, you can specify your own unique form names via the formname argument to the .process() method. Anthony On Friday, January 18, 2013 9:47:28 AM UTC-5, Alex Glaros wrote: Thanks Denes, but it seems that form doesn't uniquely identify anything, or is the return dict(form=form) the part that gives the output a unique name? I mean would other functions in the same controller have syntax to give distinguishing names such as return dict(form2=form2), and return dict(form3=form3), and return dict(form4=form4)? Thanks, Alex Glaros On Friday, January 18, 2013 3:48:29 AM UTC-8, DenesL wrote: Hi Alex, you can't call the function from the view, you would have to pass it somehow or re-define it there, but the question is why?. Normally you would just write {{=form}} in the view to display the form returned form the function. Regards, Denes --
[web2py] How to use formargs, createargs, editargs, viewargs?
I have read the book on http://web2py.com/books/default/chapter/29/07#SQLFORM.grid-and-SQLFORM.smartgridbut the explanation about these args are too poor... how to use it? Is there any example? Thanks, Tito -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___ --
[web2py] Re: how to call sqlform from a view
Hi Alex, it is exactly that form, the one returned in the dictionary by the display_form function. There is nothing wrong with other functions returning the same variable unless you use them in the same view. Normally each function has its own view. Denes --
[web2py] SQLFORM.smartgrid dont work
I have the following table def: db.define_table('processes', Field('itemcode',db.commodities,label=T('Item Code'),unique=True, required=True, notnull=True), # Item code of the process result Field('name','string',length=60,label=T('Name'), required=False, notnull=False), Field('description','text',length=8*1024,label=T('Description'), required=False, notnull=False), format='%(itemcode)s-%(name)s' ) db.define_table('processitems', Field('process',db.processes, label=T('Process'), required=True, notnull=True), Field('itemcode',db.commodities, label=T('Item Code'), required=True, notnull=True), Field('amount','double',label=T('Amount'), required=True, notnull=True), format = '%(process)s-%(itemcode)s' ) and this is the controller: def receipe(): tbl = db.processes fields = [tbl.itemcode,tbl.name] query = (tbl.id0) order = [tbl.itemcode] maxlen = {'prosesses.itemcode':5,'processes.name':25} return dict(grid=SQLFORM.smartgrid(db.processes,fields=fields, csv=False, orderby=order,maxtextlengths=maxlen)) Everytime I try to list the processitems, I get no dataset and this message: Query Not Supported: no such column: processes.itemcode What did I wrong? --
[web2py] Re: SQLFORM.smartgrid dont work
Typo? maxlen = {'prosesses.itemcode':5,'processes.name':25} maxlen = {'processes.itemcode':5,'processes.name':25} --
[web2py] Re: 'DAL' object has no attribute 'auth_wiki' - trunk version
Working on trying out the json support but db won't get past this error. Fixed in trunk. Please check it works for you (it did for me) --
[web2py] Re: record versioning: what if tables are manually changed with migrate=False?
You can do: DAL(, migrate_enabled=False) and no table will be migrated ever. On Wednesday, 16 January 2013 23:41:42 UTC-6, Rick Ree wrote: Thanks Massimo. For this app we use migrate=False for all tables because of issues that arose in the context of distributed development using git. Basically, developers are using different MySQL servers, not all on localhost. So the *.table files were different, and so we did not put them in version control. With automatic migrations enabled, this seemed to cause problems when the database structure changed. Not sure if I am explaining this very clearly. In any case, we found it easier to manage table models manually, and distribute sql files for altering tables. I guess what this means is that using web2py's record versioning is not a good idea if we want to continue to avoid automatic migrations of the archive tables. If that is not the case, please enlighten me - thanks! -Rick On Wednesday, January 16, 2013 9:22:03 AM UTC-6, Massimo Di Pierro wrote: If you do db=DAL(, migrate_enabled=True) # default behavior auth.enable_record_versioning(db) db.define_table('something',, migrate=False) ... The migrate=False only affect the something table. If you change its model that table will not migrate but associated archive table will. If instead migrate_enabled=False, none of the tables will migrate. On Tuesday, 15 January 2013 22:09:28 UTC-6, Rick Ree wrote: Hi, I would like to enable record versioning on an existing MySQL database in which all tables are managed manually (migrate=False). I am concerned about what happens if the structure of a table changes in db.define_table( ... ). Is the associated archive table changed to match accordingly? thanks, -Rick --
[web2py] Re: Book in epub format?
Can you help us make the epub? On Thursday, 17 January 2013 04:59:59 UTC-6, Johann Spies wrote: Is there any chance to get the book in epub-format? I think it should be possible using markmin - xhtml epub (via calibre)? Regards Johann -- Because experiencing your loyal love is better than life itself, my lips will praise you. (Psalm 63:3) --
[web2py] Re: View not displaying the pictures
Mind you can simplify this as URL(a='Assignment', c='default', r=request, f='download', args=xxx.Picture)} with URL('download', args=xxx.Picture)} On Thursday, 17 January 2013 07:53:10 UTC-6, Mihir Lade wrote: Actually got this to work however the issue now is its iterating thorugh the table and printing out the information twice.. so for example.. if i have one picture there is information next to that picture.. and the next picture should have another bit of info.. how do i get that to work? --
[web2py] Re: auth.wiki doesn't find pages without tags
RIght now wiki search only searches by tag. Perhaps you should also search by title? On Thursday, 17 January 2013 19:19:58 UTC-6, viniciusban wrote: I've had a problem today, trying to search auth.wiki pages without tags, but they aren't found. As tags aren't required to save a page, I think this is a problem in Wiki.search() method. What do you think? --
[web2py] Re: How to use formargs, createargs, editargs, viewargs?
the same args you'd want to pass to a SQLFORM you can pass them to createargs, formargs, etc etc etc. code on the grid basically does this sqlformargs = dict(formargs) sqlformargs.update(createargs) create_form = SQLFORM( table, ignore_rw=ignore_rw, formstyle=formstyle, _class='web2py_form', **sqlformargs) so, formargs is for whatever arg you choose to pass to EVERY form generated by the grid, while the other are specific to the action the form is tied to. On Friday, January 18, 2013 3:59:12 PM UTC+1, Tito Garrido wrote: I have read the book on http://web2py.com/books/default/chapter/29/07#SQLFORM.grid-and-SQLFORM.smartgridbut the explanation about these args are too poor... how to use it? Is there any example? Thanks, Tito -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___ --
[web2py] Re: change string format of date picker
You can do db.table.field.requires = IS_DATE(format = '%D-%M-%Y') this can be done globally or in one action only. It will affect forms. You also need to change the format in JS calendar. This is in the code in web2py_ajax.html: script type=text/javascript!-- // These variables are used by the web2py_ajax_init function in web2py_ajax\ .js (which is loaded below). var w2p_ajax_confirm_message = {{=T('Are you sure you want to delete this \ object?')}}; var w2p_ajax_date_format = {{=T('%Y-%m-%d')}}; var w2p_ajax_datetime_format = {{=T('%Y-%m-%d %H:%M:%S')}}; var ajax_error_500 = '{{=XML(T('An error occured, please %s the page') % A(\ T('reload'), _href=URL(args=request.args, vars=request.vars))) }}' //--/script If you want the format to change only in one action/form you need some if statement in there. On Thursday, 17 January 2013 20:18:59 UTC-6, Tim Richardson wrote: On Thursday, 17 January 2013 14:56:51 UTC+11, Massimo Di Pierro wrote: Does this help? http://web2py.com/books/default/chapter/29/03#On-date,-datetime-and-time-format My little problem was that I'm using some legacy code, which wanted dates as strings in dd-mm-. The date picker returns strings -mm-dd. Mostly in my app, -mm-dd is exactly ok, but there is this one instance where dd-mm- is required. So I wondered if there was an easy way to change behaviour of the widget, one-time (so I don't want to change application-wide defaults). The jquery docs suggest only javascript can do it. In the end I just used datetime to convert it to a date and back to a string in my required format. On Wednesday, 16 January 2013 21:24:06 UTC-6, Tim Richardson wrote: I'm using the date picker in a form by using _class='date' Can I change the format of the string returned? --
[web2py] Re: Need webvtt entry in gluon/contenttype.py
Please. check if the solution in trunk is correct. On Friday, 18 January 2013 04:19:01 UTC-6, Magnitus wrote: http://dev.w3.org/html5/webvtt/#text/vtt http://www.w3.org/community/texttracks/2012/08/23/webvtt-support-in-browsers/ I know the format is still pretty bleeding edge, but it seems to be gaining support amongst browser manufacturers. I can see why. It is a very good concept I find. I think supporting it would be a good proactive move (and would save me the trouble of having to update the contenttype.py file each time I download the latest version of web2py :P). Thanks. --
[web2py] Re: how to support video in an app
from gluon.contrib.autolinks import expand_one {{=expand_one('http://www.youtube.com/watch?v=7yvt2Pt6LRA')}} On Friday, 18 January 2013 04:58:20 UTC-6, sasogeek wrote: at the moment, i can let users upload pictures and use the img tag to allow the image to be displayed on a page, when users upload videos, how do i allow the videos to display and play on the page... and if users submit a youtube link, how do i grab the embed code to display the video on the page? --
[web2py] Strange ajax error GET http://192.168.1.167:8000/empre2/default/user/not_authorized 403 ( forbidden)
hello i made this simple test in javascript chrome console i typed ajax('echo', ['name'], 'target') to call my function and it returns GET http://192.168.1.167:8000/empre2/default/user/not_authorized 403 (FORBIDDEN) thank you António --
[web2py] Re: Grid with multiple left joins
Looks good. Can you please send me a patch applied to the trunk version? On Friday, 18 January 2013 05:47:20 UTC-6, Felipe Meirelles wrote: Did anyone saw it? On Monday, January 14, 2013 5:41:36 PM UTC-2, Felipe Meirelles wrote: Please desconsider the sorter_icons parameter, its a custom implementation of mine. I can post this patch too if you think its relevant. Thanks! On Monday, January 14, 2013 5:38:53 PM UTC-2, Felipe Meirelles wrote: Hi, When you try to make more than one left join on a SQLFORM.grid as: grid = SQLFORMCustom.grid(db.device, fields=[db.device.serial, db.device.device_type, db.device.vehicle, db.vehicle.plate, db.chip.imei, ], field_id=db.device.id, left=[db.chip.on(db.chip.id==db.device.chip), db.vehicle.on( db.vehicle.id==db.device.vehicle)], paginate=max_results, showbuttontext=False, formstyle='divs', paginate_icons=paginate_icons, sorter_icons=sorter_icons ) it can't display the join fields as it dosen't find the fields on the query in sqlhtml.py line 1083. Can you apply this patch on line 1083? if left is not None: if isinstance(left, (list)): for l in left: tablenames += db._adapter.tables(l) else: tablenames += db._adapter.tables(left) --
[web2py] Re: Strange ajax error GET http://192.168.1.167:8000/empre2/default/user/not_authorized 403 ( forbidden)
'echo' is the url you're trying to call .. usually is /app/controller/function . 'echo' alone gets evaluated depending on the page you're on, appending to (or replacing the last bit of) the current url. On Friday, January 18, 2013 5:06:01 PM UTC+1, Ramos wrote: hello i made this simple test in javascript chrome console i typed ajax('echo', ['name'], 'target') to call my function and it returns GET http://192.168.1.167:8000/empre2/default/user/not_authorized 403 (FORBIDDEN) thank you António --
[web2py] Re: Strange ajax error GET http://192.168.1.167:8000/empre2/default/user/not_authorized 403 ( forbidden)
i have @auth.requires_signature() in my controller function behing the view when calling the ajax function if i remove it the error i get in javascript console is http://192.168.1.167:8000/empre2/default/showemp/echo 500 (INTERNAL SERVER ERROR) Does it have to do with auth? Thank you 2013/1/18 António Ramos ramstei...@gmail.com hello i made this simple test in javascript chrome console i typed ajax('echo', ['name'], 'target') to call my function and it returns GET http://192.168.1.167:8000/empre2/default/user/not_authorized 403 (FORBIDDEN) thank you António --
Re: [web2py] Re: auth.wiki doesn't find pages without tags
Massimo, in Wiki.search() method, there is this code: if query is None: query = (db.wiki_page.id == db.wiki_tag.wiki_page) \ (db.wiki_tag.name.belongs(tags)) query = query | db.wiki_page.title.contains(request.vars.q) So, search touches title, too. On Fri, Jan 18, 2013 at 1:46 PM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: RIght now wiki search only searches by tag. Perhaps you should also search by title? On Thursday, 17 January 2013 19:19:58 UTC-6, viniciusban wrote: I've had a problem today, trying to search auth.wiki pages without tags, but they aren't found. As tags aren't required to save a page, I think this is a problem in Wiki.search() method. What do you think? -- --
Re: [web2py] Re: How to use formargs, createargs, editargs, viewargs?
Sorry, I still don't get how to use it... example: db.define_table('table1', Field('name', requires=IS_NOT_EMPTY()), ) db.define_table('table2', Field('name', requires=IS_NOT_EMPTY()), Field('table1', 'reference table1', requires = IS_IN_DB(db,db.table1.id ,'%(name)s')), ) Then I have: table1_id=request.args(0) query_table2=db(db.table2.table1==table1_id) form=SQLFORM.grid(query_table2.query,user_signature=False,args=request.args[:1],formargs={'table1':table1_id}) The way that is set above it does not work... I would like to pre-fill the 'table1' field when I am adding/editing to hide this field on grid... How can I do that? On Fri, Jan 18, 2013 at 12:56 PM, Niphlod niph...@gmail.com wrote: the same args you'd want to pass to a SQLFORM you can pass them to createargs, formargs, etc etc etc. code on the grid basically does this sqlformargs = dict(formargs) sqlformargs.update(createargs) create_form = SQLFORM( table, ignore_rw=ignore_rw, formstyle=formstyle, _class='web2py_form', **sqlformargs) so, formargs is for whatever arg you choose to pass to EVERY form generated by the grid, while the other are specific to the action the form is tied to. On Friday, January 18, 2013 3:59:12 PM UTC+1, Tito Garrido wrote: I have read the book on http://web2py.com/books/** default/chapter/29/07#SQLFORM.**grid-and-SQLFORM.smartgridhttp://web2py.com/books/default/chapter/29/07#SQLFORM.grid-and-SQLFORM.smartgridbut the explanation about these args are too poor... how to use it? Is there any example? Thanks, Tito -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___ -- -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___ --
[web2py] Re: how to call sqlform from a view
I (1) created the person table in models, (2) typed in the function displayed in my original post in the controller, then (3) inserted {{=form}} in /views/default/index.html but receive this error: type 'exceptions.NameError' name 'form' is not defined I'm just trying to make the example in the documentation work so that the person table works/appears on the html view. thanks, Alex On Friday, January 18, 2013 7:01:29 AM UTC-8, DenesL wrote: Hi Alex, it is exactly that form, the one returned in the dictionary by the display_form function. There is nothing wrong with other functions returning the same variable unless you use them in the same view. Normally each function has its own view. Denes --
Re: [web2py] Re: Strange ajax error GET http://192.168.1.167:8000/empre2/default/user/not_authorized 403 ( forbidden)
yes i know i´m just confused because of the error. That is why i went to the console to test it the ajax function does not work if it is get called by a view that has a controller with @auth.requires_signature() Its that right? Thank you António 2013/1/18 Niphlod niph...@gmail.com 'echo' is the url you're trying to call .. usually is /app/controller/function . 'echo' alone gets evaluated depending on the page you're on, appending to (or replacing the last bit of) the current url. On Friday, January 18, 2013 5:06:01 PM UTC+1, Ramos wrote: hello i made this simple test in javascript chrome console i typed ajax('echo', ['name'], 'target') to call my function and it returns GET http://192.168.1.167:8000/**empre2/default/user/not_**authorizedhttp://192.168.1.167:8000/empre2/default/user/not_authorized403 (FORBIDDEN) thank you António -- --
[web2py] Re: how to call sqlform from a view
you're two or more steps ahead than your brain def display_form(): in a controller named thecontroller.py will work ok as long as in a view views/thecontroller/display_form.html there's a {{=form}} written inside. If you want to copy/paste examples in the book at least read the previous chapters http://web2py.com/books/default/chapter/29/04#Dispatching will help you o understand a lot of things. On Friday, January 18, 2013 5:54:46 PM UTC+1, Alex Glaros wrote: I (1) created the person table in models, (2) typed in the function displayed in my original post in the controller, then (3) inserted {{=form}} in /views/default/index.html but receive this error: type 'exceptions.NameError' name 'form' is not defined I'm just trying to make the example in the documentation work so that the person table works/appears on the html view. thanks, Alex On Friday, January 18, 2013 7:01:29 AM UTC-8, DenesL wrote: Hi Alex, it is exactly that form, the one returned in the dictionary by the display_form function. There is nothing wrong with other functions returning the same variable unless you use them in the same view. Normally each function has its own view. Denes --
[web2py] Re: Are there conditions under which labels are not shown in SQLForm ?
Found the issue ! The labels are case sensitive !! I think we should update the documentation for SQLForm, saying if you are using labels, make sure that the keys in the dictionaries are exactly the same case as mentioned in your db.py. On Friday, 18 January 2013 03:40:54 UTC-5, Niphlod wrote: show us the code you're using to override them, and the model of the underlying table On Friday, January 18, 2013 3:54:15 AM UTC+1, GeeksRule wrote: I have an SQLForm, and have a dictionary of labels, but they aren't been overriden : {'fname':'First name: ', 'lname':'Last name : ', 'Published_Datetime':'Date when you published : '} here fname is the column name in th database. are there any conditions where the labels I provide won't work ? --
Re: [web2py] Re: How to use formargs, createargs, editargs, viewargs?
not with createargs, editargs, etc etc etc . in fact, the thing you want to do isn't accompilished by passing a parameter in a SQLFORM, so these args are useless to your ends. to prefill a value just set its default before returning the grid. logic is up to you. def test(): db.table2.table1.default = request.args(0) ... if I got what you're triyng to do. On Friday, January 18, 2013 5:32:24 PM UTC+1, Tito Garrido wrote: Sorry, I still don't get how to use it... example: db.define_table('table1', Field('name', requires=IS_NOT_EMPTY()), ) db.define_table('table2', Field('name', requires=IS_NOT_EMPTY()), Field('table1', 'reference table1', requires = IS_IN_DB(db, db.table1.id,'%(name)s')), ) Then I have: table1_id=request.args(0) query_table2=db(db.table2.table1==table1_id) form=SQLFORM.grid(query_table2.query,user_signature=False,args=request.args[:1],formargs={'table1':table1_id}) The way that is set above it does not work... I would like to pre-fill the 'table1' field when I am adding/editing to hide this field on grid... How can I do that? On Fri, Jan 18, 2013 at 12:56 PM, Niphlod nip...@gmail.com javascript:wrote: the same args you'd want to pass to a SQLFORM you can pass them to createargs, formargs, etc etc etc. code on the grid basically does this sqlformargs = dict(formargs) sqlformargs.update(createargs) create_form = SQLFORM( table, ignore_rw=ignore_rw, formstyle=formstyle, _class='web2py_form', **sqlformargs) so, formargs is for whatever arg you choose to pass to EVERY form generated by the grid, while the other are specific to the action the form is tied to. On Friday, January 18, 2013 3:59:12 PM UTC+1, Tito Garrido wrote: I have read the book on http://web2py.com/books/** default/chapter/29/07#SQLFORM.**grid-and-SQLFORM.smartgridhttp://web2py.com/books/default/chapter/29/07#SQLFORM.grid-and-SQLFORM.smartgridbut the explanation about these args are too poor... how to use it? Is there any example? Thanks, Tito -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___ -- -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___ --
[web2py] Re: how to call sqlform from a view
If you go to the URL /yourapp/default/index, when the index.html view is executed, it will only have available to it whatever is returned by the index() function in the default.py controller. If you want to display the form created in the display_form() action, you have to create a /views/default/display_form.html view, insert {{=form}} there, and then go to the URL /yourapp/default/display_form. It might help if you read the section on dispatchinghttp://web2py.com/books/default/chapter/29/04#Dispatching . Anthony On Friday, January 18, 2013 11:54:46 AM UTC-5, Alex Glaros wrote: I (1) created the person table in models, (2) typed in the function displayed in my original post in the controller, then (3) inserted {{=form}} in /views/default/index.html but receive this error: type 'exceptions.NameError' name 'form' is not defined I'm just trying to make the example in the documentation work so that the person table works/appears on the html view. thanks, Alex On Friday, January 18, 2013 7:01:29 AM UTC-8, DenesL wrote: Hi Alex, it is exactly that form, the one returned in the dictionary by the display_form function. There is nothing wrong with other functions returning the same variable unless you use them in the same view. Normally each function has its own view. Denes --
Re: [web2py] Re: How to use formargs, createargs, editargs, viewargs?
That is it! Thanks! Tito On Fri, Jan 18, 2013 at 2:04 PM, Niphlod niph...@gmail.com wrote: not with createargs, editargs, etc etc etc . in fact, the thing you want to do isn't accompilished by passing a parameter in a SQLFORM, so these args are useless to your ends. to prefill a value just set its default before returning the grid. logic is up to you. def test(): db.table2.table1.default = request.args(0) ... if I got what you're triyng to do. On Friday, January 18, 2013 5:32:24 PM UTC+1, Tito Garrido wrote: Sorry, I still don't get how to use it... example: db.define_table('table1', Field('name', requires=IS_NOT_EMPTY()), ) db.define_table('table2', Field('name', requires=IS_NOT_EMPTY()), Field('table1', 'reference table1', requires = IS_IN_DB(db, db.table1.id,'%(**name)s')), ) Then I have: table1_id=request.args(0) query_table2=db(db.table2.**table1==table1_id) form=SQLFORM.grid(query_**table2.query,user_signature=** False,args=request.args[:1],**formargs={'table1':table1_id}) The way that is set above it does not work... I would like to pre-fill the 'table1' field when I am adding/editing to hide this field on grid... How can I do that? On Fri, Jan 18, 2013 at 12:56 PM, Niphlod nip...@gmail.com wrote: the same args you'd want to pass to a SQLFORM you can pass them to createargs, formargs, etc etc etc. code on the grid basically does this sqlformargs = dict(formargs) sqlformargs.update(createargs) create_form = SQLFORM( table, ignore_rw=ignore_rw, formstyle=formstyle, _class='web2py_form', **sqlformargs) so, formargs is for whatever arg you choose to pass to EVERY form generated by the grid, while the other are specific to the action the form is tied to. On Friday, January 18, 2013 3:59:12 PM UTC+1, Tito Garrido wrote: I have read the book on http://web2py.com/books/**defaul** t/chapter/29/07#SQLFORM.**grid-**and-SQLFORM.smartgridhttp://web2py.com/books/default/chapter/29/07#SQLFORM.grid-and-SQLFORM.smartgridbut the explanation about these args are too poor... how to use it? Is there any example? Thanks, Tito -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___ -- -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___ -- -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___ --
[web2py] Re: Are there conditions under which labels are not shown in SQLForm ?
given that you must pass a python dictionary and that {'Label1' : 'label for 1', 'label1' : 'label for 1 lowercase'} is a totally standard compliant python dictionary is it really necessary ? the same things goes for headers, col3, etc etc etc. On Friday, January 18, 2013 6:02:53 PM UTC+1, GeeksRule wrote: Found the issue ! The labels are case sensitive !! I think we should update the documentation for SQLForm, saying if you are using labels, make sure that the keys in the dictionaries are exactly the same case as mentioned in your db.py. On Friday, 18 January 2013 03:40:54 UTC-5, Niphlod wrote: show us the code you're using to override them, and the model of the underlying table On Friday, January 18, 2013 3:54:15 AM UTC+1, GeeksRule wrote: I have an SQLForm, and have a dictionary of labels, but they aren't been overriden : {'fname':'First name: ', 'lname':'Last name : ', 'Published_Datetime':'Date when you published : '} here fname is the column name in th database. are there any conditions where the labels I provide won't work ? --
[web2py] Re: Are there conditions under which labels are not shown in SQLForm ?
On Friday, January 18, 2013 12:02:53 PM UTC-5, GeeksRule wrote: Found the issue ! The labels are case sensitive !! I think we should update the documentation for SQLForm, saying if you are using labels, make sure that the keys in the dictionaries are exactly the same case as mentioned in your db.py. But all identifiers in Python and web2py are case sensitive -- it would be quite odd to point out just this one case (no pun intended). Anthony --
Re: [web2py] Re: Strange ajax error GET http://192.168.1.167:8000/empre2/default/user/not_authorized 403 ( forbidden)
given that you fixed 'echo' with something like '/app/default/echo' the problem may be that in your controller, echo() is restricted. It make *Total Sense* (titlecase, yes :-P) that a @auth.requires_signature wouldn't let you access that function without the _signature parameter attached to the URL (and with the correct value) . On Friday, January 18, 2013 5:56:45 PM UTC+1, Ramos wrote: yes i know i´m just confused because of the error. That is why i went to the console to test it the ajax function does not work if it is get called by a view that has a controller with @auth.requires_signature() Its that right? Thank you António 2013/1/18 Niphlod nip...@gmail.com javascript: 'echo' is the url you're trying to call .. usually is /app/controller/function . 'echo' alone gets evaluated depending on the page you're on, appending to (or replacing the last bit of) the current url. On Friday, January 18, 2013 5:06:01 PM UTC+1, Ramos wrote: hello i made this simple test in javascript chrome console i typed ajax('echo', ['name'], 'target') to call my function and it returns GET http://192.168.1.167:8000/**empre2/default/user/not_**authorizedhttp://192.168.1.167:8000/empre2/default/user/not_authorized403 (FORBIDDEN) thank you António -- --
[web2py] bug in smartgrid groupby
For web2py 2.2.1. When I use groupby in smartgrid, the number of records found usually displays a wrong number. Often displays 1 records found even there are many records in the grid. Sometime, for examples, displays 11 when there are 9 records in grid, displays 2 when there are 4 records. The number will be displayed correctly if I remove the groupby from grid. Thanks, Mark --
[web2py] Re: Need webvtt entry in gluon/contenttype.py
It's good, thank you :). On Friday, 18 January 2013 11:00:30 UTC-5, Massimo Di Pierro wrote: Please. check if the solution in trunk is correct. On Friday, 18 January 2013 04:19:01 UTC-6, Magnitus wrote: http://dev.w3.org/html5/webvtt/#text/vtt http://www.w3.org/community/texttracks/2012/08/23/webvtt-support-in-browsers/ I know the format is still pretty bleeding edge, but it seems to be gaining support amongst browser manufacturers. I can see why. It is a very good concept I find. I think supporting it would be a good proactive move (and would save me the trouble of having to update the contenttype.py file each time I download the latest version of web2py :P). Thanks. --
[web2py] Not able to upload files using SQLFORM.grid in a component
Hi Folks, I guess I have found a bug... db.define_table('test', Field('pic', 'upload' uploadseparate=True, autodelete=True)) create a function for your component: def test_function(): form=SQLFORM.grid(db.test) return dict(form=form) load your grid via component: {{=LOAD(f=test_function.load, ajax=True, ajax_trap=True)}} if you try to upload something it just ignores and does not work... -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___ --
[web2py] Auth login with Firefox
Using trunk / Win Vista / Login works OK with Chrome and IE, but fails with Firefox. I enter User and Password and click Login. The fields are cleared and the login form redisplayed, but no login. I tried clearing session files and all cookies and other browser data, but cannot get it working. Has anything changed? Any suggestions? David --
[web2py] Logging in with applications.
I want to allow external devices, like phones, to login to my web2py. My current app runs with only JSON calls is there a way to make the login occure with JSON? BR, Jason --
Re: [web2py] Do we have to have first_name in auth tables?
Sorry for the late reply. Yes, I was using a customer table. BR, Jason On Tuesday, January 1, 2013 9:59:34 PM UTC+2, Niphlod wrote: @alec: that was to change the default behaviour of having a first_name accompanied by last_name and so on on the auth_user table. This is a different problem, no ? @encompass : are you using a custom auth instance ? On Tuesday, January 1, 2013 7:55:37 PM UTC+1, Alec Taylor wrote: Hey Jason, Reported this same issue a few days ago; I think they're working on it: https://groups.google.com/d/topic/web2py/D8VewP3g-R0 On Wed, Jan 2, 2013 at 5:52 AM, encompass enco...@gmail.com wrote: I am getting an error when trying to view the database in the admin AttributeError: 'Row' object has no attribute 'first_name' How would I get around this as the database admin is pretty useful. :) BR, Jason Brower -- --
[web2py] Re: Auth login with Firefox
not that I can think of. did you try inspecting what happens with firebug ? On Friday, January 18, 2013 8:13:37 PM UTC+1, villas wrote: Using trunk / Win Vista / Login works OK with Chrome and IE, but fails with Firefox. I enter User and Password and click Login. The fields are cleared and the login form redisplayed, but no login. I tried clearing session files and all cookies and other browser data, but cannot get it working. Has anything changed? Any suggestions? David --
[web2py] Re: Not able to upload files using SQLFORM.grid in a component
I guess I have found a workaround on Antony's reply: https://mail.google.com/mail/u/0/?shva=1#search/label%3Aweb2py+upload+component/138ff34d2e7d0039 Anyway is there any ticket to fix this problem? On Fri, Jan 18, 2013 at 3:58 PM, Tito Garrido titogarr...@gmail.com wrote: Hi Folks, I guess I have found a bug... db.define_table('test', Field('pic', 'upload' uploadseparate=True, autodelete=True)) create a function for your component: def test_function(): form=SQLFORM.grid(db.test) return dict(form=form) load your grid via component: {{=LOAD(f=test_function.load, ajax=True, ajax_trap=True)}} if you try to upload something it just ignores and does not work... -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___ -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___ --
[web2py] Re: Not able to upload files using SQLFORM.grid in a component
uploads via ajax are not supported. that's true even for a SQLFORM loaded via ajax. it's not a limitation on web2py per se, more of an ajax limit if you don't want to use the new html5 features. On Friday, January 18, 2013 7:58:49 PM UTC+1, Tito Garrido wrote: Hi Folks, I guess I have found a bug... db.define_table('test', Field('pic', 'upload' uploadseparate=True, autodelete=True)) create a function for your component: def test_function(): form=SQLFORM.grid(db.test) return dict(form=form) load your grid via component: {{=LOAD(f=test_function.load, ajax=True, ajax_trap=True)}} if you try to upload something it just ignores and does not work... -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___ --
Re: [web2py] Re: Aren't we not able to translate SQLFORM.grid buttons?
Massimo is it available on 2.3.2? Thanks! Tito On Wed, Dec 19, 2012 at 10:00 AM, Tito Garrido titogarr...@gmail.comwrote: Thanks! On Tue, Dec 18, 2012 at 11:28 PM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: Yes, that was missing. I now added it. On Tuesday, 18 December 2012 16:23:02 UTC-6, Tito Garrido wrote: Hi Folks! I am trying to find the 'Add' string on the translation file but I couldn't find anything related to SQLFORM.grid to translate, is it expected? Thanks! Tito -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___ -- -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___ -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___ --
Re: [web2py] Re: auth.wiki doesn't find pages without tags
The issue to be considered is that this will not work on Google App Engine and it may considerable slow down searches for many wiki pages. Should we make this optional? Or always on? Or make it conditional to non-GAE? Should we break request.var.q in tokens and search that each of them is in tags or in title even out of order? On Friday, 18 January 2013 10:29:05 UTC-6, viniciusban wrote: Massimo, in Wiki.search() method, there is this code: if query is None: query = (db.wiki_page.id == db.wiki_tag.wiki_page) \ (db.wiki_tag.name.belongs(tags)) query = query | db.wiki_page.title.contains(request.vars.q) So, search touches title, too. On Fri, Jan 18, 2013 at 1:46 PM, Massimo Di Pierro massimo@gmail.com javascript: wrote: RIght now wiki search only searches by tag. Perhaps you should also search by title? On Thursday, 17 January 2013 19:19:58 UTC-6, viniciusban wrote: I've had a problem today, trying to search auth.wiki pages without tags, but they aren't found. As tags aren't required to save a page, I think this is a problem in Wiki.search() method. What do you think? -- --
Re: [web2py] Re: Aren't we not able to translate SQLFORM.grid buttons?
I think this is trunk and nighlty only. On Friday, 18 January 2013 13:30:42 UTC-6, Tito Garrido wrote: Massimo is it available on 2.3.2? Thanks! Tito On Wed, Dec 19, 2012 at 10:00 AM, Tito Garrido titog...@gmail.comjavascript: wrote: Thanks! On Tue, Dec 18, 2012 at 11:28 PM, Massimo Di Pierro massimo@gmail.com javascript: wrote: Yes, that was missing. I now added it. On Tuesday, 18 December 2012 16:23:02 UTC-6, Tito Garrido wrote: Hi Folks! I am trying to find the 'Add' string on the translation file but I couldn't find anything related to SQLFORM.grid to translate, is it expected? Thanks! Tito -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___ -- -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___ -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___ --
Re: [web2py] Do we have to have first_name in auth tables?
durp durp custome table. On Fri, Jan 18, 2013 at 9:26 PM, encompass encomp...@gmail.com wrote: Sorry for the late reply. Yes, I was using a customer table. BR, Jason On Tuesday, January 1, 2013 9:59:34 PM UTC+2, Niphlod wrote: @alec: that was to change the default behaviour of having a first_name accompanied by last_name and so on on the auth_user table. This is a different problem, no ? @encompass : are you using a custom auth instance ? On Tuesday, January 1, 2013 7:55:37 PM UTC+1, Alec Taylor wrote: Hey Jason, Reported this same issue a few days ago; I think they're working on it: https://groups.google.com/d/topic/web2py/D8VewP3g-R0 On Wed, Jan 2, 2013 at 5:52 AM, encompass enco...@gmail.com wrote: I am getting an error when trying to view the database in the admin AttributeError: 'Row' object has no attribute 'first_name' How would I get around this as the database admin is pretty useful. :) BR, Jason Brower -- -- --
Re: [web2py] Re: Not able to upload files using SQLFORM.grid in a component
Niphlod, Do you have any slice using HTML 5? Thanks! Tito On Fri, Jan 18, 2013 at 4:30 PM, Niphlod niph...@gmail.com wrote: uploads via ajax are not supported. that's true even for a SQLFORM loaded via ajax. it's not a limitation on web2py per se, more of an ajax limit if you don't want to use the new html5 features. On Friday, January 18, 2013 7:58:49 PM UTC+1, Tito Garrido wrote: Hi Folks, I guess I have found a bug... db.define_table('test', Field('pic', 'upload' uploadseparate=True, autodelete=True)) create a function for your component: def test_function(): form=SQLFORM.grid(db.test) return dict(form=form) load your grid via component: {{=LOAD(f=test_function.load**, ajax=True, ajax_trap=True)}} if you try to upload something it just ignores and does not work... -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___ -- -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___ --
[web2py] how to select current id record for record updat
Hello, I am working on a shopping cart, using the stable version of web2py, with an sql lite database. In a checkout function, the order information is being inserted into a sales db,(for example it has db.sales[id] == 2 then in a buy function, after a user enters their card information in order to buy the item, I want to insert an invoice number. I haven't used dbcommit(). If I use db.sales.insert(invoice=invoice), this creates a new record, db.sales[id] == 3 , with just the invoice number in it. I get an error if I try db.sales.append(invoice=invoice). I see in the book that it's possible to try an update with something like this: db.sales[id]=dict(invoice=invoice) but if I try that literal example it is still creating a new record and not updating the current session sales id record. How do I select the id of the current user's record and then use this update example as shown in the book to insert an invoice number into the db.sales record that has been recently created? or how do I append a update to a record? Do I use rollback or something else? Thanks for suggesions. Margaret --
[web2py] Re: Logging in with applications.
My current app runs with only JSON calls is there a way to make the login occure with JSON? Did you check this? http://www.web2py.com/books/default/chapter/29/10#Services-and-Authentication http://www.web2py.com/books/default/chapter/29/09#Access-Control-and-Basic-Authentication http://www.web2py.com/books/default/chapter/29/09#Manual-Authentication --
[web2py] Re: Auth login with Firefox
Firefox posts the form OK. Irrespective as to whether the credentials are correct or not, I get the login form again. With incorrect credentials I would at least expect a flash of 'Invalid login' on screen, but I do not even get that. Strange. Can you suggest anything specific I should look out for in Firebug? Thanks for your help, D On Friday, January 18, 2013 7:28:49 PM UTC, Niphlod wrote: not that I can think of. did you try inspecting what happens with firebug ? --
[web2py] Re: how to select current id record for record updat
I am not sure I fully understand. You can do this: id = db.sales.insert(invoice=invoice) old_invoice = db.sales[id].invoice new_invoice = old_invoice db(db.sales.id==id).update(invoice=new_invoice) Does this answer your question? On Friday, 18 January 2013 15:36:30 UTC-6, greaneym wrote: Hello, I am working on a shopping cart, using the stable version of web2py, with an sql lite database. In a checkout function, the order information is being inserted into a sales db,(for example it has db.sales[id] == 2 then in a buy function, after a user enters their card information in order to buy the item, I want to insert an invoice number. I haven't used dbcommit(). If I use db.sales.insert(invoice=invoice), this creates a new record, db.sales[id] == 3 , with just the invoice number in it. I get an error if I try db.sales.append(invoice=invoice). I see in the book that it's possible to try an update with something like this: db.sales[id]=dict(invoice=invoice) but if I try that literal example it is still creating a new record and not updating the current session sales id record. How do I select the id of the current user's record and then use this update example as shown in the book to insert an invoice number into the db.sales record that has been recently created? or how do I append a update to a record? Do I use rollback or something else? Thanks for suggesions. Margaret --
[web2py] Re: how to call sqlform from a view
I'd just like to point out, that couldn't he also do this: return dict(form2=form2, form1=form1) then in the view you can have this: {{=form1}} {{=form2}} On Friday, January 18, 2013 10:04:22 AM UTC-7, Anthony wrote: If you go to the URL /yourapp/default/index, when the index.html view is executed, it will only have available to it whatever is returned by the index() function in the default.py controller. If you want to display the form created in the display_form() action, you have to create a /views/default/display_form.html view, insert {{=form}} there, and then go to the URL /yourapp/default/display_form. It might help if you read the section on dispatchinghttp://web2py.com/books/default/chapter/29/04#Dispatching . Anthony On Friday, January 18, 2013 11:54:46 AM UTC-5, Alex Glaros wrote: I (1) created the person table in models, (2) typed in the function displayed in my original post in the controller, then (3) inserted {{=form}} in /views/default/index.html but receive this error: type 'exceptions.NameError' name 'form' is not defined I'm just trying to make the example in the documentation work so that the person table works/appears on the html view. thanks, Alex On Friday, January 18, 2013 7:01:29 AM UTC-8, DenesL wrote: Hi Alex, it is exactly that form, the one returned in the dictionary by the display_form function. There is nothing wrong with other functions returning the same variable unless you use them in the same view. Normally each function has its own view. Denes --
Re: [web2py] New Plugin: plugin_markitup
Hi Ross! Nice addition... I am trying to use it but I am getting: type 'exceptions.NameError' global name 'markitup' is not defined Version web2py™ (2, 3, 2, datetime.datetime(2012, 12, 17, 15, 3, 30), 'stable') Python Python 2.6.6: /usr/bin/python Traceback 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. Traceback (most recent call last): File /home/titog/Documents/Projetos/web2py/gluon/restricted.py, line 212, in restricted exec ccode in environment File /home/titog/Documents/Projetos/web2py/applications/cms/controllers/default.py http://127.0.0.1:8000/admin/default/edit/cms/controllers/default.py, line 81, in module File /home/titog/Documents/Projetos/web2py/gluon/globals.py, line 193, in lambda self._caller = lambda f: f() File /home/titog/Documents/Projetos/web2py/applications/cms/controllers/default.py http://127.0.0.1:8000/admin/default/edit/cms/controllers/default.py, line 22, in index form=SQLFORM(db.conteudo,conteudo) File /home/titog/Documents/Projetos/web2py/gluon/sqlhtml.py, line 1063, in __init__ inp = field.widget(field, default) File applications/cms/modules/plugin_markitup/markitup.py, line 131, in widget return markitup(value, **attributes) NameError: global name 'markitup' is not defined Are you able to sent the plugin package? Maybe I missed something copying it from source... On Mon, Feb 13, 2012 at 11:20 AM, Marin Pranjić marin.pran...@gmail.comwrote: Thanks, i will test by the end of the week. I need this. Marin On Sun, Feb 12, 2012 at 10:07 PM, Ross Peoples ross.peop...@gmail.comwrote: I have created another plugin for the MarkItUp widget. I know that plugin_wiki has this currently, but I wanted a dedicated plugin for this for an upcoming project I'm working on. You can get the plugin from Bitbucket: https://bitbucket.org/PhreeStyle/web2py_markitup There is no documentation yet, as I just pushed the code. But I wanted to announce in case anyone wants to play with this. It has not been thoroughly tested and is only an alpha at this point. It can be used with several different markup languages: - BBCode - HTML - Markdown - Markmin - reStructuredText - Textile - Wiki The plugin can be used standalone, or as a form field widget. It currently supports live previews for 4 markup languages: html, markmin, markdown, textile, and bbcode. Code blocks for markmin and markdown markup are highlighted by pygments, which is included as part of the plugin. No external dependencies. Using pygments for code highlighting allows over 100 languages to be highlighted. Code highlighting in markmin: `` def testing(): print 'Testing' ``:python Code highlighting in markdown: :::python def testing(): print 'Testing' Markdown requires four spaces at the beginning of each line for code blocks. Example for basic usage: from plugin_markitup.markitup import MarkItUp def test(): widget = MarkItUp(set_name='markmin').markitup() return dict(widget=widget) Example model for form fields: from plugin_markitup.markitup import MarkItUp db.define_table('content', Field('name', length=20), Field('description', 'text') ) db.content.description.widget = MarkItUp().widget Example controller: def test(): form = SQLFORM(db.content) if form.accepts(request, session): redirect(URL()) return dict(form=form) This plugin is more of an alpha preview, so I expect there to be problems and inconsistencies. Please try it out and let me know if you have any questions, comments, or problems! -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___ --
[web2py] Re: Auth login with Firefox
Can't figure it out so I shall rebuild the app on top of the latest welcome. That seems to work ok. Thanks, D --
Re: [web2py] New Plugin: plugin_markitup
How are you using the plugin? Can you post some code? As to getting the code from BitBucket, go to: https://bitbucket.org/PhreeStyle/web2py_markitup/downloads And select Tags or Branches, you'll see options to download as .zip, .tar.gz or .tar.bz2. Regards, Ales On Saturday, January 19, 2013 1:39:02 AM UTC+1, Tito Garrido wrote: Hi Ross! Nice addition... I am trying to use it but I am getting: type 'exceptions.NameError' global name 'markitup' is not defined Version web2py™ (2, 3, 2, datetime.datetime(2012, 12, 17, 15, 3, 30), 'stable') Python Python 2.6.6: /usr/bin/python Traceback 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. Traceback (most recent call last): File /home/titog/Documents/Projetos/web2py/gluon/restricted.py, line 212, in restricted exec ccode in environment File /home/titog/Documents/Projetos/web2py/applications/cms/controllers/default.py http://127.0.0.1:8000/admin/default/edit/cms/controllers/default.py, line 81, in module File /home/titog/Documents/Projetos/web2py/gluon/globals.py, line 193, in lambda self._caller = lambda f: f() File /home/titog/Documents/Projetos/web2py/applications/cms/controllers/default.py http://127.0.0.1:8000/admin/default/edit/cms/controllers/default.py, line 22, in index form=SQLFORM(db.conteudo,conteudo) File /home/titog/Documents/Projetos/web2py/gluon/sqlhtml.py, line 1063, in __init__ inp = field.widget(field, default) File applications/cms/modules/plugin_markitup/markitup.py, line 131, in widget return markitup(value, **attributes) NameError: global name 'markitup' is not defined Are you able to sent the plugin package? Maybe I missed something copying it from source... On Mon, Feb 13, 2012 at 11:20 AM, Marin Pranjić marin@gmail.comjavascript: wrote: Thanks, i will test by the end of the week. I need this. Marin On Sun, Feb 12, 2012 at 10:07 PM, Ross Peoples ross.p...@gmail.comjavascript: wrote: I have created another plugin for the MarkItUp widget. I know that plugin_wiki has this currently, but I wanted a dedicated plugin for this for an upcoming project I'm working on. You can get the plugin from Bitbucket: https://bitbucket.org/PhreeStyle/web2py_markitup There is no documentation yet, as I just pushed the code. But I wanted to announce in case anyone wants to play with this. It has not been thoroughly tested and is only an alpha at this point. It can be used with several different markup languages: - BBCode - HTML - Markdown - Markmin - reStructuredText - Textile - Wiki The plugin can be used standalone, or as a form field widget. It currently supports live previews for 4 markup languages: html, markmin, markdown, textile, and bbcode. Code blocks for markmin and markdown markup are highlighted by pygments, which is included as part of the plugin. No external dependencies. Using pygments for code highlighting allows over 100 languages to be highlighted. Code highlighting in markmin: `` def testing(): print 'Testing' ``:python Code highlighting in markdown: :::python def testing(): print 'Testing' Markdown requires four spaces at the beginning of each line for code blocks. Example for basic usage: from plugin_markitup.markitup import MarkItUp def test(): widget = MarkItUp(set_name='markmin').markitup() return dict(widget=widget) Example model for form fields: from plugin_markitup.markitup import MarkItUp db.define_table('content', Field('name', length=20), Field('description', 'text') ) db.content.description.widget = MarkItUp().widget Example controller: def test(): form = SQLFORM(db.content) if form.accepts(request, session): redirect(URL()) return dict(form=form) This plugin is more of an alpha preview, so I expect there to be problems and inconsistencies. Please try it out and let me know if you have any questions, comments, or problems! -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___ --
[web2py] If I upload a file manually does it check the validators?
Can I use imageutils RESIZE on a manual upload like: aux=db.files.file_upload.store(fileApp, filename) Just wondering if I can resize an image uploaded by http://www.web2pyslices.com/slice/show/1576/html5-file-uploads-with-jquery -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___ --
Re: [web2py] If I upload a file manually does it check the validators?
db.files.validate_and_insert(file_upload=db.files.file_upload.store(fileApp, filename)) it should fire the validator (I guess) --
[web2py] displaying and editing joined tables
Here is an example from: http://web2py.com/books/default/chapter/29/07 db.define_table('person', Field('name', unique=True)) db.define_table('dog', Field('name'), Field('owner', db.person) db.dog.owner.requires = IS_IN_DB(db, 'person.id', '%(name)s', zero=T('choose one')) Can someone please write out the syntax for displaying all of the joined data using the most up-to-date way (SQLForm, or whatever. I believe CRUD can't do more than one table)? Kindly include any code needed to display the data in a view. Can you also show me the code to allow users to select a record and edit one of the tables? Please also include code needed to make the options visible to user in a view. Thanks, Alex Glaros --
Re: [web2py] displaying and editing joined tables
There is this Slice: https://www.web2pyslices.com/slice/show/1427/single-form-for-linked-tables --
Re: [web2py] If I upload a file manually does it check the validators?
On Fri, Jan 18, 2013 at 10:30 PM, Bruno Rocha rochacbr...@gmail.com wrote: db.files.validate_and_insert(file_upload=db.files.file_upload.store(fileApp, filename)) Seems that it is firing the validator but there is an issue: type 'exceptions.AttributeError' 'NoneType' object has no attribute 'filename' Version web2py™ (2, 3, 2, datetime.datetime(2012, 12, 17, 15, 3, 30), 'stable') Python Python 2.6.6: /usr/bin/python Traceback 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. Traceback (most recent call last): File /home/titog/Documents/Projetos/web2py/gluon/restricted.py, line 212, in restricted exec ccode in environment File /home/titog/Documents/Projetos/web2py/applications/cms/controllers/default.py http://127.0.0.1:8000/admin/default/edit/cms/controllers/default.py, line 114, in module File /home/titog/Documents/Projetos/web2py/gluon/globals.py, line 193, in lambda self._caller = lambda f: f() File /home/titog/Documents/Projetos/web2py/applications/cms/controllers/default.py http://127.0.0.1:8000/admin/default/edit/cms/controllers/default.py, line 85, in my_upload filename=fileApp.filename.replace(' ', '') AttributeError: 'NoneType' object has no attribute 'filename' Error snapshot [image: help] type 'exceptions.AttributeError'('NoneType' object has no attribute 'filename') Not sure why... -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___ --
[web2py] HOSTING FOR web2py ?
I'm doing testing for my application in pythonanywhere.com, but I had some problems with paypal and I could not buy a domain. someone can recommend another hosting web2py to not only accept paypal ? thank you very much. --
[web2py] Re: sqlform.grid exporting with_hidden_cols
ok, ticket submitted: http://code.google.com/p/web2py/issues/detail?id=1294 On Wednesday, January 16, 2013 9:46:20 PM UTC-6, Massimo Di Pierro wrote: Please open a googlecode thicket pointing here. We will review and probably accept it. On Wednesday, 16 January 2013 11:21:14 UTC-6, Vincent wrote: I am trying to export a grid with a custom exporter that has a name ending with_hidden_cols in order to export a complete table (and more). However, my exported file does not contain the hidden cols. I have diagnosed the problem and believe the following changes yields the expected behavior: --- a/gluon/sqlhtml.py +++ b/gluon/sqlhtml.py @@ -2016,7 +2016,9 @@ class SQLFORM(FORM): expcolumns = columns if export_type.endswith('with_hidden_cols'): -expcolumns = [f for f in fields if f._tablename intablenames ] +expfields = reduce(lambda a, b: a + b, +[[field for field in table] for table intables ]) +expcolumns = [f for f in expfields if f._tablename intablenames ] if export_type in exportManager and exportManager[ export_type]: if request.vars.keywords: try: I specify fields when creating the grid because I want to limit the number of visible columns. However, in the original sqlhtml.py code the expcolumns variable is set using the fields variable that has already been limited to the visible columns. My change simply defines a new variable expfields using the original way fields is defined when it is not specified on grid creation. I believe this now has the expected behavior. I am using web2py from trunk. Thanks Vincent --
Re: [web2py] HOSTING FOR web2py ?
webfaction openshift linode --
Re: [web2py] HOSTING FOR web2py ?
BTW: PythonAnywhere is fantastic! the consoles, the way it integrates with Dropbox etc... the support also is very helpful. Have you tried to contact them? https://www.pythonanywhere.com/ (click on the send feedback link) maybe the guys can give you an option instead of paypal. On Sat, Jan 19, 2013 at 12:11 AM, samuel bonilla pythonn...@gmail.comwrote: I'm doing testing for my application in pythonanywhere.com, but I had some problems with paypal and I could not buy a domain. someone can recommend another hosting web2py to not only accept paypal ? thank you very much. -- --
[web2py] Re: New Plugin: plugin_markitup
Nice work. This will be useful with auth.wiki. Plugin_wiki is going to be deprecated (unless somebody adopts it) and has been removed from the book. On Sunday, 12 February 2012 15:07:04 UTC-6, Ross Peoples wrote: I have created another plugin for the MarkItUp widget. I know that plugin_wiki has this currently, but I wanted a dedicated plugin for this for an upcoming project I'm working on. You can get the plugin from Bitbucket: https://bitbucket.org/PhreeStyle/web2py_markitup There is no documentation yet, as I just pushed the code. But I wanted to announce in case anyone wants to play with this. It has not been thoroughly tested and is only an alpha at this point. It can be used with several different markup languages: - BBCode - HTML - Markdown - Markmin - reStructuredText - Textile - Wiki The plugin can be used standalone, or as a form field widget. It currently supports live previews for 4 markup languages: html, markmin, markdown, textile, and bbcode. Code blocks for markmin and markdown markup are highlighted by pygments, which is included as part of the plugin. No external dependencies. Using pygments for code highlighting allows over 100 languages to be highlighted. Code highlighting in markmin: `` def testing(): print 'Testing' ``:python Code highlighting in markdown: :::python def testing(): print 'Testing' Markdown requires four spaces at the beginning of each line for code blocks. Example for basic usage: from plugin_markitup.markitup import MarkItUp def test(): widget = MarkItUp(set_name='markmin').markitup() return dict(widget=widget) Example model for form fields: from plugin_markitup.markitup import MarkItUp db.define_table('content', Field('name', length=20), Field('description', 'text') ) db.content.description.widget = MarkItUp().widget Example controller: def test(): form = SQLFORM(db.content) if form.accepts(request, session): redirect(URL()) return dict(form=form) This plugin is more of an alpha preview, so I expect there to be problems and inconsistencies. Please try it out and let me know if you have any questions, comments, or problems! --
Re: [web2py] If I upload a file manually does it check the validators?
filename=(fileApp.filename.replace(' ', '') if fileApp else '') On Friday, 18 January 2013 19:55:56 UTC-6, Tito Garrido wrote: On Fri, Jan 18, 2013 at 10:30 PM, Bruno Rocha rocha...@gmail.comjavascript: wrote: db.files.validate_and_insert(file_upload=db.files.file_upload.store(fileApp, filename)) Seems that it is firing the validator but there is an issue: type 'exceptions.AttributeError' 'NoneType' object has no attribute 'filename' Version web2py™ (2, 3, 2, datetime.datetime(2012, 12, 17, 15, 3, 30), 'stable') Python Python 2.6.6: /usr/bin/python Traceback 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. Traceback (most recent call last): File /home/titog/Documents/Projetos/web2py/gluon/restricted.py, line 212, in restricted exec ccode in environment File /home/titog/Documents/Projetos/web2py/applications/cms/controllers/default.py http://127.0.0.1:8000/admin/default/edit/cms/controllers/default.py, line 114, in module File /home/titog/Documents/Projetos/web2py/gluon/globals.py, line 193, in lambda self._caller = lambda f: f() File /home/titog/Documents/Projetos/web2py/applications/cms/controllers/default.py http://127.0.0.1:8000/admin/default/edit/cms/controllers/default.py, line 85, in my_upload filename=fileApp.filename.replace(' ', '') AttributeError: 'NoneType' object has no attribute 'filename' Error snapshot [image: help] type 'exceptions.AttributeError'('NoneType' object has no attribute 'filename') Not sure why... -- Linux User #387870 . _/_õ|__| ..º[ .-.___.-._| . . . . .__( o)__( o).:___ --
[web2py] Re: Logging in with applications.
The last link was the one I was looking at first. Before this post. But login_bare returns user if the user exists and the password is valid, else it returns False. username is the email if the auth_user table does not have a username field. doesn't sound like I logged in a user. It just returns the user and returns false. But I will give it a try. BR, Jason Brower On Friday, January 18, 2013 11:39:35 PM UTC+2, Alan Etkin wrote: My current app runs with only JSON calls is there a way to make the login occure with JSON? Did you check this? http://www.web2py.com/books/default/chapter/29/10#Services-and-Authentication http://www.web2py.com/books/default/chapter/29/09#Access-Control-and-Basic-Authentication http://www.web2py.com/books/default/chapter/29/09#Manual-Authentication --
[web2py] Storing Python code in db?
I am testing out to store Python code and run it by extracting it from the database. It looks simple but it's giving me a weird error. *//Code* {{a=row.temp}} //question.temp is def f(x):\nx = x + 1\ny = 10\n return x + y same as below {{b=def f(x):\nx = x + 1\ny = 10\nreturn x + y}} {{=a}} br/ {{=b}} *//Result* def f(x):\n x = x + 1\n y = 10\n return x+y def f(x): x = x + 1 y = 10 return x + y As you can see, 'a' still has \n in it when 'b' doesn't. What is causing this problem? Also, what would be the best way to store something like that? Thank you. --