Re: [web2py] Re: SQLite tables not recognised in web2py; even when web2py created them?
If your contrib needs to have its own models and controllers, then you should create it as a plugin. Or you can create a module and define an API for it, take a dummy example. /modules/myawesomemodule.py class MyAwesomeClass(object): it creates the Awesome object which is a login_method to use include in your models db = DAL() from myawesomemodule import MyAwesomeClass something = MyAwesomeClass(db) something.define_tables() auth.settings.login_methods = something def __init__(db, *args, **kwargs): self.db = db def define_tables(self, migrate=True): self.table1 = self.db.define_table(table1, Field(a_field), migrate=migrate ) self.table2 = self.db.define_table(table2, Field(a_field), migrate=migrate ) def do_something(self): self.data = self.db(.).select() # do domething return data Then in following your documentation developers should use you module api as: models/db.py db = DAL(.) from myawesomemodule import MyAwesomeClass something = MyAwesomeClass(db) something.define_tables() auth.settings.login_methods = something On Sat, Feb 9, 2013 at 5:34 AM, Alec Taylor alec.tayl...@gmail.com wrote: But I am creating a contrib for: https://github.com/web2py/web2py/tree/master/gluon/contrib/login_methods (OAuth2; my work-in-progress is on Github) But because of the design of the standard I require 3 additional tables + a user table. So how do you propose I manage this scenario? On Sat, Feb 9, 2013 at 6:26 PM, Bruno Rocha rochacbr...@gmail.com wrote: Usually you create a script file in /models/db.py then you define your tables there, so when starting in shell mode you pass -M python web2py.py -S yourapp -M -M run the models/* files and defines your table as object for you to access. Every framework works in this way. Optionally, you can use db.executesql(PUT YOUR SQL HERE) and do it by your own... On Sat, Feb 9, 2013 at 4:13 AM, Alec Taylor alec.tayl...@gmail.com wrote: Hold up; you mean to tell me I need to redefine the schema each time a new db (DAL object) needs to access it? That sounds silly. Isn't there a way around this? On Saturday, February 9, 2013 4:40:28 PM UTC+11, Vasile Ermicioi wrote: let say you have table1 and table2 in database, you shoud define your tables db.define_table('table1', ..) and only after that you will have access to db.table1 you can;t access db.table2 if it is not defined even if it exists in the database -- --- 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. -- --- 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. -- --- 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. -- --- 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: One database field, two form fields? From seconds to min:sec
Hello all, I decided to tackle this with the first implementation I saw in the documentation. I insert two custom fields, remove the f_measure field from the form and use the SQLForm without Database IO code from the book to process the form. Here's my (somewhat ugly) code, hopefully it will be useful to someone. form = SQLFORM(db.t_exercise_log, fields = [f_record_taken, f_comment, f_scaled], labels = {'f_measure' : EXERCISE_UNIT[exercise.f_unit[0]]}) time_element = TR(LABEL('Time:'), DIV(INPUT(_name='minutes',_type='text',_size='2', _maxlength ='3', requires=IS_INT_IN_RANGE(0,181, error_message=T('Minutes must be between 0 and 180')), _id=t_exercise_log_f_min, _style=width: 2em; margin: 2px 2px 2px 5px;), T(m), INPUT(_name='seconds',_type='text',_size='2', # 0 x 60 requires=IS_INT_IN_RANGE(0,60, error_message=T('Seconds must be between 0 and 59.')), _id=t_exercise_log_f_sec, _style=width: 2em; margin: 2px 2px 2px 5px;), T(s))) form[0].insert(-3,time_element) form.vars.f_measure = 0 Form processing: if form.validate(): sec = form.vars.minutes * 60 + form.vars.seconds form.vars.f_measure = sec # delete fields or DB insertion will fail del form.vars.minutes del form.vars.seconds form.vars.id = db.t_exercise_log.insert(**dict(form.vars)) _updateCurrentExerciseLog(auth.user_id, form.vars.id) session.flash = T('your record has been logged') redirect(URL(list)) Am Donnerstag, 7. Februar 2013 14:07:46 UTC+1 schrieb Michael Haas: Hello all, I'm writing a web app where people can log their exercise sessions. Basically, sessions are timed, and the faster the better. To this end, I store seconds in my model: Field('f_record_taken', type='date',notnull=True,default=datetime.date .today(), label=T('Record Taken')), Field('f_user', type='reference auth_user',notnull=True, label=T('User')), Field('f_exercise', type='reference t_exercise_description',notnull= True, label=T('Exercise')), ### either repetitions, time or weight Field('f_measure', type='double',notnull=True, label=T('Measurement')), Field('f_comment', type='string',label=T(Comment)), I use SQLForm to let users insert new entries: form = SQLFORM(db.t_exercise_log, fields = [f_record_taken, f_measure , f_comment] Obviously, this will render the f_measure field as a single form entry - but users do not want to enter seconds because it requires them to do the math from minutes to seconds. I could theoretically use a time field instead, but I use the f_measure field for other types of exercise as well (think weight lifted in kilos). How would you go about doing this? I assume I could use SQLForm.Factory, but then I might have to validate the form by hand (?). So I'm wondering what would be the best, most web2py-ish solution here, e.g. by modifying some kind of representation logic in the model. Kind regards, Michael -- --- 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: One database field, two form fields? From seconds to min:sec
I accidentally hit sent while still editing the code formatting. Oh well, it should be obvious how it works. I still feel a custom widget with a validator doing the value calculation would be nicer, but I'm not sure if that's possible. Kind regards, Michael -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: SQLite tables not recognised in web2py; even when web2py created them?
Mmm, suppose I could do things like that… But it is rather annoying that web2py has no built-in reverse-engineering (intropspection) that can impose a web2py overlay atop an existing database… On Sat, Feb 9, 2013 at 7:04 PM, Bruno Rocha rochacbr...@gmail.com wrote: If your contrib needs to have its own models and controllers, then you should create it as a plugin. Or you can create a module and define an API for it, take a dummy example. /modules/myawesomemodule.py class MyAwesomeClass(object): it creates the Awesome object which is a login_method to use include in your models db = DAL() from myawesomemodule import MyAwesomeClass something = MyAwesomeClass(db) something.define_tables() auth.settings.login_methods = something def __init__(db, *args, **kwargs): self.db = db def define_tables(self, migrate=True): self.table1 = self.db.define_table(table1, Field(a_field), migrate=migrate ) self.table2 = self.db.define_table(table2, Field(a_field), migrate=migrate ) def do_something(self): self.data = self.db(.).select() # do domething return data Then in following your documentation developers should use you module api as: models/db.py db = DAL(.) from myawesomemodule import MyAwesomeClass something = MyAwesomeClass(db) something.define_tables() auth.settings.login_methods = something On Sat, Feb 9, 2013 at 5:34 AM, Alec Taylor alec.tayl...@gmail.com wrote: But I am creating a contrib for: https://github.com/web2py/web2py/tree/master/gluon/contrib/login_methods (OAuth2; my work-in-progress is on Github) But because of the design of the standard I require 3 additional tables + a user table. So how do you propose I manage this scenario? On Sat, Feb 9, 2013 at 6:26 PM, Bruno Rocha rochacbr...@gmail.com wrote: Usually you create a script file in /models/db.py then you define your tables there, so when starting in shell mode you pass -M python web2py.py -S yourapp -M -M run the models/* files and defines your table as object for you to access. Every framework works in this way. Optionally, you can use db.executesql(PUT YOUR SQL HERE) and do it by your own... On Sat, Feb 9, 2013 at 4:13 AM, Alec Taylor alec.tayl...@gmail.com wrote: Hold up; you mean to tell me I need to redefine the schema each time a new db (DAL object) needs to access it? That sounds silly. Isn't there a way around this? On Saturday, February 9, 2013 4:40:28 PM UTC+11, Vasile Ermicioi wrote: let say you have table1 and table2 in database, you shoud define your tables db.define_table('table1', ..) and only after that you will have access to db.table1 you can;t access db.table2 if it is not defined even if it exists in the database -- --- 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. -- --- 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. -- --- 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. -- --- 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. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: SQLite tables not recognised in web2py; even when web2py created them?
But it is rather annoying that web2py has no built-in reverse-engineering (intropspection) that can impose a web2py overlay atop an existing database there are some scripts to generate models from database, web2py/scripts/extract_mysql_models.py web2py/scripts/extract_pgsql_models.py web2py/scripts/extract_sqlite_models.py perhaps you can build your own reverse engineering tool :) -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: web2py admin2 is DEAD?
Yesterday I was using admin to fine tune dozens of records and It was very tedious with admin just to delete records. +1 for admin2 C'mon guys, django has it for a long time! Small details are also important! Em sexta-feira, 8 de fevereiro de 2013, rif escreveu: I'd love to work on it again :) vineri, 8 februarie 2013, 22:05:41 UTC+2, rif a scris: At the time when it was announced there were not many feature suggestions. However if many users find it useful we will find a better place for it. -rif vineri, 8 februarie 2013, 20:34:00 UTC+2, Ramos a scris: Also why is this not the default admin? 2013/2/8 António Ramos ramst...@gmail.com Why isn't this refered in web2py.com 2013/2/8 Bruno Rocha rocha...@gmail.com Use this one = https://github.com/rif/**web2adminhttps://github.com/rif/web2admin -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out . -- --- 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 javascript:_e({}, 'cvml', 'web2py%2bunsubscr...@googlegroups.com');. For more options, visit https://groups.google.com/groups/opt_out. -- --- 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] Cannot label id field
Hi, Let's see the definition: db.define_table('t_bsc', Field('id', type='integer', label=T('Service Code')), Field('f_name', type='string', label=T('Service name'), comment=T('The name of the customer facing service as known to your customer.')), But in my smartgrid, I still see the label Id instead of 'Service Code' for the id field... Is this a bug? -- --- 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 can I disable the delete confirmation in SQLFORM.grid ?
Ok, so it's not included in the grid options. changing it in web2py.js would disable the confirmation globally, that's a bit dangerous for other tables. I would prefer to do it only for 1 particular table. Or maybe creating a web2py_noconfirm.js included in a layout_noconfirm.html ? -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: Book app
Thank you. Kenneth https://github.com/mdipierro/web2py-book On Friday, 8 February 2013 23:51:57 UTC-6, Kenneth wrote: Hello, is the web2py online book app available as an appliance? I'd like to take a look for example on the database setup. Kenneth -- --- 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. -- --- 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: Unique Constraint not working for : Field(type='upload', unique=True)
Hi, I got a quite similar result by working on the validation at the form level: if form1.process().accepted: session.flash = 'File uploaded' redirect(URL('check_xls_file', args=form1.vars.id, user_signature= True)) elif form1.errors: response.flash = 'File rejected' And in the check_xls_file function: # Check that a file with the same name has not been already posted. t = db.t_xlsfile xlsfilename = t.f_xlsfile.retrieve(t_xlsfile_row.f_xlsfile)[0] if xlsfilename in [t.f_xlsfile.retrieve(row.f_xlsfile)[0] for row in db( t.id t_xlsfile_row.id).select(t.f_xlsfile)]: session.flash = T('Sorry, you already posted a file with that name : %s' % (xlsfilename,)) db.rollback() redirect(URL('index')) -- --- 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: negative ID values in the ID field break use of format in SQLFORM.grid
Thanks Massimo, that works. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: SQLite tables not recognised in web2py; even when web2py created them?
wait a second . you may be missing an important bit. DAL has no introspection whatsoever for retrieving existing tables if you have not defined them. That doesn't mean that you have to define tables at every connection (it's easy, but let's assume you don't want to). When you define tables on an empty database, some .table files are created in the databases/ folder . They are pickles of the table structure, the same one DAL uses to compare with the existing model and - optionally - do a migration. Once you have those .table files, you can skip the define_table() statements giving auto_import=True to the DAL connection (obviously the database uri has to be the same one with the tables in it). The only thing you may need is to pass along the folder where the .table files are with the folder parameter . PS: an oauth2 implementation has been achieved by michele, it's a few days away to be included in the web2py source . https://github.com/web2py/web2py/pull/57 -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: SQLite tables not recognised in web2py; even when web2py created them?
On Sat, Feb 9, 2013 at 11:53 PM, Niphlod niph...@gmail.com wrote: wait a second . you may be missing an important bit. DAL has no introspection whatsoever for retrieving existing tables if you have not defined them. That doesn't mean that you have to define tables at every connection (it's easy, but let's assume you don't want to). When you define tables on an empty database, some .table files are created in the databases/ folder . They are pickles of the table structure, the same one DAL uses to compare with the existing model and - optionally - do a migration. Once you have those .table files, you can skip the define_table() statements giving auto_import=True to the DAL connection (obviously the database uri has to be the same one with the tables in it). The only thing you may need is to pass along the folder where the .table files are with the folder parameter . PS: an oauth2 implementation has been achieved by michele, it's a few days away to be included in the web2py source . https://github.com/web2py/web2py/pull/57 Wait, what, seriously?! :( I can't see that pull request ATM (github is under maintenance), but I did post an announcement here on the web2py list over 8 days ago… Might've been nicer to tell me then. Anyway, I have around 30 custom exceptions built on the gluon.http.HTTP class, so will review the patch once github is back online and see what I can integrate… I guess -- --- 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 can I disable the delete confirmation in SQLFORM.grid ?
Do you want to disable the confirm message when clicking the Delete buttons on the grid itself? In that case, the confirmation is not controlled by the code in web2py.js. For those buttons, there is an onclick handler defined in the button element itself. We should probably include an option to remove the confirmation from that handler. Anthony On Saturday, February 9, 2013 6:18:28 AM UTC-5, François Delpierre wrote: Ok, so it's not included in the grid options. changing it in web2py.js would disable the confirmation globally, that's a bit dangerous for other tables. I would prefer to do it only for 1 particular table. Or maybe creating a web2py_noconfirm.js included in a layout_noconfirm.html ? -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: SQLite tables not recognised in web2py; even when web2py created them?
Okay, GitHub maintenance has ended. That pull-request isn't for a server; it's for a consumer. I'm building—and have just about finished—an OAuth2 server (provider) for web2py. To put it simply: We currently consume Facebook to grab facebook user details and whatnot With my package we will be able to expose our data for other people to consume; in the same way other people consume Facebook. Anyway, it's very close to completion. Have a handful of [found] bugs left. Also fixed that db problem with a rather elegant decorator; but it's still nowhere near how I'd like it to be. On Sun, Feb 10, 2013 at 12:42 AM, Alec Taylor alec.tayl...@gmail.com wrote: On Sat, Feb 9, 2013 at 11:53 PM, Niphlod niph...@gmail.com wrote: wait a second . you may be missing an important bit. DAL has no introspection whatsoever for retrieving existing tables if you have not defined them. That doesn't mean that you have to define tables at every connection (it's easy, but let's assume you don't want to). When you define tables on an empty database, some .table files are created in the databases/ folder . They are pickles of the table structure, the same one DAL uses to compare with the existing model and - optionally - do a migration. Once you have those .table files, you can skip the define_table() statements giving auto_import=True to the DAL connection (obviously the database uri has to be the same one with the tables in it). The only thing you may need is to pass along the folder where the .table files are with the folder parameter . PS: an oauth2 implementation has been achieved by michele, it's a few days away to be included in the web2py source . https://github.com/web2py/web2py/pull/57 Wait, what, seriously?! :( I can't see that pull request ATM (github is under maintenance), but I did post an announcement here on the web2py list over 8 days ago… Might've been nicer to tell me then. Anyway, I have around 30 custom exceptions built on the gluon.http.HTTP class, so will review the patch once github is back online and see what I can integrate… I guess -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] db.executesql(..., as_dict=True) seem buggy
I use postgres with psycopg2, never try with other version, it a new I had developped where I was needing to do that. Richard On Fri, Feb 8, 2013 at 5:30 PM, Brian M bmere...@gmail.com wrote: What database are you using? Did it work prior to web2py 2.3.2? The dict keys (field names) are retrieved from the cursor.description provided by the database driver so I suppose it is possible that your driver is changing the case - web2py shouldn't be affecting the case though. I use executesql (MSSQL SQLite) a lot and haven't had any issues with a lack of capitalization. ~Brian On Friday, February 8, 2013 2:05:51 PM UTC-6, Richard wrote: Hello, Consider this : db.executesql(SELECT field1 AS Field1 FROM table1, as_dict = True) Where field1 have been capitalize (AS Field1)... But the dicts keys are all small cap... At least under web2py 2.3.2 Richard -- --- 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. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] db.executesql(..., as_dict=True) seem buggy
Ok, was coming from postgres, I have to double quote it in order to get postgres respect upper cases. With : SELECT field AS Field FROM ... Postgres return field With SELECT field AS Field FROM ... Postgres return Field May be it is my SQL that was bad at the start, standard SQL may required double quotes for AS... Thanks Richard On Sat, Feb 9, 2013 at 11:55 AM, Richard Vézina ml.richard.vez...@gmail.com wrote: I use postgres with psycopg2, never try with other version, it a new I had developped where I was needing to do that. Richard On Fri, Feb 8, 2013 at 5:30 PM, Brian M bmere...@gmail.com wrote: What database are you using? Did it work prior to web2py 2.3.2? The dict keys (field names) are retrieved from the cursor.description provided by the database driver so I suppose it is possible that your driver is changing the case - web2py shouldn't be affecting the case though. I use executesql (MSSQL SQLite) a lot and haven't had any issues with a lack of capitalization. ~Brian On Friday, February 8, 2013 2:05:51 PM UTC-6, Richard wrote: Hello, Consider this : db.executesql(SELECT field1 AS Field1 FROM table1, as_dict = True) Where field1 have been capitalize (AS Field1)... But the dicts keys are all small cap... At least under web2py 2.3.2 Richard -- --- 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. -- --- 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: Integrating iPhone device tokens into web2py auth
well what we are using is a hybrid model: - the ios device uses a modified form of OAuth to get access tokens (and we have the confusing problem of users start anonymous but with an access token, and then may later create an account associating an email and other user data with the account) - the website uses web2py's auth to login those same users - the APNS token (Apple Push Notification Service) is provided optionally by the user if they opt-in to push notifications. as such it's not a primary key for the user and can't be used for authentication. if the user chooses to share it with us we store that in a field on our user table. Note that the APNS token is device specific, so if the user has multiple devices then they might have multiple tokens. does that clarify at all? cfh On Friday, February 8, 2013 9:46:42 PM UTC-8, Massimo Di Pierro wrote: I do not know how this works. Can you give us more details? On Friday, 8 February 2013 20:31:14 UTC-6, howesc wrote: i have millions of APNS tokens! i'd share, but they are tied to an app i did not tie APNS tokesn to web2py auth, but i added fields to my end user table, and the device uses my REST JSON API to POST the APNS tokens to the server and update the user. we don't use the APNS token as any sort of user identifier. does that help? lemme know if you are interested in more details. christian On Thursday, February 7, 2013 5:22:28 PM UTC-8, chris_g wrote: I'm looking into supporting Apple push notifications in an iPhone app that connects to a web2py server. In order to know which devices to push details to, web2py's auth module would presumably need to maintain Device Tokens. I'm curious if anyone has implemented a solution that takes care of this. I'd like to see how it was integrated with web2py's auth. Thanks, Chris -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Star Rating
Hello rochacbruno, I loaded this application on two different machines/environments, and the information in the form is not being saved to the database song table. I tried this as both a logged in user, and not logged in user. I began to trouble shoot, and modified the form from: def index(): form = SQLFORM(db.song) return dict(form = form) to the following: def index(): form = SQLFORM(db.song) 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) It looks like the star rating value is not being sent from the form unfortunately because I get 'form has errors', 'value not allowed'. Any ideas? Best, Michael Gheith On Friday, February 8, 2013 5:33:24 PM UTC-6, rochacbruno wrote: https://github.com/mdipierro/web2py-recipes-source/blob/master/apps/04_advanced_forms/web2py.app.star_rating.w2p?raw=true On Fri, Feb 8, 2013 at 8:52 PM, Michael Gheith ghei...@aol.comjavascript: wrote: Hello web2py community :) I'm trying to implement a simple star rating for my site. I followed the steps in the web2py Application Development Cookbook, but it is not working unfortunately; I select 2 stars for example, but it's not being saved to the database. I have taken a look at the star rating widget in plugin_wiki, and could not get that to work either! Can any of you provide me with a .w2p of something that works? Hope to hear from any of you soon, thanks in advance! Michael Joseph Gheith -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- --- 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: Star Rating
I printed the request.vars to the console, and this is what I got after form submission: Storage {'_formkey': '7c32617c-2136-4d8d-ad54-ea7ae454e551', '_formname': 'song/create', 'title': 'Thriller'} So the star rating is definitely not making its way back to the server. I'm guessing it should look like the following: Storage {'rating': '5', '_formkey': '7c32617c-2136-4d8d-ad54-ea7ae454e551', '_formname': 'song/create', 'title': 'Thriller'} Please help :) Thanks, Michael Gheith On Friday, February 8, 2013 4:52:19 PM UTC-6, Michael Gheith wrote: Hello web2py community :) I'm trying to implement a simple star rating for my site. I followed the steps in the web2py Application Development Cookbook, but it is not working unfortunately; I select 2 stars for example, but it's not being saved to the database. I have taken a look at the star rating widget in plugin_wiki, and could not get that to work either! Can any of you provide me with a .w2p of something that works? Hope to hear from any of you soon, thanks in advance! Michael Joseph Gheith -- --- 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: serving php and python in shared hosting
Please! Nobody can help me? I'm desperate to solve this problem. How can web2py work together con php apps? (in this case joomla). -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: Integrating iPhone device tokens into web2py auth
Howesc, Thanks for great info. So, does mobile app user have to register web2py via access token provided by their hardware in mobile application? May you explain how you built the login/registration module for mobile app users along with web2py? Do you code in html5 with native code for developing your mobile app? Sorry for asking more than one question, this topic sounds so interesting! :) Thank you! On Feb 9, 2013 11:45 AM, howesc how...@umich.edu wrote: well what we are using is a hybrid model: - the ios device uses a modified form of OAuth to get access tokens (and we have the confusing problem of users start anonymous but with an access token, and then may later create an account associating an email and other user data with the account) - the website uses web2py's auth to login those same users - the APNS token (Apple Push Notification Service) is provided optionally by the user if they opt-in to push notifications. as such it's not a primary key for the user and can't be used for authentication. if the user chooses to share it with us we store that in a field on our user table. Note that the APNS token is device specific, so if the user has multiple devices then they might have multiple tokens. does that clarify at all? cfh On Friday, February 8, 2013 9:46:42 PM UTC-8, Massimo Di Pierro wrote: I do not know how this works. Can you give us more details? On Friday, 8 February 2013 20:31:14 UTC-6, howesc wrote: i have millions of APNS tokens! i'd share, but they are tied to an app i did not tie APNS tokesn to web2py auth, but i added fields to my end user table, and the device uses my REST JSON API to POST the APNS tokens to the server and update the user. we don't use the APNS token as any sort of user identifier. does that help? lemme know if you are interested in more details. christian On Thursday, February 7, 2013 5:22:28 PM UTC-8, chris_g wrote: I'm looking into supporting Apple push notifications in an iPhone app that connects to a web2py server. In order to know which devices to push details to, web2py's auth module would presumably need to maintain Device Tokens. I'm curious if anyone has implemented a solution that takes care of this. I'd like to see how it was integrated with web2py's auth. Thanks, Chris -- --- 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. -- --- 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 on amazon EC2
Amazon EC2 is a web server, highly scalable and secure. recommend This installation is easy, is a pre configured server that runs with web2py https://aws.amazon.com/marketplace/pp/B009I68K0E/ref=srh_res_product_title?ie=UTF8sr=0-2qid=1360439635824 -- --- 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: serving php and python in shared hosting
yes i suspect it would be an apache configuration. you want to use python connector for www/web2py and php connector for www/joomla. unfortunately i have not configured apache in years and don't know the exact answer. :( sorry i'm not more help. cfh On Saturday, February 9, 2013 11:24:26 AM UTC-8, José Eloy wrote: Please! Nobody can help me? I'm desperate to solve this problem. How can web2py work together con php apps? (in this case joomla). -- --- 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: GAE deployment questions...from a total beginner!
feel free to ask more questions as you learning things! cfh On Friday, February 8, 2013 2:54:46 PM UTC-8, Riccardo C wrote: Thanks a lot for all these informations. It seems I have a lot to learn ;) On Wednesday, 6 February 2013 20:54:21 UTC, howesc wrote: Riccardo, some answers: - i backup the source code of my app by using HG or GIT. - google offers data backup via google cloud storage. you can see options for this in the google app engine web admin console - yes it is possible to download GAE data. you'll have to download database data into a CSV file and then do an import into your other system. google has instructions for bulk export/import of data. - if you use the GAE blobstore for large images, copying all that data out is a little harder, but is doable. i've done it for small projects. - yes, to change any code you have to re-deploy your app to GAE. using the GAE SDK you can view changes locally in real time (no reload required). this kind of thing is good development practice in general (having a test environment and a production environment) - yes you can do queries like the one you mention above. there are restrictions for more complex queries. you can read the google docs for this. (or post most specific questions when you hit a roadblock) - no the web2py web admin interface is not available. logs are provided buy the GAE web console. For what it's worth, i love GAE. i'm running several apps, one of them gets over 2.5 million HTTP requests a day and works really well. there is some differences between GAE and traditional hosting, but once you learn the rules it's a fun playground to play on. good luck! christian On Tuesday, February 5, 2013 6:17:28 AM UTC-8, Riccardo C wrote: Hi All, As in the title I'm an absolute beginner... now I'd like to see my app online. Probably it would be more correct to say that I would learn to deploy for choosing then the hosting for my app. I think that using Gae would be the best solution (for a beginner) but I was not able to find an answer to these questions (I apologise if some of them might seem trivial to you): - I read that I will not have access to the file system. How to do a backup of the app? - let say that I want to test the image gallery example and after a couple of day I want to download all the photos uploaded... would it be possible? what is possible to do? - Would it be easy to move in the future the web app to another hosting service without loosing (db data and static file)? - I would to change a single view file... what should I do? reload all the app? - From the web2py doc No complex datastore queries. In particular there are no JOIN, LIKE, and DATE/DATETIME operators. - would I still be able to ask the database, for example, tell me all the post in the database BEFORE Jan 2010? - Would I have the admin web interface available? - based on the previous questions, do you suggest to use/evaluate another hosting? which one? Thanks for your help and patienceplease if there is already an answer to those questions (and I was not able to find it in the forum) please just point me to those existing thread. Riccardo -- --- 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: serving php and python in shared hosting
lo que puedo entender es que quieres correr web2py y php en el mismo servidor, pero solo funcionaria si corres por ejemplo web2py en el puerto 80 y php en otro puerto ejjemplo 8000 El lunes, 4 de febrero de 2013 19:54:22 UTC-5, José Eloy escribió: Hello everybody! I got to install web2py in Hostgator following this instructions: https://groups.google.com/forum/?fromgroups=#!topic/web2py/h8uLiDCerx0 The website made with web2py works very well (http://www.transicion.mx). But I have to serve also php pages (especifically a joomla site). The joomla instalation is in /www/joomla. In the root of /www I have the web2py directory and I use these files (also in /www): *dispatch.fcgi*: #!/usr/bin/python import sys from flup.server.fcgi_fork import WSGIServer import gluon.main application=gluon.main.wsgibase ## or # application=gluon.main.wsgibase_with_logging WSGIServer(application).run() *and* *.htaccess:* AddHandler fcgid-script .fcgi Options +FollowSymLinks +ExecCGI RewriteEngine On RewriteBase / RewriteRule ^dispatch\.fcgi/ - [L] RewriteRule ^(.*)$ dispatch.fcgi/$1 [L] How Can I to serve php files in my site? Thanks for the help -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: Integrating iPhone device tokens into web2py auth
- Apple explicitly does not allow using the hardware identifier in your app, and will reject app submission that do that. because of this each app install logs in first as an anonymous user. - website users use standard web2py auth - app connections to the server use our modified OAuth API implementation. this forgoes web2py auth, but reads and writes to the same user table that web2py auth uses. this allows the 2 different systems to connect. - the mobile apps are native code on their respective platforms, the website is html. unfortunately our modified OAuth implementation is pretty specific to our needs and so i don't think it's a candidate for us to open source. i'll take a look into what we are doing though to see if any of it can/should be open sourced. cfh On Saturday, February 9, 2013 11:40:50 AM UTC-8, Kenny wrote: Howesc, Thanks for great info. So, does mobile app user have to register web2py via access token provided by their hardware in mobile application? May you explain how you built the login/registration module for mobile app users along with web2py? Do you code in html5 with native code for developing your mobile app? Sorry for asking more than one question, this topic sounds so interesting! :) Thank you! On Feb 9, 2013 11:45 AM, howesc how...@umich.edu javascript: wrote: well what we are using is a hybrid model: - the ios device uses a modified form of OAuth to get access tokens (and we have the confusing problem of users start anonymous but with an access token, and then may later create an account associating an email and other user data with the account) - the website uses web2py's auth to login those same users - the APNS token (Apple Push Notification Service) is provided optionally by the user if they opt-in to push notifications. as such it's not a primary key for the user and can't be used for authentication. if the user chooses to share it with us we store that in a field on our user table. Note that the APNS token is device specific, so if the user has multiple devices then they might have multiple tokens. does that clarify at all? cfh On Friday, February 8, 2013 9:46:42 PM UTC-8, Massimo Di Pierro wrote: I do not know how this works. Can you give us more details? On Friday, 8 February 2013 20:31:14 UTC-6, howesc wrote: i have millions of APNS tokens! i'd share, but they are tied to an app i did not tie APNS tokesn to web2py auth, but i added fields to my end user table, and the device uses my REST JSON API to POST the APNS tokens to the server and update the user. we don't use the APNS token as any sort of user identifier. does that help? lemme know if you are interested in more details. christian On Thursday, February 7, 2013 5:22:28 PM UTC-8, chris_g wrote: I'm looking into supporting Apple push notifications in an iPhone app that connects to a web2py server. In order to know which devices to push details to, web2py's auth module would presumably need to maintain Device Tokens. I'm curious if anyone has implemented a solution that takes care of this. I'd like to see how it was integrated with web2py's auth. Thanks, Chris -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- --- 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] ipython is your friend!
One of the nice things about python modules that are not c-compiled is the fact that you can read the source code. The bad part is that the source code is not always easy to find. This is where ipython comes in. IPython is an alternative to the regular python interpreter which offers a bunch of niceties. This interpreter is supported by web2py out of the box; just install ipython (pip install ipython) and start web2py at the command prompt (python web2py.py -S appname -M). This will load the web2py environment for your application and it's models using the ipython interpreter. I won't go through them all, but rather just a couple that really come in handy for me during web2py development. Let's say you want to see the doc string for SQLFORM: In [2]: form = SQLFORM?return ipython display a scrollable doc string (type 'q' to exit the doc string viewer) Now you want to see the source code of the SQLFORM class: In [3]: form = SQLFORM??return ipython now shows the entire SQLFORM class Let's say you want to just see all of the methods that SQLFORM has to offer: In [5]: SQLFORM.tab SQLFORM.AUTOTYPES SQLFORM.assert_status SQLFORM.grid SQLFORM.search_menu SQLFORM.FIELDKEY_DELETE_RECORDSQLFORM.build_query SQLFORM.hidden_fields SQLFORM.sibling SQLFORM.FIELDNAME_REQUEST_DELETE SQLFORM.confirm SQLFORM.insertSQLFORM.siblings SQLFORM.ID_LABEL_SUFFIX SQLFORM.createform SQLFORM.mro SQLFORM.smartdictform SQLFORM.ID_ROW_SUFFIX SQLFORM.dictform SQLFORM.process SQLFORM.smartgrid SQLFORM.REDIRECT_JS SQLFORM.element SQLFORM.regex_attrSQLFORM.tag SQLFORM.accepts SQLFORM.elements SQLFORM.regex_class SQLFORM.update SQLFORM.add_buttonSQLFORM.factory SQLFORM.regex_id SQLFORM.validate SQLFORM.add_class SQLFORM.flatten SQLFORM.regex_tag SQLFORM.widgets SQLFORM.appendSQLFORM.formstyles SQLFORM.remove_class SQLFORM.xml Finally, if you want to dig into any of those methods, like smartgrid: In [6]: SQLFORM.smartgrid?return or In [7]: SQLFORM.smartgrid??return and since the SQLFORM code is well documented and the argument names are descriptive, you should be able to figure out more problems on your own. This is just a taste of what you can do with ipython. It can also display more detailed traceback messages, run os-level commands without exiting the interpreter, debug code, etc. I hope this helps a bit! Jim -- --- 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.