[web2py] Redirect to https (V 2.0.6)
Hi! Another issues/whishes: - In the welcome app, is it possible to redirect to https rather then http when clicking on the button named "Administrative interface" - When creating a new app via the admin interface "New simple application", i receive following error: unable to create application "test1" Traceback (most recent call last): File "/home/gniemetz/webapps/web2py/web2py/gluon/admin.py", line 188, in app_create w2p_unpack('welcome.w2p', path) File "/home/gniemetz/webapps/web2py/web2py/gluon/fileutils.py", line 243, in w2p_unpack fgzipped = gzopen(filename, 'rb') File "/usr/local/lib/python2.7/gzip.py", line 34, in open return GzipFile(filename, mode, compresslevel) File "/usr/local/lib/python2.7/gzip.py", line 89, in __init__ fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb') IOError: [Errno 2] No such file or directory: '/home/gniemetz/webapps/web2py/web2py/welcome.w2p' My workaraound was to pack the welcome app, name it welcome.w2p and put it into the web2py folder regards Gerd --
[web2py] Re: Cannot login via web2py mobile admin (V 2.0.6)
I've used https on the iphone Am Montag, 3. September 2012 15:47:35 UTC+2 schrieb Massimo Di Pierro: > > Please check trunk. I think the problem is that admin requires https. > > On Monday, 3 September 2012 08:44:22 UTC-5, Massimo Di Pierro wrote: >> >> Ouch! Can can fix this. >> >> On Monday, 3 September 2012 07:27:33 UTC-5, Gerd wrote: >>> >>> Hi! >>> >>> First i want to thank Massimo and all the other contributors for their >>> great work! >>> >>> I've found an issue: >>> When trying to login to the admin interface via an iPhone the "web2py >>> mobile admin" shows up, and there the Login-Button is not a button but a >>> text-field, see the screenshot >>> >>> regards >>> Gerd >>> >>> >>> --
[web2py] Re: Cannot login via web2py mobile admin (V 2.0.6)
The iphone also connects well with https --
[web2py] Receiving error when exporting to TSV with SQLFORM.grid (V2.0.8)
7;time',requires=IS_TIME <https://web2py.niemetz.it/examples/global/vars/IS_TIME>(),label=T <https://web2py.niemetz.it/examples/global/vars/T>('End'),represent=lambda row: row.strftime('%H:%M')), Field <https://web2py.niemetz.it/examples/global/vars/Field>('Thema',db.Themen,label=T <https://web2py.niemetz.it/examples/global/vars/T>('Topic')), Field <https://web2py.niemetz.it/examples/global/vars/Field>('Teilnehmer','integer',label=T <https://web2py.niemetz.it/examples/global/vars/T>('Number of participants')), Field <https://web2py.niemetz.it/examples/global/vars/Field>('Kosten','decimal(7,2)',requires=IS_DECIMAL_IN_RANGE <https://web2py.niemetz.it/examples/global/vars/IS_DECIMAL_IN_RANGE>(dot=','),label=T <https://web2py.niemetz.it/examples/global/vars/T>('Cost of participants'),represent=lambda row: str('€ %s' % row if row else '').replace('.',',').replace(',00',',-')), Field <https://web2py.niemetz.it/examples/global/vars/Field>('Erloese','decimal(7,2)',requires=IS_DECIMAL_IN_RANGE <https://web2py.niemetz.it/examples/global/vars/IS_DECIMAL_IN_RANGE>(dot=','),label=T <https://web2py.niemetz.it/examples/global/vars/T>('Revenues'),compute=lambda row: row['Teilnehmer']*row['Kosten'],represent=lambda row: SPAN <https://web2py.niemetz.it/examples/global/vars/SPAN>(str('€ %s' % row if row else '').replace('.',',').replace(',00',',-'),_style='color: green')), Field <https://web2py.niemetz.it/examples/global/vars/Field>('KM_Beginn','integer',label=T <https://web2py.niemetz.it/examples/global/vars/T>('Mileage Start'),represent=lambda row: str('{:,} km'.format(row)).replace(',','*').replace('.',',').replace('*','.')), Field <https://web2py.niemetz.it/examples/global/vars/Field>('KM_Ende','integer',label=T <https://web2py.niemetz.it/examples/global/vars/T>('Mileage End'),represent=lambda row: str('{:,} km'.format(row)).replace(',','*').replace('.',',').replace('*','.')), Field <https://web2py.niemetz.it/examples/global/vars/Field>('Sum_Zeit','time',label=T <https://web2py.niemetz.it/examples/global/vars/T>('Hours Summary'),compute=lambda row: datetime.combine(date.today(),row['Ende'])-datetime.combine(date.today(),row['Beginn']),requires=IS_TIME <https://web2py.niemetz.it/examples/global/vars/IS_TIME>(),represent=lambda row: row.strftime('%H:%M')), Field <https://web2py.niemetz.it/examples/global/vars/Field>('Sum_KM','integer',label=T <https://web2py.niemetz.it/examples/global/vars/T>('Mileage Summary'),compute=lambda row: row['KM_Ende']-row['KM_Beginn'],represent=lambda row: str('{:,} km'.format(row)).replace(',','*').replace('.',',').replace('*','.')), Field <https://web2py.niemetz.it/examples/global/vars/Field>('KM_Geld',db.KM_Gelder,label=T <https://web2py.niemetz.it/examples/global/vars/T>('Mileage Cost'),requires=IS_IN_DB <https://web2py.niemetz.it/examples/global/vars/IS_IN_DB>(db(query),'KM_Gelder.id',db.KM_Gelder._format),represent=lambda id: str('€ %(Tarif)s' % db.KM_Gelder(id) if db.KM_Gelder(id) else '').replace('.',',').replace(',00',',-')), Field <https://web2py.niemetz.it/examples/global/vars/Field>('Autokosten','decimal(7,2)',label=T <https://web2py.niemetz.it/examples/global/vars/T>('Mileage Summary Cost'),compute=lambda row: (row['KM_Ende']-row['KM_Beginn'])*db.KM_Gelder(row['KM_Geld']).Tarif,represent=lambda row: SPAN <https://web2py.niemetz.it/examples/global/vars/SPAN>(str('€ %s' % row if row else '').replace('.',',').replace(',00',',-'),_style='color: red')), Field <https://web2py.niemetz.it/examples/global/vars/Field>('Kommentar','string',length=200,label=T <https://web2py.niemetz.it/examples/global/vars/T>('Comment')) ) db.Logbuch.id.readable=db.Logbuch.id.writeable=False and this is the controller @auth.requires_login() def index(): #response.flash = T('Welcome to your divebook!') grid = SQLFORM <https://web2py.niemetz.it/examples/global/vars/SQLFORM>.grid(db.Logbuch,fields=[db.Logbuch.Datum,db.Logbuch.Kurs,db.Logbuch.Thema,db.Logbuch.Kommentar],maxtextlength=50) return locals() What's going wrong here? Thanks for your efforts regards Gerd --
[web2py] Re: Receiving error when exporting to TSV with SQLFORM.grid (V2.0.8)
Thank you Massimo, it worked Am Mittwoch, 12. September 2012 14:38:43 UTC+2 schrieb Massimo Di Pierro: > > represent takes always two values. You have > > represent=lambda row: row.strftime('%H:%M')), > > > but you should have > > represent=lambda value,row: value.strftime('%H:%M')), > > > On Wednesday, 12 September 2012 05:02:28 UTC-5, Gerd wrote: >> >> Hi! >> >> First: This is my first try to build a "real" application in web2py and >> python, i'm new to both but like it very much (i'm coming from bash/awk/sed) >> >> I receive following error when trying to export a SQLFORM.grid to TSV >> (Excel compatible), but CSV works >> >> Traceback (most recent call last): >> File "/home/gniemetz/webapps/web2py/web2py/gluon/restricted.py", line 209, >> in restricted >> exec ccode in environment >> File >> "/home/gniemetz/webapps/web2py/web2py/applications/tauchbuch/controllers/default.py" >> >> <https://web2py.niemetz.it/admin/default/edit/tauchbuch/controllers/default.py>, >> line 78, in >> File "/home/gniemetz/webapps/web2py/web2py/gluon/globals.py", line 185, in >> >> self._caller = lambda f: f() >> File "/home/gniemetz/webapps/web2py/web2py/gluon/tools.py", line 2783, in f >> return action(*a, **b) >> File >> "/home/gniemetz/webapps/web2py/web2py/applications/tauchbuch/controllers/default.py" >> >> <https://web2py.niemetz.it/admin/default/edit/tauchbuch/controllers/default.py>, >> line 22, in index >> grid = >> SQLFORM.grid(db.Logbuch,fields=[db.Logbuch.Datum,db.Logbuch.Kurs,db.Logbuch.Thema,db.Logbuch.Kommentar],maxtextlength=50) >> File "/home/gniemetz/webapps/web2py/web2py/gluon/sqlhtml.py", line 1858, >> in grid >> raise HTTP(200, oExp.export(),**response.headers) >> File "/home/gniemetz/webapps/web2py/web2py/gluon/sqlhtml.py", line 2627, >> in export >> records = self.represented() >> File "/home/gniemetz/webapps/web2py/web2py/gluon/sqlhtml.py", line 2594, >> in represented >> value = field.represent(value, record) >> TypeError: () takes exactly 1 argument (2 given) >> >> >> This is my model (a bit complicated, maybe there's room for improvement) >> >> db.define_table('KFZ', >> Field >> <https://web2py.niemetz.it/examples/global/vars/Field>('Auto','string',length=30,label=T >> <https://web2py.niemetz.it/examples/global/vars/T>('Car')), >> Field >> <https://web2py.niemetz.it/examples/global/vars/Field>('Kennzeichen','string',length=10,label=T >> <https://web2py.niemetz.it/examples/global/vars/T>('License plate')), >> Field >> <https://web2py.niemetz.it/examples/global/vars/Field>('KM','integer',label=T >> <https://web2py.niemetz.it/examples/global/vars/T>('Mileage')), >> Field >> <https://web2py.niemetz.it/examples/global/vars/Field>('gueltig_bis','date',label=T >> <https://web2py.niemetz.it/examples/global/vars/T>('Expired')), >> format='%(Auto)s %(Kennzeichen)s' >> ) >> >> db.define_table('Themen', >> Field >> <https://web2py.niemetz.it/examples/global/vars/Field>('Thema','string',length=30,label=T >> <https://web2py.niemetz.it/examples/global/vars/T>('Topic')), >> Field >> <https://web2py.niemetz.it/examples/global/vars/Field>('gueltig_bis','date',label=T >> <https://web2py.niemetz.it/examples/global/vars/T>('Expired')), >> format='%(Thema)s' >> ) >> >> db.define_table('KM_Gelder', >> Field >> <https://web2py.niemetz.it/examples/global/vars/Field>('Tarif','decimal(3,2)',requires=IS_DECIMAL_IN_RANGE >> >> <https://web2py.niemetz.it/examples/global/vars/IS_DECIMAL_IN_RANGE>(dot=','),label=T >> <https://web2py.niemetz.it/examples/global/vars/T>('Mileage Cost')), >> Field >> <https://web2py.niemetz.it/examples/global/vars/Field>('gueltig_bis','date',label=T >> <https://web2py.niemetz.it/examples/global/vars/T>('Expired')), >> format=lambda row: str('%(Tarif)s' % row if row else >> '').re
[web2py] onvalidation in SQLFORM.grid (V2.0.9)
Hi! I receive the following error Traceback (most recent call last): File "/home/gniemetz/webapps/web2py/web2py/gluon/restricted.py", line 209, in restricted exec ccode in environment File "/home/gniemetz/webapps/web2py/web2py/applications/tauchbuch/controllers/default.py" <https://tauchbuch.niemetz.it/admin/edit/tauchbuch/controllers/default.py>, line 92, in File "/home/gniemetz/webapps/web2py/web2py/gluon/globals.py", line 186, in self._caller = lambda f: f() File "/home/gniemetz/webapps/web2py/web2py/gluon/tools.py", line 2809, in f return action(*a, **b) File "/home/gniemetz/webapps/web2py/web2py/applications/tauchbuch/controllers/default.py" <https://tauchbuch.niemetz.it/admin/edit/tauchbuch/controllers/default.py>, line 16, in index if grid.errors: AttributeError: 'DIV' object has no attribute 'errors' This is the controller @auth.requires_login() def index(): grid = SQLFORM <https://web2py.niemetz.it/examples/global/vars/SQLFORM>.grid(db.Logbuch,fields=[db.Logbuch.Datum,db.Logbuch.Kurs,db.Logbuch.Thema,db.Logbuch.Kommentar],maxtextlength=50,orderby=[~db.Logbuch.Datum],onvalidation=check_km) if grid.errors: response <https://web2py.niemetz.it/examples/global/vars/response>.flash = 'Bitte Eingaben überprüfen' return locals() def check_km(form): if form.vars.KM_Beginn >= form.vars.KM_Ende: form.errors.KM_Ende = 'KM-Stand Ende kleiner/gleich KM-Stand Beginn' What i'm trying to do is to set response.flash What am i doing wrong here? Thanks, regards Gerd --
[web2py] Re: onvalidation in SQLFORM.grid (V2.0.9)
Hi again! I found it, the right way is if FORM(grid).errors: but unfortunately the response.flash gets not set, it has always the value "Errors in form, please check it out". I tried to set it in index and in check_km with no luck Has someone a good idea? Regards Gerd Am Freitag, 14. September 2012 13:25:45 UTC+2 schrieb Gerd: > > Hi! > > I receive the following error > > Traceback (most recent call last): > File "/home/gniemetz/webapps/web2py/web2py/gluon/restricted.py", line 209, > in restricted > exec ccode in environment > File > "/home/gniemetz/webapps/web2py/web2py/applications/tauchbuch/controllers/default.py" > <https://tauchbuch.niemetz.it/admin/edit/tauchbuch/controllers/default.py>, > line 92, in > File "/home/gniemetz/webapps/web2py/web2py/gluon/globals.py", line 186, in > > self._caller = lambda f: f() > File "/home/gniemetz/webapps/web2py/web2py/gluon/tools.py", line 2809, in f > return action(*a, **b) > File > "/home/gniemetz/webapps/web2py/web2py/applications/tauchbuch/controllers/default.py" > <https://tauchbuch.niemetz.it/admin/edit/tauchbuch/controllers/default.py>, > line 16, in index > if grid.errors: > AttributeError: 'DIV' object has no attribute 'errors' > > > > This is the controller > > @auth.requires_login() > def index(): > grid = SQLFORM > <https://web2py.niemetz.it/examples/global/vars/SQLFORM>.grid(db.Logbuch,fields=[db.Logbuch.Datum,db.Logbuch.Kurs,db.Logbuch.Thema,db.Logbuch.Kommentar],maxtextlength=50,orderby=[~db.Logbuch.Datum],onvalidation=check_km) > if grid.errors: > response > <https://web2py.niemetz.it/examples/global/vars/response>.flash = 'Bitte > Eingaben überprüfen' > return locals() > > def check_km(form): > if form.vars.KM_Beginn >= form.vars.KM_Ende: > form.errors.KM_Ende = 'KM-Stand Ende kleiner/gleich KM-Stand Beginn' > > > What i'm trying to do is to set response.flash > > What am i doing wrong here? > > Thanks, > regards > Gerd > > > --
[web2py] Re: onvalidation in SQLFORM.grid (V2.0.9)
Thanks for your help Massimo Am Freitag, 14. September 2012 16:08:14 UTC+2 schrieb Massimo Di Pierro: > > Hello Gerd, the grid is a grid. It is not a form (although it may contain > forms) therefore it does not have a grid.errors. Embedding into a form does > not solve the problem. > > Yet you can check if the grid contains a form and whet the errors for that > form are: > > if grid.create_form and grid.create_form.errors: > > if grid.update_form and grid.update_form.errors: > > > > > On Friday, 14 September 2012 06:58:19 UTC-5, Gerd wrote: >> >> Hi again! >> >> I found it, the right way is >> >> if FORM(grid).errors: >> >> >> but unfortunately the response.flash gets not set, it has always the >> value "Errors in form, please check it out". I tried to set it in index and >> in check_km with no luck >> >> Has someone a good idea? >> >> Regards >> Gerd >> >> >> Am Freitag, 14. September 2012 13:25:45 UTC+2 schrieb Gerd: >>> >>> Hi! >>> >>> I receive the following error >>> >>> Traceback (most recent call last): >>> File "/home/gniemetz/webapps/web2py/web2py/gluon/restricted.py", line >>> 209, in restricted >>> exec ccode in environment >>> File >>> "/home/gniemetz/webapps/web2py/web2py/applications/tauchbuch/controllers/default.py" >>> >>> <https://tauchbuch.niemetz.it/admin/edit/tauchbuch/controllers/default.py>, >>> line 92, in >>> File "/home/gniemetz/webapps/web2py/web2py/gluon/globals.py", line 186, >>> in >>> self._caller = lambda f: f() >>> File "/home/gniemetz/webapps/web2py/web2py/gluon/tools.py", line 2809, in >>> f >>> return action(*a, **b) >>> File >>> "/home/gniemetz/webapps/web2py/web2py/applications/tauchbuch/controllers/default.py" >>> >>> <https://tauchbuch.niemetz.it/admin/edit/tauchbuch/controllers/default.py>, >>> line 16, in index >>> if grid.errors: >>> AttributeError: 'DIV' object has no attribute 'errors' >>> >>> >>> >>> This is the controller >>> >>> @auth.requires_login() >>> def index(): >>> grid = SQLFORM >>> <https://web2py.niemetz.it/examples/global/vars/SQLFORM>.grid(db.Logbuch,fields=[db.Logbuch.Datum,db.Logbuch.Kurs,db.Logbuch.Thema,db.Logbuch.Kommentar],maxtextlength=50,orderby=[~db.Logbuch.Datum],onvalidation=check_km) >>> if grid.errors: >>> response >>> <https://web2py.niemetz.it/examples/global/vars/response>.flash = 'Bitte >>> Eingaben überprüfen' >>> return locals() >>> >>> def check_km(form): >>> if form.vars.KM_Beginn >= form.vars.KM_Ende: >>> form.errors.KM_Ende = 'KM-Stand Ende kleiner/gleich KM-Stand Beginn' >>> >>> >>> What i'm trying to do is to set response.flash >>> >>> What am i doing wrong here? >>> >>> Thanks, >>> regards >>> Gerd >>> >>> >>> --
[web2py] Re: Cannot login via web2py mobile admin (V 2.0.6)
Hi! I'm running V2.0.9 and still it is not possible to login via an iphone (tried it with safari and chrome) Gerd Am Montag, 3. September 2012 15:47:35 UTC+2 schrieb Massimo Di Pierro: > > Please check trunk. I think the problem is that admin requires https. > > On Monday, 3 September 2012 08:44:22 UTC-5, Massimo Di Pierro wrote: >> >> Ouch! Can can fix this. >> >> On Monday, 3 September 2012 07:27:33 UTC-5, Gerd wrote: >>> >>> Hi! >>> >>> First i want to thank Massimo and all the other contributors for their >>> great work! >>> >>> I've found an issue: >>> When trying to login to the admin interface via an iPhone the "web2py >>> mobile admin" shows up, and there the Login-Button is not a button but a >>> text-field, see the screenshot >>> >>> regards >>> Gerd >>> >>> >>> --
[web2py] How to show no seconds in a time field
Hi web2py-users! I've got the following question: I've defined two field like this Field('Beginn','time',requires=IS_EMPTY_OR(IS_TIME()),label=T('Start'),represent=lambda value, row: value.strftime('%H:%M') if value else ''), Field('Ende','time',requires=IS_EMPTY_OR(IS_TIME()),label=T('End'),represent=lambda value, row: value.strftime('%H:%M') if value else ''), In the view of the SQLFORM.grid it looks perfect (see screenshot, no seconds in the fields Beginn and Ende) But if i open it to edit then it looks like this (the seconds in Beginn and Ende are shown): And further if i activate one of the fields Beginn or Ende it dismisses the seconds: I've changed the web2py.js to the following, but i did'nt help jQuery("input.time",target).each(function(){jQuery(this).timeEntry({show24Hours:true, showSeconds:false});}); Anyone know how to prevent this behaviour? Thanks in advance, Gerd -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: How to dont show seconds in a time field
Hi Annet! So if i understand this right there is no possibility to change the representation in an update form? Thank you Gerd Am Dienstag, 5. Februar 2013 17:33:56 UTC+1 schrieb Annet: > > Hi Gerd, > > Maybe Anthony's reply in this post answers your question: > > > https://groups.google.com/forum/?fromgroups=#!searchin/web2py/annet$20represent/web2py/dIRLNvDDC_A/WVNLYcwkF4kJ > > Kind regards, > > Annet > -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: How to dont show seconds in a time field
Hi Annet and DenesL! @DenesL: Yes, did restart it, nothings changed @Annet: Thanks you very much, you got it regards Gerd Am Mittwoch, 6. Februar 2013 13:31:24 UTC+1 schrieb Annet: > > Hi Gerd, > > So if i understand this right there is no possibility to change the >> representation in an update form? >> > > > Yes, besides, I am not sure whether IS_TIME() has a format property like > IS_DATE() and IS_DATETIME() have. > In 2009 it hadn't, and Chris helped me solve the problem as follows: > > In db.py: > > istime = dict(type='time',requires=IS_TIME(error_message=T('no match > HH:MM')),widget=timeplain,comment=T('Format HH:MM')) > > Field('startTime',**istime), > Field('endTime',**istime), > > In a module: > > def timeplain(field,value): > if value == None: > value = '' > elif 'strftime' in dir(value): > value = value.strftime('%H:%M') > id = '%s_%s' % (field._tablename, field.name) > return INPUT(_type='text',_id=id,_class='time_plain',_name=field.name > ,value=str(value),requires=field.requires) > > and in case you need it, in a view: > > {{=table.startTime.strftime("%H:%M")}} > > > Kind regards, > > Annet > -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: How to dont show seconds in a time field
Am Donnerstag, 7. Februar 2013 00:20:02 UTC+1 schrieb DenesL: > > > > On Wednesday, February 6, 2013 8:24:01 AM UTC-5, Gerd wrote: >> >> Hi Annet and DenesL! >> >> @DenesL: Yes, did restart it, nothings changed >> > > True. Note that the input will show HH:MM:SS until you click on it, then > it becomes HH:MM. > Thats what i described in the starting thread > > >> >> @Annet: Thanks you very much, you got it >> >> regards >> Gerd >> >> Am Mittwoch, 6. Februar 2013 13:31:24 UTC+1 schrieb Annet: >>> >>> Hi Gerd, >>> >>> So if i understand this right there is no possibility to change the >>>> representation in an update form? >>>> >>> >>> >>> Yes, besides, I am not sure whether IS_TIME() has a format property like >>> IS_DATE() and IS_DATETIME() have. >>> In 2009 it hadn't, and Chris helped me solve the problem as follows: >>> >>> In db.py: >>> >>> istime = dict(type='time',requires=IS_TIME(error_message=T('no match >>> HH:MM')),widget=timeplain,comment=T('Format HH:MM')) >>> >>> Field('startTime',**istime), >>> Field('endTime',**istime), >>> >>> In a module: >>> >>> def timeplain(field,value): >>> if value == None: >>> value = '' >>> elif 'strftime' in dir(value): >>> value = value.strftime('%H:%M') >>> id = '%s_%s' % (field._tablename, field.name) >>> return INPUT(_type='text',_id=id,_class='time_plain',_name= >>> field.name,value=str(value),requires=field.requires) >>> >> > The only caveat here is that you will not be using jQuery.timeEntry, > unless you change the class to just 'time'. > You can also do: > > widget=lambda field,value: SQLFORM.widgets.time.widget(field, > value.strftime('%H:%M') if value else '') > > but you still need to add {showSeconds:false} to .timeEntry in web2py.js > > I see, thank you very much DenesL > > >> >>> and in case you need it, in a view: >>> >>> {{=table.startTime.strftime("%H:%M")}} >>> >>> >>> Kind regards, >>> >>> Annet >>> >> -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: How to dont show seconds in a time field
Am Donnerstag, 7. Februar 2013 10:56:31 UTC+1 schrieb DenesL: > > > > On Thursday, February 7, 2013 2:53:50 AM UTC-5, Gerd wrote: >> >> >> >> Am Donnerstag, 7. Februar 2013 00:20:02 UTC+1 schrieb DenesL: >>> >>> >>> >>> On Wednesday, February 6, 2013 8:24:01 AM UTC-5, Gerd wrote: >>>> >>>> Hi Annet and DenesL! >>>> >>>> @DenesL: Yes, did restart it, nothings changed >>>> >>> >>> True. Note that the input will show HH:MM:SS until you click on it, then >>> it becomes HH:MM. >>> >> >> Thats what i described in the starting thread >> > > Oh yeah, I was not able to open the images in the original post so I got > distracted in the middle of it but I should have re-read the whole thing. > > >> >>> >>>> >>>> @Annet: Thanks you very much, you got it >>>> >>>> regards >>>> Gerd >>>> >>>> Am Mittwoch, 6. Februar 2013 13:31:24 UTC+1 schrieb Annet: >>>>> >>>>> Hi Gerd, >>>>> >>>>> So if i understand this right there is no possibility to change the >>>>>> representation in an update form? >>>>>> >>>>> >>>>> >>>>> Yes, besides, I am not sure whether IS_TIME() has a format property >>>>> like IS_DATE() and IS_DATETIME() have. >>>>> In 2009 it hadn't, and Chris helped me solve the problem as follows: >>>>> >>>>> In db.py: >>>>> >>>>> istime = dict(type='time',requires=IS_TIME(error_message=T('no match >>>>> HH:MM')),widget=timeplain,comment=T('Format HH:MM')) >>>>> >>>>> Field('startTime',**istime), >>>>> Field('endTime',**istime), >>>>> >>>>> In a module: >>>>> >>>>> def timeplain(field,value): >>>>> if value == None: >>>>> value = '' >>>>> elif 'strftime' in dir(value): >>>>> value = value.strftime('%H:%M') >>>>> id = '%s_%s' % (field._tablename, field.name) >>>>> return INPUT(_type='text',_id=id,_class='time_plain',_name= >>>>> field.name,value=str(value),requires=field.requires) >>>>> >>>> >>> The only caveat here is that you will not be using jQuery.timeEntry, >>> unless you change the class to just 'time'. >>> You can also do: >>> >>> widget=lambda field,value: SQLFORM.widgets.time.widget(field, >>> value.strftime('%H:%M') if value else '') >>> >>> but you still need to add {showSeconds:false} to .timeEntry in web2py.js >>> >>> >> I see, thank you very much DenesL >> > > To avoid modifying web2py.js we could do: > > > script=SCRIPT('jQuery(document).ready(function(){jQuery("input.mytime").timeEntry({showSeconds:false});});') > widget=lambda field,value: TAG[''](SQLFORM.widgets.time.widget(field, > value.strftime('%H:%M') if value else '', _class='mytime'),script) > > and add that widget to the required fields in the model: > Field(..., widget=widget) > > this way we can pass any parameters to jQuery.timeEntry as we need ;) > > Wow, i'm impressed, nice job :) Thanks again DenesL regards Gerd > >>> >>>> >>>>> and in case you need it, in a view: >>>>> >>>>> {{=table.startTime.strftime("%H:%M")}} >>>>> >>>>> >>>>> Kind regards, >>>>> >>>>> Annet >>>>> >>>> -- --- 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: Edit or delete not committing in sqlform.grid for custom query
Hi! I'm actually using V2.0.9 and the error is still active. Is it fixed in 2.1.0? Thanks, Gerd Am Donnerstag, 13. September 2012 20:24:01 UTC+2 schrieb Mandar Vaze: > > For now, I'm calling db.commit on my own ondelete function > > def my_ondelete_function(table, record_id): > print "Deleting %s from %s" % (record_id, table) > > db(table[table._id.name]==record_id).delete() > > db.commit() > > so technically same delete() gets called twice - first in my ondelete > function (listed above) and then immediately in gluon/sqlhtml.py > I know it is wrong/incorrect, but seems to be working for me. > > Waiting for suggestions/comments from the group. > > -Mandar > > On Thursday, September 13, 2012 11:46:09 PM UTC+5:30, Mandar Vaze wrote: >> >> I'm using version 2.0.7 and seeing the same problem. >> I looked at the gluon/sqlhtml.py and it doesn't look like problem is >> specific to custom query (Although I too have custom query passed to the >> sqlform.grid) >> >> elif deletable and len(request.args)>2 and >> request.args[-3]=='delete': >> table = db[request.args[-2]] >> >> if ondelete: >> >> ondelete(table,request.args[-1]) >> >> ret = db(table[table._id.name]==request.args[-1]).delete() >> >> db.commit() # If I add this, the record is deleted from DB too >> return ret >> >> I confirmed this by adding "db.commit()" just prior to returning. Without >> this line, the record is removed from the table - but not form DB. So next >> time we refresh and re-render the table, the deleted record re-appears >> >> BTW, I have another function for bulk_delete (User selects from checkbox, >> and deleted selected records in one go) I am not calling db.commit() there >> explicitly but the records are indeed deleted from DB. >> >> What is going on ? >> >> -Mandar >> >> On Tuesday, June 12, 2012 6:14:38 PM UTC+5:30, rahulserver wrote: >>> >>> I have the following sqlform.grid: >>> COMMITMENTS=SQLFORM.grid((db.Commitments.Account==session.id >>> ),user_signature=False) >>> >>> When I try to edit any row of the form, the edit is not committing. Is >>> it that the sqlform.grid does not allow edits for query arguments? >>> >> --
[web2py] Re: Edit or delete not committing in sqlform.grid for custom query
Hi! Any updates on this? Am Sonntag, 30. September 2012 16:16:33 UTC+2 schrieb Gerd: > > Hi! > > I'm actually using V2.0.9 and the error is still active. Is it fixed in > 2.1.0? > > Thanks, > Gerd > > Am Donnerstag, 13. September 2012 20:24:01 UTC+2 schrieb Mandar Vaze: >> >> For now, I'm calling db.commit on my own ondelete function >> >> def my_ondelete_function(table, record_id): >> print "Deleting %s from %s" % (record_id, table) >> >> db(table[table._id.name]==record_id).delete() >> >> db.commit() >> >> so technically same delete() gets called twice - first in my ondelete >> function (listed above) and then immediately in gluon/sqlhtml.py >> I know it is wrong/incorrect, but seems to be working for me. >> >> Waiting for suggestions/comments from the group. >> >> -Mandar >> >> On Thursday, September 13, 2012 11:46:09 PM UTC+5:30, Mandar Vaze wrote: >>> >>> I'm using version 2.0.7 and seeing the same problem. >>> I looked at the gluon/sqlhtml.py and it doesn't look like problem is >>> specific to custom query (Although I too have custom query passed to the >>> sqlform.grid) >>> >>> elif deletable and len(request.args)>2 and >>> request.args[-3]=='delete': >>> table = db[request.args[-2]] >>> >>> if ondelete: >>> >>> ondelete(table,request.args[-1]) >>> >>> ret = db(table[table._id.name]==request.args[-1]).delete() >>> >>> db.commit() # If I add this, the record is deleted from DB too >>> return ret >>> >>> I confirmed this by adding "db.commit()" just prior to returning. >>> Without this line, the record is removed from the table - but not form DB. >>> So next time we refresh and re-render the table, the deleted record >>> re-appears >>> >>> BTW, I have another function for bulk_delete (User selects from >>> checkbox, and deleted selected records in one go) I am not calling >>> db.commit() there explicitly but the records are indeed deleted from DB. >>> >>> What is going on ? >>> >>> -Mandar >>> >>> On Tuesday, June 12, 2012 6:14:38 PM UTC+5:30, rahulserver wrote: >>>> >>>> I have the following sqlform.grid: >>>> COMMITMENTS=SQLFORM.grid((db.Commitments.Account==session.id >>>> ),user_signature=False) >>>> >>>> When I try to edit any row of the form, the edit is not committing. Is >>>> it that the sqlform.grid does not allow edits for query arguments? >>>> >>> --
[web2py] Re: Redirect to https (V 2.0.6)
Hi! Thanks for finding this :) best regards, Gerd Am Donnerstag, 22. November 2012 15:58:10 UTC+1 schrieb Nico Zanferrari: > > Got it! > > Following Massimo's > advice<https://groups.google.com/forum/#!msg/web2py/nsXx1KI49JA/Kg9GlxutOGQJ>I've > resolved it with a simple: > > python web2py.py -a 'hello' > > > > I've already created a > ticket<http://code.google.com/p/web2py/issues/detail?id=1179&thanks=1179&ts=1353595862>in > order to have it resolved forever. > > Bye, > Nico > > --
[web2py] Re: Merry Christmas everybody!
Frohe Weihnachten und ein gutes neues Jahr! Am Montag, 24. Dezember 2012 19:22:00 UTC+1 schrieb Massimo Di Pierro: > > Merry Christmas everybody! > --
[web2py] Re: book 4th edition in PDF
Hi! It worked for me Thanks Gerd
[web2py] Re: [OT] Pycharm 2 is out
Hi! Voted regards Gerd
[web2py] Re: Web Development Introduction Based On Web2py
Hi! For me it is reachable Regards Gerd
Re: [web2py] Merry christmas
Frohe Weihnachten und gutes neues Jahr Gerd
[web2py] Re: Happy new year
Ein gutes und glückliches neues Jahr Gerd
[web2py] Re: html5 charting library
Hi! I use dygraphs, here you can try some examples -> http://dygraphs.com/experimental/palette/ Regards Gerd
[web2py] Re: Too many redirects when trying to use interactive demo
Hi! I'm having problem with web2py.com/demo_admin. Tried it on a Windows XP SP3 with FF 9.0.1 and IE 8 regards Gerd
[web2py] Re: Too many redirects when trying to use interactive demo
In my office i'm also on a proxy (here i get the error), at home it works perfectly regards Gerd
[web2py] Re: Add Appending Fields to a Form with Ajax
Hi! I'm also interested how this works :) best regards Gerd
[web2py] Input format "Year/Month"
Hi! First i'd like to thank Massimo and all other developers/contributors for the great framework, keep up the good work! Now to my question: How can I create a field that allows input only in the format "/MM". And how should i store the value as date (i thought maybe in the format "/MM/01", or is there a better way)?. How can i achive that? Thanks in advance Gerd
[web2py] Aw: Re: Input format "Year/Month"
Hi! Thank you, i'll give it a try ;) regards Gerd
[web2py] Process uploaded file and save it in Folder uploads
Hi! I have to anonymize HL7 file (replace all personal data with x). How can i process an uploaded file "on the fly". This is what i've tried (when it runs it actually saves the original file content, not the processed) *# Model* db.define_table('filetypes', Field('filetype','string'), Field('seperator','string'), Field('omit','string'), format='%(filetype)s' ) db.define_table('anonymize', Field('filetype','reference filetypes'), Field('uploaded_file','upload') ) *# Controller* def index(): """ example action using the internationalization operator T and flash rendered by views/default/index.html or views/generic.html if you need a simple wiki simple replace the two lines below with: return auth.wiki() """ form = SQLFORM(db.anonymize) data = '' import re hl7 = {'PID':{'pattern':'PID\|','separator':'|','omit':(0,1,2,3)},'NK1':{'pattern':'NK1\|','separator':'|','omit':(0,)},'PV1':{'pattern':'PV1\|','separator':'|','omit':(0,)},'IN1':{'pattern':'IN1\|','separator':'|','omit':(0,)}} if request.vars.uploaded_file != None and request.vars.uploaded_file.filename != '': if re.search('|'.join([hl7[k]['pattern'] for k in hl7]), request.vars.uploaded_file.value): for line in request.vars.uploaded_file.value.splitlines(): replaced_text = '' for k in hl7: replaced_text = '|'.join([len(val) * 'x' if idx not in hl7[k]['omit'] else val for idx, val in enumerate([splitted_text for splitted_text in line.split(hl7[k]['separator'])])]) if re.search(hl7[k]['pattern'],line) else replaced_text data += (replaced_text if replaced_text != '' else line) + '\n' request.vars.uploaded_file.value = data else: data = 'No HL7 Format' else: data = u'No file chosen' if form.process().accepted: response.flash = 'form accepted' elif form.errors: response.flash = 'form has errors' return locals() I thought that the line request.vars.uploaded_file.value = data replaces the original data of the uploaded file, so that the form.process() processes the new (replaced) value What i am doing wrong here? Thanks, Gerd -- --- 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: Process uploaded file and save it in Folder uploads
Thank you Massimo, it worked best regards Gerd Am Mittwoch, 17. Juli 2013 11:36:31 UTC+2 schrieb Massimo Di Pierro: > > Try this instead: > > request.vars.uploaded_file.file = StringIO.StringIO(data) > > On Wednesday, 17 July 2013 03:54:32 UTC-5, Gerd wrote: >> >> Hi! >> >> I have to anonymize HL7 file (replace all personal data with x). How can >> i process an uploaded file "on the fly". This is what i've tried (when it >> runs it actually saves the original file content, not the processed) >> >> *# Model* >> db.define_table('filetypes', >> Field('filetype','string'), >> Field('seperator','string'), >> Field('omit','string'), >> format='%(filetype)s' >> ) >> >> db.define_table('anonymize', >> Field('filetype','reference filetypes'), >> Field('uploaded_file','upload') >> ) >> >> *# Controller* >> def index(): >> """ >> example action using the internationalization operator T and flash >> rendered by views/default/index.html or views/generic.html >> >> if you need a simple wiki simple replace the two lines below with: >> return auth.wiki() >> """ >> form = SQLFORM(db.anonymize) >> >> data = '' >> import re >> hl7 = >> {'PID':{'pattern':'PID\|','separator':'|','omit':(0,1,2,3)},'NK1':{'pattern':'NK1\|','separator':'|','omit':(0,)},'PV1':{'pattern':'PV1\|','separator':'|','omit':(0,)},'IN1':{'pattern':'IN1\|','separator':'|','omit':(0,)}} >> if request.vars.uploaded_file != None and >> request.vars.uploaded_file.filename != '': >> if re.search('|'.join([hl7[k]['pattern'] for k in hl7]), >> request.vars.uploaded_file.value): >> for line in request.vars.uploaded_file.value.splitlines(): >> replaced_text = '' >> for k in hl7: >> replaced_text = '|'.join([len(val) * 'x' if idx not >> in hl7[k]['omit'] else val for idx, val in enumerate([splitted_text for >> splitted_text in line.split(hl7[k]['separator'])])]) if >> re.search(hl7[k]['pattern'],line) else replaced_text >> data += (replaced_text if replaced_text != '' else line) >> + '\n' >> request.vars.uploaded_file.value = data >> else: >> data = 'No HL7 Format' >> else: >> data = u'No file chosen' >> >> if form.process().accepted: >> response.flash = 'form accepted' >> elif form.errors: >> response.flash = 'form has errors' >> return locals() >> >> I thought that the line >> request.vars.uploaded_file.value = data >> replaces the original data of the uploaded file, so that the >> form.process() processes the new (replaced) value >> >> What i am doing wrong here? >> >> Thanks, >> Gerd >> > -- --- 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] Debug web2py with PyCharm 3.0
Hi! How can i debug a web2py application with the new PyCharm 3.0 Professional Edition? Any help is greatly appreciated Thanks Gerd -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Debug web2py with PyCharm 3.0
Hi Tim! Thanks for you help, now it work's for me too best regards Gerd Am Montag, 30. September 2013 09:18:11 UTC+2 schrieb Tim Richardson: > > This works for me: > Use pycharm to open the directory of your web2py installation (not > directly to your application directory) > Navigate to your application > > When you run your application (or do debug) from pycharm, the default > configuration should launch python web2py.py > If it doesn't do this, pycharm has not detected that you are using web2py. > Exit pycharm and delete any .idea folders, which may contain settings from > pycharm 2. > > Assuming you get that working, almost done. > Make sure you don't have any imports of the standard web2py debug library. > > Set a breakpoint in pycharm > start a debug session as you do normally in pycharm. > This works for me. > > > > On Sunday, 29 September 2013 18:09:40 UTC+10, Gerd wrote: >> >> Hi! >> >> How can i debug a web2py application with the new PyCharm 3.0 >> Professional Edition? >> Any help is greatly appreciated >> >> Thanks >> Gerd >> > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] web2py included on Synology DSM
Hi! I would like to see web2py as a package for the Synology NAS, so i wrote an inquery to the company at https://www.synology.com/en-global/form/inquiry/feedback If you feel the same i suggest you to fill out the form and tell them that we want it ;-) Thanks, Gerd -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: cool tool to browse sqlite database
I prefer https://dbeaver.jkiss.org/download/ best regards Gerd Am Sonntag, 3. Dezember 2017 12:10:28 UTC+1 schrieb Pbop: > > http://sqlitebrowser.org/ > > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: PyCharm license for web2py dev - who wants?
+1 Am Sonntag, 11. Oktober 2015 21:21:16 UTC+2 schrieb Francisco Ribeiro: > > Hello all, > > for those who know PyCharm is a great IDE from JetBrains that provides > free licenses for Open Source projects like web2py ( > https://www.jetbrains.com/buy/opensource/?product=pycharm ). To request > such a license, I need to know how many of you would want one of these as > well so I can provide them with a number of seats. > > A "+1" response for me is enough but I will also need your email address > to send you the license key (which you can send on a private message). > > Kind regards, > Francisco > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.