[web2py] Use of scheduler in place of cron
I have a function that I want to run every 30 minutes. I would ordinarily expect to use cron but see that the Web2py book encourages using the scheduler. But after reviewing the docs several times, I have no idea how to make this work. Thanks for any help. -- 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] Need to have def 4() and def dir() to 301 redirect. Is it possible?
I would like to redirect these two links: www.mydomain.com/4 and www.mydomain.com/dir for fixing backlinks I previously had for SEO purpose. I've tried to redirect from the controller but it didn't work. -- def 4(): redirect('/',301) def dir(): redirect('/',301) -- Obviously this is not possible since dir is a reserved keyword and 4 is integer. Anyway to redirect these two? Thank you. -- 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] autocomplete depending on other form field
I've got this form: form = SQLFORM.factory( Field('tag', length=128, requires=[IS_IN_DB(db, 'tag.name', '%(name)s', error_message='Tag not in database')]), Field('locality', length=64, requires=[IS_IN_DB(db, 'locality.name', '%(name)s', error_message='Locality not in database')]), hideerror=True, separator='', formstyle=bootstrap3) Fields tag and locality are autocomplete fields based on jQueryUI. In the view I've got: script type=text/javascript $(function() {$(#no_table_tag).autocomplete({source: {{=URL('jqueryui', 'nodetag_autocomplete')}},minLength: 2});}); $(function() {$(#no_table_locality).autocomplete({source: {{=URL('jqueryui', 'addresslocality_autocomplete')}},minLength: 2});}); /script And in a controller called jqueryui: def addresslocality_autocomplete(): rows = db(db.address.locality.like(request.vars.term+'%')).select(db.address.locality, distinct=True, orderby=db.address.locality).as_list() result = [r['locality'] for r in rows] return response.json(result) def nodetag_autocomplete(): rows = db(db.node_tag.tag.like(request.vars.term+'%')).select(db.node_tag.tag, distinct=True, orderby=db.node_tag.tag).as_list() result = [r['tag'] for r in rows] return response.json(result) What I want is, make the autocomplete options for field locality depend on the value of field tag. Coded with the constant tag 'Personal coaching', something like In the view: $(function() { $(#no_table_locality).autocomplete({source: {{=URL('jqueryui', 'addresslocality_autocomplete')}} + '/' + 'Personal coaching' , minLength: 2}) ;}); In the jqueryui controller: rows = db((db.node_tag.tag=='Personal coaching') (db.node_tag.nodeID==db.address.nodeID) (db.address.locality.like(request.vars.term+'%'))).select(db.address.locality, distinct=True, orderby=db.address.locality).as_list() In the view I tried: var x = document.getElementById(no_table_tag).value; and replace '/' + 'Personal coaching' with '/' + x but that doesn't work. In the jqueryui controller this doesn't work either: (db.node_tag.tag==request.args(0)) Is there a way to solve this issue or is it just not possible. Regards, Annet -- 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: web2py and self-submission/postbacks - a newcomer asks
Anthony abastardi@... writes: It would probably help if you show some code, or at least explain in more detail an example where self submission is not possible or overly difficult. Note, your code can always distinguish between a form creation request and a form submission request by checking whether request.post_vars is None or whether request.env.http_method == POST. As Jim suggested, if you are using SQLFORM, the easiest way to pre-populate is by setting field default values before form creation.Anthony Well, I cannot show any code - because I haven't written any real stuff yet - and I cannot give an example of where self-submission could not work because I haven't gotten to that point, yet (if at all). As I said I'm just investigating but self-submission is one aspect of web2py that did stand out to my superficial run through its features. My experience in web-type applications is of the 'single purpose code' type: one method assembles the data for the web page, from a database or some default values etc., and then 'returns' it to the web client; then an entirely separate method is the target for the subsequent HTML form submission, it receives the data and creates the necessary data structure (object or whatever) and populates it from the data on the POST, stores it in the DB etc. This has a complete separation of functions. And to some extent it is this lack of a clean separation that I find a problem in the self-submission case, perhaps more philosophically than practically, I'll agree. But to return to the example I gave: I did quote from the book: It is always possible to pre-populate a form using the syntax: form.vars.name = 'fieldvalue' Statements like the one above must be inserted after the form declaration and before the form is accepted, whether or not the field (name in the example) is explicitly visualized in the form. but are you suggesting that it is better to populate the db.tablename object's defaults before the 'form=SQLFORM(...' statement ? And I did suspect that there was some indicator used within the FORM object - you mention request.post_vars being None, so if there were any complex code to establish the pre-population values I should enclose that in a condition like: if request.post_vars == None: # # put pre-population data acquisition here # including calls to other methods - if lengthy code # form = SQLFORM(... Sorry to go on so... Graham -- 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] Raw include to solve Handlebars problem
I wanted to use Ember.js and the Handlebars are clashing with web2py's delimiters. There are many solutions to this problems. This is another one: class RAW_INCLUDE(XML): {{=RAW_INCLUDE('views/default/hbs/blah.hbs')}} def __init__(self, filename): self.filename = filename def xml(self): import os.path filepath = os.path.join(request.folder, self.filename) fp = open(filepath, 'rb') data = fp.read() fp.close() return data def __str__(self): return self.xml() -- 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.
Re: [web2py] Re: web2py and self-submission/postbacks - a newcomer asks
Yes, you set the defaults for the table before the form=SQLFORM(...) statement. All you are doing is setting a default, you are not 'prepopulating' data. Also, since web2py loads it's db.py on every request, the defaults you set in one request do not have an effect on subsequent requests. Also note what Anthony said earlier, you don't have to use the self-submission paradigm. You can force it to move to a different page on submission. -Jim On Tue, Jun 24, 2014 at 6:09 AM, Graham Ranson g73...@gishpuppy.com wrote: Anthony abastardi@... writes: It would probably help if you show some code, or at least explain in more detail an example where self submission is not possible or overly difficult. Note, your code can always distinguish between a form creation request and a form submission request by checking whether request.post_vars is None or whether request.env.http_method == POST. As Jim suggested, if you are using SQLFORM, the easiest way to pre-populate is by setting field default values before form creation.Anthony Well, I cannot show any code - because I haven't written any real stuff yet - and I cannot give an example of where self-submission could not work because I haven't gotten to that point, yet (if at all). As I said I'm just investigating but self-submission is one aspect of web2py that did stand out to my superficial run through its features. My experience in web-type applications is of the 'single purpose code' type: one method assembles the data for the web page, from a database or some default values etc., and then 'returns' it to the web client; then an entirely separate method is the target for the subsequent HTML form submission, it receives the data and creates the necessary data structure (object or whatever) and populates it from the data on the POST, stores it in the DB etc. This has a complete separation of functions. And to some extent it is this lack of a clean separation that I find a problem in the self-submission case, perhaps more philosophically than practically, I'll agree. But to return to the example I gave: I did quote from the book: It is always possible to pre-populate a form using the syntax: form.vars.name = 'fieldvalue' Statements like the one above must be inserted after the form declaration and before the form is accepted, whether or not the field (name in the example) is explicitly visualized in the form. but are you suggesting that it is better to populate the db.tablename object's defaults before the 'form=SQLFORM(...' statement ? And I did suspect that there was some indicator used within the FORM object - you mention request.post_vars being None, so if there were any complex code to establish the pre-population values I should enclose that in a condition like: if request.post_vars == None: # # put pre-population data acquisition here # including calls to other methods - if lengthy code # form = SQLFORM(... Sorry to go on so... Graham -- 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 a topic in the Google Groups web2py-users group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/wbei89YDwL0/unsubscribe. To unsubscribe from this group and all its topics, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- 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: web2py and self-submission/postbacks - a newcomer asks
My experience in web-type applications is of the 'single purpose code' type: one method assembles the data for the web page, from a database or some default values etc., and then 'returns' it to the web client; then an entirely separate method is the target for the subsequent HTML form submission, it receives the data and creates the necessary data structure (object or whatever) and populates it from the data on the POST, stores it in the DB etc. This has a complete separation of functions. And to some extent it is this lack of a clean separation that I find a problem in the self-submission case, perhaps more philosophically than practically, I'll agree. First, note that having the same action handle both form creation and form processing does not imply a lack of separation. You can still have different code paths and even entirely separate functions that handle different parts of the process, even if the same URL handles both cases. Second, as already mentioned, there is some common code used for creation and processing, so self-submission helps to reduce code duplication as well as the use of redirects if you need to display validation errors or re-load a new blank form after a successful submission. Third, nothing is forcing you to use the self-submission pattern if you really don't like it. For example, see http://web2py.com/books/default/chapter/29/07/forms-and-validators#Sharing-forms. but are you suggesting that it is better to populate the db.tablename object's defaults before the 'form=SQLFORM(...' statement ? Specifically when using SQLFORM (which pre-populates fields based on the db.tablename field default values). if request.post_vars == None: # # put pre-population data acquisition here # including calls to other methods - if lengthy code # form = SQLFORM(... Yes, something along those lines. Anthony -- 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: autocomplete depending on other form field
I use this javascript for my autocompletes... script type=text/javascript $(document).ready(function() { $( #no_table_requestor ).autocomplete({ source: {{=URL('contacts','autocomplete')}}, select: function(event, ui) { $( #no_table_requestor_id ).val(ui.item.id); $( #no_table_requestor ).val(ui.item.label); return false; } }); /script The SQLFORM.factory looks like this: # define the fields fields = [] fields.append(Field('requestor', requires=IS_NOT_EMPTY())) fields.append(Field('requestor_id','int')) # create the form form = SQLFORM.factory(*fields) form.element(_name='requestor').update(_class='form-control', _placeholder='Requested by') form.element(_name='requestor_id').update(_class='hidden') if form.process(onvalidation=price_quote_validation).accepted: quote = form.vars ...and the lookup code... @auth.requires_login() def autocomplete(): terms = request.vars.term queries = [db.contact.id 0] if terms and terms != '': queries.append((db.contact.first_name.contains(terms)) | (db.contact.last_name.contains(terms)) | (db.contact.company.contains(terms))) query = reduce(lambda a,b:(ab),queries) contacts = [] for contact in db(query).select(orderby=[db.contact.company, db.contact.last_name, db.contact.first_name]): if contact.company and contact.company != '': if contact.last_name and contact.last_name != '' and contact.first_name and contact.first_name != '': contacts.append({'label':'%s %s - %s' % (contact.first_name, contact.last_name, contact.company), 'id':contact.id}) else: contacts.append({'label':contact.company, 'id':contact.id}) else: contacts.append({'label':'%s %s' % (contact.first_name, contact.last_name), 'id':contact.id}) return response.json(contacts) Hope that helps -Jim On Tuesday, June 24, 2014 4:06:03 AM UTC-5, Annet wrote: I've got this form: form = SQLFORM.factory( Field('tag', length=128, requires=[IS_IN_DB(db, 'tag.name', '%(name)s', error_message='Tag not in database')]), Field('locality', length=64, requires=[IS_IN_DB(db, 'locality.name', '%(name)s', error_message='Locality not in database')]), hideerror=True, separator='', formstyle=bootstrap3) Fields tag and locality are autocomplete fields based on jQueryUI. In the view I've got: script type=text/javascript $(function() {$(#no_table_tag).autocomplete({source: {{=URL('jqueryui', 'nodetag_autocomplete')}},minLength: 2});}); $(function() {$(#no_table_locality).autocomplete({source: {{=URL('jqueryui', 'addresslocality_autocomplete')}},minLength: 2});}); /script And in a controller called jqueryui: def addresslocality_autocomplete(): rows = db(db.address.locality.like(request.vars.term+'%')).select(db.address.locality, distinct=True, orderby=db.address.locality).as_list() result = [r['locality'] for r in rows] return response.json(result) def nodetag_autocomplete(): rows = db(db.node_tag.tag.like(request.vars.term+'%')).select(db.node_tag.tag, distinct=True, orderby=db.node_tag.tag).as_list() result = [r['tag'] for r in rows] return response.json(result) What I want is, make the autocomplete options for field locality depend on the value of field tag. Coded with the constant tag 'Personal coaching', something like In the view: $(function() { $(#no_table_locality).autocomplete({source: {{=URL('jqueryui', 'addresslocality_autocomplete')}} + '/' + 'Personal coaching' , minLength: 2}) ;}); In the jqueryui controller: rows = db((db.node_tag.tag=='Personal coaching') (db.node_tag.nodeID==db.address.nodeID) (db.address.locality.like(request.vars.term+'%'))).select(db.address.locality, distinct=True, orderby=db.address.locality).as_list() In the view I tried: var x = document.getElementById(no_table_tag).value; and replace '/' + 'Personal coaching' with '/' + x but that doesn't work. In the jqueryui controller this doesn't work either: (db.node_tag.tag==request.args(0)) Is there a way to solve this issue or is it just not possible. Regards, Annet -- 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
[web2py] Customizing auth.navbar function
Hi All, I want to customize the auth.navbar function (basically I want to add new option when the user is logged-in and also want to modify the text Register). So, I followed the following approach :- - Created a new function (by using the source code from tools.py) in a separate file in modules. - Imported the new function and replaced auth.navbar CODE :- (There is no modification as of now in customnavbar) # from gluon.tools import Auth, Crud, Service, PluginManager, prettydate from apputils import customnavbar auth = Auth(db) auth.navbar = customnavbar When I load the application, I get the following error :- (In layout, I have used auth.navbar()) type 'exceptions.TypeError' customnavbar() takes at least 1 argument (0 given) Can some one please help. -- 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.
Re: [web2py] Need to have def 4() and def dir() to 301 redirect. Is it possible?
Hello Kenneth, A way is see the 4 and dir as string argument from the url and read this from the index function, then check that string argument, and apply a conditional. This was not tested, but I think that works for you needs: def index(): argument = request.args[0] if argument == '4': #redirect if 4 value redirect('/',301) elif argument == 'dir': #redirect if dir value redirect('/',301) else: pass return dict() 2014-06-24 4:27 GMT-04:30 Kenneth nis...@gmail.com: I would like to redirect these two links: www.mydomain.com/4 and www.mydomain.com/dir for fixing backlinks I previously had for SEO purpose. I've tried to redirect from the controller but it didn't work. -- def 4(): redirect('/',301) def dir(): redirect('/',301) -- Obviously this is not possible since dir is a reserved keyword and 4 is integer. Anyway to redirect these two? Thank you. -- 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. -- 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: web2py password encryption/decryption
THX a lot Massimo, it is very much appreciated. I'll check this ASAP. Be patient please. On Monday, June 23, 2014 11:21:42 AM UTC+2, Massimo Di Pierro wrote: Hello Farmy, The code you posted helps and this examples the PHP algorithm: http://pythonhosted.org/passlib/lib/passlib.hash.phpass.html I recorded this in Python: import random, hashlib class PHPHash(object): CHARS = '0123456789abcdefghijklmoqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' def __init__(self,secret,rounds=10): self.secret = secret self.rounds = rounds def hash(self,password, salt=None): if salt is None: salt = ''.join(random.choice(self.CHARS) for i in range(8)) checksum = hashlib.md5(salt+self.secret).hexdigest() for k in range(2**self.rounds): checksum = hashlib.md5(checksum+password).hexdigest() hashed = '$P$%s%s%s' % (chr(self.rounds+ord('0')-5),salt,checksum) return hashed p = PHPHash('mysecret', rounds=13) print p.hash('mypassword') Please check it an make sure you can reproduce the PHP passwords. Once that's done we can try implement a custom validator, based on CRYPT that will work with them. Massimo On Sunday, 22 June 2014 15:40:32 UTC-5, farmy zdrowia wrote: I did kind of investigation by myself. I can see CB uses new Joomla Portable PHP password hashing framework functionality to crypt password. I noticed CB run on joomla 3.2.1, while my other site is on Joomla 2 Anyway at the end of pasword cryption chain there is a function hashPassword and verifyPassword in libraries/joomla/user/helper.php abstract class JUserHelper public static function hashPassword($password) { // Use PHPass's portable hashes with a cost of 10. $phpass = new PasswordHash(10, true); return $phpass-HashPassword($password); } public static function verifyPassword($password, $hash, $user_id = 0) { $rehash = false; $match = false; // If we are using phpass if (strpos($hash, '$P$') === 0) { // Use PHPass's portable hashes with a cost of 10. $phpass = new PasswordHash(10, true); $match = $phpass-CheckPassword($password, $hash); $rehash = false; } Indeed all my passwords starts with $P$ Whole algorithm to crypt CB/Joomla3.2.1 password is in file libraries/phpass/PasswordHash.php Question now is how to transform it to web2py CUSTOMER validator. I'll need your help -- 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] Best way to ensure uniqueness of two fields?
I have a model that looks somewhat like this db.define_table('topic_teacher', Field('skill', 'list:string', required=True), Field('description', 'text', required=True), Field('topic', 'reference topic'), Field('teacher', 'reference auth_user'), db.topic_teacher.topic.writable = False db.topic_teacher.topic.readable = False db.topic_teacher.teacher.writable = False db.topic_teacher.teacher.readable = False where I need the combination of topic and teacher to be unique so one person can register as a teacher for a certain topic only one time. Skill and description are filled in using SQLFORM and topic and teacher using form.vars.topic = topic_id #(from request.args) form.vars.teacher = teacher_id #(from auth.user.id) My first try was to add a computed field to the table representing a combination of topic and teacher and using unique=True on it which doesn't work. I still can happily insert records containing the same teacher id and topic id using the form and the computed field will happily accept same values in the db. Now before I try doing weird requires= magic with the computed field, is there an established best way to accomplish what I'm trying to do? Thanks in advance. -- 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] Web2py Views: Multiple images changing in the background of index?
Please I need a help, this is the first time I am posting here and I am in my journey to be the Africa's number one Web2py enthusiast. I am currently developing my first web2py application and I have less than a week to complete it and head over to a more complex application by next week. My question to the community is, I want to use two pictures rotating display as my background image in the index. please help me with suggestion on how to go about it. Thank you. NB: Example of a similar situation is the index of twitter(i.e before user logged in) -- 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] Issue deploying web2py even after following tutorial
Hi, I've been struggling the last few days with deploying web2py on an EC2 Ubuntu instance. I describe the steps I took in SO in the link below. http://stackoverflow.com/questions/24371280/unable-to-access-web2py-server-running-in-ec2-instance I feel like it's something simple, and all help would be very much appreciated. Thanks! -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] how to Consume external NetTcp SOAP service in Web2Py
Hi All.. I am new to web2py. Is there a way to call external NetTcp SOAP service in Web2Py. What are the best practices to call such services in Web2Py? -- 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: sqlform.grid add new - populate some fields(with values from another db) based on other fields
Thanks. Noted that, thats the best way and might be the only way On Sunday, 22 June 2014 12:53:51 UTC+3, 黄祥 wrote: sorry, didn't read this sentence I want these to be reflected even before i click 'submit' button if you want to achieve it before click 'submit' button, i think you can achieve it using ajax callback for that. best regards, stifan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Background images slides like twitter?
Please I need somebody to help me on suggestions on how to put background-images in my website's index. just like twitter. Thank you -- 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] Adding scheduler to an existing app break the MySQL DB...
I am fighting it for some time now... I tried all the different ways to migrate the database so that the tables for the scheduler are created, but no luck - maybe someone could help... I have an existing application. Recently I decided I needed to run some things in the background, so I added a scheduler.py model with content like this: def send_mail(jar_id): logger.info('Mail notifications have been sent.') from gluon.scheduler import Scheduler scheduler = Scheduler(db) where db is defined like this in db.py model: db = DAL('mysql://xxx:xxx@localhost/xxx',pool_size=1,check_reserved=['all'], migrate=True,fake_migrate=False) As soon, as I try to schedule a task, this result in an error: gluon.contrib.pymysql.err.ProgrammingError: (1146, uTable 'xxx.scheduler_task' doesn't exist) I tried setting the fake_migrate to True, removing files in xxx/databases, etc. No luck. Any hint, how to make it work? Krzysztof. -- 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] how to use require js with web2py?
how to load script data-main=scripts/main src=scripts/require.js/ script in web2py like in web2py_ajax.html I have response.files.insert(0,URL('static','js/libs/require.js')) then below script require.config({ paths: { 'text': {{=URL('static', 'js/libs/require/text')}}, 'modules': {{=URL('static', 'js/modules')}}, 'templates': {{=URL('static', 'templates')}}, 'jquery': {{=URL('static', 'js/libs/jquery')}}, }, require(['modules/test'], function(test) { test.test(); }); require(['modules/canvas'], function(canvas) { canvas.init(); }); /script it does not work because, a), web2py.js fails to find jQuery. b), paths generated by URL helper seem not compatible with require Any idea? Thanks, Chuan -- 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: Ubuntu 14.04 Setup Script with Apache - Issues?
I'm also experiencing these problems installing on Ubuntu 14.04 as well for the past few days. I've followed all the steps on different tutorials and I still can only get the Apache default page. I was doing this to get a better knowledge of building web apps and I don't have much knowledge of Apache. Based on this thread, I'm going to spin up a server with a different OS to avoid the issues. Thanks On Wednesday, June 18, 2014 11:08:33 PM UTC-4, Brian M wrote: Anybody else tried setting things up on Ubuntu 14.04 using scripts/setup-web2py-ubuntu.sh? I tried it this evening and ran into multiple issues 1) The generated sites-available/default configuration file must be linked to sites-enabled/default.conf or else it doesn't actually get used and all you get are 404 errors. (Note also that you need to have the .conf extension, simply doing a symbolic link from sites-available/default to sites-enabled/default won't work) 2) The granting of permissions in Apache 2.4 seems to have changed. (see http://httpd.apache.org/docs/2.4/upgrading.html) In order to get things working I had to go from Directory /home/www-data/web2py AllowOverride None Order Allow,Deny Deny from all Files wsgihandler.py Allow from all /Files /Directory To Directory /home/www-data/web2py AllowOverride None #Order Allow,Deny #Deny from all Require all granted Files wsgihandler.py Require all granted /Files /Directory Note that I am not an expert in configuring Apache and don't know that these changes won't have unwanted security issues, I just know that they seem to be needed to get web2py up and running on Ubuntu 14.04. 3) The AliasMatch for using response.static_version doesn't seem to be working for me either. :( As soon as I set response.static_version in welcome/models/db.py all of the .js and .css files just return 404 errors. Anybody more knowledgeable than me want to take a look and perhaps offer a patch for the setup script? Thanks, Brian -- 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] Installing Tornado with web2py
Hello, I have installed web2py + uswgi + nginx. I would like to install Tornado. Does anybody could advise me with the recommended configuration to use ? Regards -- 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] Authorized File Download Error
Hello! I am trying to enable temporary access for users to downloadable files by requesting access on a per file basis In my database. Field('members', 'list:reference db.auth_user', default=auth.user_id, requires=IS_IN_DB(db, db.auth_user, '%(first_name)s %(last_name)s %(email)s', multiple=(1, 1000)), writable=False, readable=False), ... db.personal_uploads.file_upload.authorize = lambda record: auth.is_logged_in() and (record.members.contains(auth.user_id)) Causes the following error when trying to download the file: Traceback (most recent call last): File /home/www-data/web2py/gluon/restricted.py, line 220, in restricted exec ccode in environment File /home/www-data/web2py/applications/cryaboutit/controllers/default.py https://62.75.246.181/admin/edit/cryaboutit/controllers/default.py, line 328, in module File /home/www-data/web2py/gluon/globals.py, line 385, in lambda self._caller = lambda f: f() File /home/www-data/web2py/gluon/cache.py, line 523, in wrapped_f rtn = func() File /home/www-data/web2py/applications/cryaboutit/controllers/default.py https://62.75.246.181/admin/edit/cryaboutit/controllers/default.py, line 298, in download return response.download(request, db) File /home/www-data/web2py/gluon/globals.py, line 601, in download (filename, stream) = field.retrieve(name,nameonly=True) File /home/www-data/web2py/gluon/dal.py, line 10029, in retrieve if self.authorize and not self.authorize(row): File /home/www-data/web2py/applications/cryaboutit/models/db.py https://62.75.246.181/admin/edit/cryaboutit/models/db.py, line 138, in lambda db.personal_uploads.file_upload.authorize = lambda record: auth.is_logged_in() and (record.members.contains(auth.user_id)) AttributeError: 'list' object has no attribute 'contains' Thank you for any advice offered. -- 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] infinite scrolling using components
I am trying to implement infinite scrolling on my newsfeed completely using components... My present solution is very trivial, it loads 5 items first, then on reaching bottom, component is refreshed with 10 elements, then 15 and so on... Now, i want to append only the next five items, instead of loading all the items again... I can achieve this without using components (javascript templates+json items), but i want to use components only, One method which i thought of was to use two components, one for loaded posts, and one for loading further content, i will transfer the second components content to first component, by: response.js= 'document.getElementById(component1).insertAdjacentHTML(beforeend,document.getElementById(component2).innerHTML);document.getElementById(component2).innerHTML=;' by doing this the content is transferred to component 1, but when i comment on the item, the page refreshes (whereas it should trap the comment, and submit it via ajax). Can i change the innerHTML of a component without changing its behavior? And the appended elements should send request to component1 or not if a comment is submitted after appending ? (both components work as expected before changing innerHTML,) -- 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: /default/user/login not honoring _next anymore?
You found a bug. Fixing it in trunk. Please check it again. Thanks. On Monday, 23 June 2014 10:14:57 UTC-5, Wei Wang wrote: In the current head branch in github (Version 2.9.5-trunk+timestamp.2014.06.19.17.16.40), it seems that the /default/user/login form does not use the _next variable specified in the URL. For example, The myapp/default/view is decorated with @auth.requires_login(), so when I am not logged in, it triggers web2py's login form with this URL: https://server-name:4443/myapp/default/user/login?_next=/myapp/default/view%3Fapp%3Dnextapp However, the variable _next in the form is always: input type=hidden value=/myapp/default/index name=_next I would expect it to be: input type=hidden value=/myapp/default/view?app=nextapp name=_next Is this a potential bug or is this an expected change? Thanks, -- Wei Wang -- 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: Readonly elements (select and date field) respond to clicks, allow for changes and can be submitted?
You cannot make a field not writable conditionally. Because if the field is writable it shows in the form. This is before you know the value of the other field. Conditionally you can remove the field from form.post_vars. On Monday, 23 June 2014 12:26:04 UTC-5, 98u...@gmail.com wrote: I did what you suggested but the calls to: db.owner.own_end_date.writable = False # not writable db.owner.own_end_date.readable = False # do not show is at all! are effective only if executed before the call to form = SQLFORM.smartgrid(db.owner, ... When executed after, have no effect. I want to make db.owner.own_end_date not writeable conditionally: ... ... if ((len(request.args)1) and (request.args(1)=='edit')): if (form.element('input',_name='own_end_date')['_value']!=''): db.owner.own_end_date.writable=False # - no effect ... ... If the edited record contains a date value in that field then user must not change it. How can I make that field not writeable in such a case? Thanks On Monday, June 23, 2014 1:00:05 AM UTC-4, 98u...@gmail.com wrote: Why readonly elements (select and date field) of a form respond to clicks and allow for changes and can be submitted? They look grayed out as if readonly but when I click on date field the date picker appears and works as it shoud also the select option is grayed out but it offers a list to choose an option and the form can be submitted with these changed values even though this is not intended. #this is the model db.define_table('owner', Field('own_cust_fk','reference customer',label='Customer'), Field('own_veh_fk','reference vehicle',label='Vehicle'), Field('own_plate','string',label='Plate'), Field('own_comment','string',label='Comment'), Field('own_start_date','date',default=now,label='Start date'), Field('own_end_date','date',default=None,label='Terminated'), migrate='owner.table',format='%(own_plate)s %(own_cust_fk)s', plural='Owner' ) def index(): ... ... form = SQLFORM.smartgrid(db.owner, fields=fields, headers=headers, paginate=all, details=True, editable=True, deletable=False, create=False, showbuttontext=False, maxtextlength=40, maxtextlengths=maxtextlengths, buttons_placement = 'left', ) ... ... if ((len(request.args)1) and (request.args(1)=='edit')): form.element('select',_name='own_cust_fk')['_readonly']='True' form.element('input',_name='own_end_date')['_readonly']='True' ... ... return dict(form=form) Any help would be appreciated! Thanks -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: how to Consume external NetTcp SOAP service in Web2Py
web2py ships with pysimplesoap. It is documented on google code. On Monday, 23 June 2014 12:39:22 UTC-5, Gopi wrote: Hi All.. I am new to web2py. Is there a way to call external NetTcp SOAP service in Web2Py. What are the best practices to call such services in Web2Py? -- 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: IS_IN_SET options list separator
There is no syntax to do this. On Monday, 23 June 2014 12:49:21 UTC-5, Carlos Correia wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, Is there a way to introduce a separator in IS_IN_SET options widget, so that from code like: IS_IN_SET( ('1', 'First'), (seperator?), ('2', 'Second'),'3', 'Third') ) it produces something like this? select option value=1First/option option disabled_/option option value=2Second/option option value=3Third/option /select Thanks, - -- Com os melhores cumprimentos, Carlos Correia = MEMÓRIA PERSISTENTE Tel.: 219 291 591 - GSM: 917 157 146 / 967 511 762 e-mail: ge...@memoriapersistente.pt - URL: http://www.memoriapersistente.pt Jabber: m...@jabber.org GnuPG: wwwkeys.eu.pgp.net URL Suporte: https://t5.m16e.com/gps -BEGIN PGP SIGNATURE- Version: GnuPG v1 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlOoaJMACgkQ90uzwjA1SJULhACgl/tHifyri+2PIRchIHEgZ54X xQ4AmwQC8Tvr2icSr1cDAd0pilAe2XyK =cv7J -END PGP SIGNATURE- -- 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: Authorized File Download Error
This line db.personal_uploads.file_upload.authorize = lambda record: auth.is_logged_in() and (record.members.contains(auth.user_id)) should be db.personal_uploads.file_upload.authorize = lambda record: auth.user and auth.user.id in (record.members or []) On Monday, 23 June 2014 13:26:20 UTC-5, Keri Sui wrote: Hello! I am trying to enable temporary access for users to downloadable files by requesting access on a per file basis In my database. Field('members', 'list:reference db.auth_user', default=auth.user_id, requires=IS_IN_DB(db, db.auth_user, '%(first_name)s %(last_name)s %(email)s', multiple=(1, 1000)), writable=False, readable=False), ... db.personal_uploads.file_upload.authorize = lambda record: auth.is_logged_in() and (record.members.contains(auth.user_id)) Causes the following error when trying to download the file: Traceback (most recent call last): File /home/www-data/web2py/gluon/restricted.py, line 220, in restricted exec ccode in environment File /home/www-data/web2py/applications/cryaboutit/controllers/default.py https://62.75.246.181/admin/edit/cryaboutit/controllers/default.py, line 328, in module File /home/www-data/web2py/gluon/globals.py, line 385, in lambda self._caller = lambda f: f() File /home/www-data/web2py/gluon/cache.py, line 523, in wrapped_f rtn = func() File /home/www-data/web2py/applications/cryaboutit/controllers/default.py https://62.75.246.181/admin/edit/cryaboutit/controllers/default.py, line 298, in download return response.download(request, db) File /home/www-data/web2py/gluon/globals.py, line 601, in download (filename, stream) = field.retrieve(name,nameonly=True) File /home/www-data/web2py/gluon/dal.py, line 10029, in retrieve if self.authorize and not self.authorize(row): File /home/www-data/web2py/applications/cryaboutit/models/db.py https://62.75.246.181/admin/edit/cryaboutit/models/db.py, line 138, in lambda db.personal_uploads.file_upload.authorize = lambda record: auth.is_logged_in() and (record.members.contains(auth.user_id)) AttributeError: 'list' object has no attribute 'contains' Thank you for any advice offered. -- 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: Ubuntu 14.04 Setup Script with Apache - Issues?
The nginx setup script works perfectly on ubuntu 14.04. As for Apache, the changes I mentioned above should get it working just fine as well. On Tuesday, June 24, 2014 11:22:47 AM UTC-5, shachar lobl wrote: I'm also experiencing these problems installing on Ubuntu 14.04 as well for the past few days. I've followed all the steps on different tutorials and I still can only get the Apache default page. I was doing this to get a better knowledge of building web apps and I don't have much knowledge of Apache. Based on this thread, I'm going to spin up a server with a different OS to avoid the issues. Thanks On Wednesday, June 18, 2014 11:08:33 PM UTC-4, Brian M wrote: Anybody else tried setting things up on Ubuntu 14.04 using scripts/setup-web2py-ubuntu.sh? I tried it this evening and ran into multiple issues 1) The generated sites-available/default configuration file must be linked to sites-enabled/default.conf or else it doesn't actually get used and all you get are 404 errors. (Note also that you need to have the .conf extension, simply doing a symbolic link from sites-available/default to sites-enabled/default won't work) 2) The granting of permissions in Apache 2.4 seems to have changed. (see http://httpd.apache.org/docs/2.4/upgrading.html) In order to get things working I had to go from Directory /home/www-data/web2py AllowOverride None Order Allow,Deny Deny from all Files wsgihandler.py Allow from all /Files /Directory To Directory /home/www-data/web2py AllowOverride None #Order Allow,Deny #Deny from all Require all granted Files wsgihandler.py Require all granted /Files /Directory Note that I am not an expert in configuring Apache and don't know that these changes won't have unwanted security issues, I just know that they seem to be needed to get web2py up and running on Ubuntu 14.04. 3) The AliasMatch for using response.static_version doesn't seem to be working for me either. :( As soon as I set response.static_version in welcome/models/db.py all of the .js and .css files just return 404 errors. Anybody more knowledgeable than me want to take a look and perhaps offer a patch for the setup script? Thanks, Brian -- 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: Adding scheduler to an existing app break the MySQL DB...
1. make sure no *_scheduler_*.table files are in the databases/* folder 2. make a request to create the tables appname/appadmin/index is fine to check if the tables are there or not. On Tuesday, June 24, 2014 3:33:24 PM UTC+2, Krzysztof Socha wrote: I am fighting it for some time now... I tried all the different ways to migrate the database so that the tables for the scheduler are created, but no luck - maybe someone could help... I have an existing application. Recently I decided I needed to run some things in the background, so I added a scheduler.py model with content like this: def send_mail(jar_id): logger.info('Mail notifications have been sent.') from gluon.scheduler import Scheduler scheduler = Scheduler(db) where db is defined like this in db.py model: db = DAL('mysql://xxx:xxx@localhost/xxx',pool_size=1,check_reserved=['all' ],migrate=True,fake_migrate=False) As soon, as I try to schedule a task, this result in an error: gluon.contrib.pymysql.err.ProgrammingError: (1146, uTable 'xxx.scheduler_task' doesn't exist) I tried setting the fake_migrate to True, removing files in xxx/databases, etc. No luck. Any hint, how to make it work? Krzysztof. -- 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: Installing Tornado with web2py
do you want to run web2py with tornado with nginx as frontend or what else ? On Tuesday, June 24, 2014 10:57:11 AM UTC+2, Salvatore DI DIO wrote: Hello, I have installed web2py + uswgi + nginx. I would like to install Tornado. Does anybody could advise me with the recommended configuration to use ? Regards -- 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: Installing Tornado with web2py
you should be able to do sudo easy_install tornado You can run web2py with tornado using anyserver.py (ships with web2py, -h for command line options). Massimo On Tuesday, 24 June 2014 03:57:11 UTC-5, Salvatore DI DIO wrote: Hello, I have installed web2py + uswgi + nginx. I would like to install Tornado. Does anybody could advise me with the recommended configuration to use ? Regards -- 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] accessing tables using web2py scheduler
Hi, I am trying to access tables within my scheduler function. The tables I am trying to access require @auth.requires_login(). *Am I able to access these tables within my scheduler.py model file?* right now I am passing table row fields as parameters to the scheduler function and it is very messy. In scheduler.py I have tried to include: db = DAL(postgres://postgres..blah) from gluon.tools import Auth auth = Auth(db) if auth.is_logged_in(): thanks! -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Issue deploying web2py even after following tutorial
what version of ubuntu? On Wednesday, June 25, 2014 12:44:45 AM UTC+10, shachar lobl wrote: Hi, I've been struggling the last few days with deploying web2py on an EC2 Ubuntu instance. I describe the steps I took in SO in the link below. http://stackoverflow.com/questions/24371280/unable-to-access-web2py-server-running-in-ec2-instance I feel like it's something simple, and all help would be very much appreciated. Thanks! -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Best No SQL DB supported by web2py?
MongoDB has been marked experimental for quite some time - though. On Wednesday, June 18, 2014 7:56:15 AM UTC+5:30, Anthony wrote: web2py supports MongoDB as well as the Google App Engine Datastore. There is also a CouchDB adapter, though not sure how functional it is. Anthony On Tuesday, June 17, 2014 6:53:28 PM UTC-4, Derek wrote: There is none. On Tuesday, June 17, 2014 2:05:08 PM UTC-7, JorgeH wrote: Hello I have come to the conclusion that a No SQL is best swited for my current project. What is the one Web2py support the most? thanks -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Display returned objects from load(ed) component when calling URL from Ajax
Hello I am facing a problem with returned output from a controller not displaying when being called from a link using the ajax() function inside a LOAD(ed) component. *index* div id=status/div div id=file_list {{=LOAD('default', 'file_list.load', ajax=False)}} /div -- *file_list.load* button class=crypt btn btn-primary onclick=ajax('{{=URL('default', 'encrypt_file', args=(row.id))}}', [], 'status') Que For Encryption /a *default/encrypt_file controller* return dict(key=key, message=Encrypted Successfully) How can I achieve the returned results of my controller in the *status* div or alternative way Thank you for any advice! -- 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] Sending the ID of the newly registered user in email message (auth.messages.verify_email)
Hi I'm trying to send the *id* of the newly registered user in the string *auth.messages.verify_email*. I've tried *%(id)s* but immediately get a ticket. type 'exceptions.KeyError' 'id' When initializing the string *auth.messages.verify_email*, I've been able to use other place holders, such as *%(first_name)s*, *%(last_name)s *and even customer fields such as *%(referring_name)s*. I've tried setting *auth.messages.verify_email* in default.py in the user() function as well, but it returns none. I've also tried setting *auth.messages.verify_email * in a custom function through *auth.settings.register_onaccept*. Here I can see the *id* of the newly registered user, but it seems as though at this point, the mail has already been sent. Also, where can I find a list of all the place holders such as *%(key)s* etc., that can be used in *auth.messages.verify_email* Thanks much -- 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] A way to trigger method on update?
Hi, Is there a way to call a method when certain field is updated? The intention is *not* to change the value of the field/represent it otherwise, but it has general purpose. Thanks! Omri. -- 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.
Re: [web2py] Re: Authorized File Download Error
Amazing! Thank you very much. On Tue, Jun 24, 2014 at 10:49 AM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: This line db.personal_uploads.file_upload.authorize = lambda record: auth.is_logged_in() and (record.members.contains(auth.user_id)) should be db.personal_uploads.file_upload.authorize = lambda record: auth.user and auth.user.id in (record.members or []) On Monday, 23 June 2014 13:26:20 UTC-5, Keri Sui wrote: Hello! I am trying to enable temporary access for users to downloadable files by requesting access on a per file basis In my database. Field('members', 'list:reference db.auth_user', default=auth.user_id, requires=IS_IN_DB(db, db.auth_user, '%(first_name)s %(last_name)s %(email)s', multiple=(1, 1000)), writable=False, readable=False), ... db.personal_uploads.file_upload.authorize = lambda record: auth.is_logged_in() and (record.members.contains(auth.user_id)) Causes the following error when trying to download the file: Traceback (most recent call last): File /home/www-data/web2py/gluon/restricted.py, line 220, in restricted exec ccode in environment File /home/www-data/web2py/applications/cryaboutit/controllers/default.py https://62.75.246.181/admin/edit/cryaboutit/controllers/default.py, line 328, in module File /home/www-data/web2py/gluon/globals.py, line 385, in lambda self._caller = lambda f: f() File /home/www-data/web2py/gluon/cache.py, line 523, in wrapped_f rtn = func() File /home/www-data/web2py/applications/cryaboutit/controllers/default.py https://62.75.246.181/admin/edit/cryaboutit/controllers/default.py, line 298, in download return response.download(request, db) File /home/www-data/web2py/gluon/globals.py, line 601, in download (filename, stream) = field.retrieve(name,nameonly=True) File /home/www-data/web2py/gluon/dal.py, line 10029, in retrieve if self.authorize and not self.authorize(row): File /home/www-data/web2py/applications/cryaboutit/models/db.py https://62.75.246.181/admin/edit/cryaboutit/models/db.py, line 138, in lambda db.personal_uploads.file_upload.authorize = lambda record: auth.is_logged_in() and (record.members.contains(auth.user_id)) AttributeError: 'list' object has no attribute 'contains' Thank you for any advice offered. -- 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. -- 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: Best No SQL DB supported by web2py?
It is experimental only because I never tested it myself. From what I hear it works well. On Wednesday, 25 June 2014 00:14:59 UTC-5, Mandar Vaze wrote: MongoDB has been marked experimental for quite some time - though. On Wednesday, June 18, 2014 7:56:15 AM UTC+5:30, Anthony wrote: web2py supports MongoDB as well as the Google App Engine Datastore. There is also a CouchDB adapter, though not sure how functional it is. Anthony On Tuesday, June 17, 2014 6:53:28 PM UTC-4, Derek wrote: There is none. On Tuesday, June 17, 2014 2:05:08 PM UTC-7, JorgeH wrote: Hello I have come to the conclusion that a No SQL is best swited for my current project. What is the one Web2py support the most? thanks -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.