[web2py] Re: temporary storage
Your query db.auth_user==arg is wrong. You need to compare with a field in auth_ser. You probably want something like db.auth_user.id==arg quinta-feira, 20 de Outubro de 2016 às 07:36:05 UTC+1, Jaimee S escreveu: > > Hello all, > > I have a list of users on my page. I'm trying to click one user and add > that user to a list. After that, I'm trying to loop though each and display > their username in html. I can't seem to get the code one hundred percent > right. Any help would be appreciated! > > Here is my code: > > > def to_del(): > arg=request.args(0) > guy=db(db.auth_user==arg).select(db.auth_user.username) > people=[] > for person in guy: > people.append(guy) > return locals() > > > > > selected: # for loop with people > > Any ideas? > > -- 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: temporary storage
Thanks! That fixed an error. However the big problem is capturing multiple args and storing them in a list so I can access them with a for loop. Is this possible? -- 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: temporary storage
Well you can send more than one arg. If you really want to send a list though I would not use args and use vars. A simple enough solution would be to send a string with commas separating the values like "1,2,3,4,5" and then in the controller you would do something like db.auth_user.id.belongs(request.vars.ids.split(',')) -- 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: temporary storage
That is exactly the piece of code I needed! I'll let you know how it goes when I try it out. Is there any way to limit the number of vars entered? -- 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: insert list of dictionary
Your fields are of type string (the default); so either make string representations of your lists or declare the fields as lists of strings. On Wednesday, October 19, 2016 at 9:15:21 AM UTC-4, Tribo Eila wrote: > > Hi, > > supposed: > db.define_table('color', Field('blue'),Field('yellow'),Field('red')) > > COLORED_THINGS = { > 'blue': ['sky', 'jeans', 'powerline insert mode'], > 'yellow': ['sun', 'banana', 'phone book/monitor stand'], > > 'red': ['blood', 'tomato', 'test failure']} > > using db.color.insert(...). i'm trying to figure how to save in database > base on key dict. i tried for loops but my head starts turning. > -- 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 create a front end for an external API?
before wanting something that helps you implementing something do you have a minimal idea of what you want to happen with your API ? On Thursday, October 20, 2016 at 12:41:34 AM UTC+2, greenpoise wrote: > > RESTFUL API I meant to write > > > > > > > On Wednesday, October 19, 2016 at 2:42:52 PM UTC-7, greenpoise wrote: >> >> First, I am new to API. I did read and went through the web2py book >> section of API but I am still a bit lost. Is there a good example for this? >> Am I asking/searching the right way? >> >> >> 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: temporary storage
Well you should always validate whatever you get from the users. In that validation step you can do that. A possible way to validate it would be to do something like: ids, error = IS_LIST_OF(IS_INT_IN_RANGE(minimum=1), maximum=YOUR_MAX_NUMBER_OF_IDS)(request.vars.ids.split(',')) if error: # we didn't validate for some reason response.flash = error else: people = db(db.auth_user.id.belongs(ids))... Instead of using IS_INT_IN_RANGE you can even go a step further and use IS_IN_DB, but that would be much more heavy as it would hit the database and I don't think it's needed here due to the next step. -- 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 + cordova + APIs
Copy/paste and accept update files that are different... Richard On Wed, Oct 19, 2016 at 8:01 PM, greenpoise wrote: > I tried cloning this to try it out (it might be the answer to my API > question) but it did not work and there is no w2p extension file. How can I > install to try it? > > > thanks > > > > On Friday, October 14, 2016 at 10:41:25 AM UTC-7, Massimo Di Pierro wrote: >> >> So I made this: >> >> https://github.com/mdipierro/web2py-cordova >> >> Anyone is brave enough to try make a sample app that uses it and runs >> with APIMaker (https://github.com/mdipierro/collection2)? >> >> Massimo >> >> >> > -- > 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] Is it possible for Web2Py SOAP-Services to give feedback during lenghty operations?
I am using Web2Py on a RaspberryPI as a SOAP service provider and a very rudimentary configuration is possible through some views. User interaction is via a client application and users are mostly unaware that there is some server running in one of their shelves. I have just recently implemented a procedure to update a server via the client. It stores the current web2py-app then exports the db as csv, updates any files that need updating, clears all tables and reimports the csv. This works fine, but may result in timeout messages on the client side, as tests have shown. Besides, for the user there is no way of knowing how far the procedure has gone, and how much longer the wait will be. Is there a possibility to give feedback to the client? Any kind of message would be great just numeric to fill a progress indicator or even text to display progress messages? Regards, Oliver Holmes -- 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: insert list of dictionary
On Wednesday, October 19, 2016 at 9:15:21 AM UTC-4, Tribo Eila wrote: > > Hi, > > supposed: > db.define_table('color', Field('blue'),Field('yellow'),Field('red')) > > COLORED_THINGS = { > 'blue': ['sky', 'jeans', 'powerline insert mode'], > 'yellow': ['sun', 'banana', 'phone book/monitor stand'], > > 'red': ['blood', 'tomato', 'test failure']} > Do you want COLORED_THINGS to be a *single record* in the "color" table? If so, your fields will have to be of type "list:string" (so each field can store a list of strings) -- for example, Field('blue', 'list:string'). In that case, just do: db.color.insert(**COLORED_THINGS) Anthony > > using db.color.insert(...). i'm trying to figure how to save in database > base on key dict. i tried for loops but my head starts turning. > -- 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 do I display db text/string fields in the format in which they were entered on the form?
I have an app in which users can fill out a form and then that form is displayed in a view. The form has many fields, several of which are free form text boxes, where type is 'text'. Specifically my db table is called 'sites' and a field related to my question is 'other', in which a user might enter a long description of information not captured in any of the fields of the form. Currently, to display the field in my view, I am just using: {{if len(site.other) > 0:}} Miscellaneous "Other" {{=site.other}} {{pass}} The text is being displayed in one long string. New lines (returns) that the user entered in the form are not reflected in the output. I don't know much about html, but I do know that in general it ignores new lines (you have to use a tag like to get a new line), but how can I display the text the user entered into the form and have the new lines displayed? Some users have also done indentation to display a list of items with asterisks for bullets, so preferably that would render also. An example might be: We expect applicants to do the following * show up on time * dress professionally * complete all tasks in a timely fashion I am currently not using a CSS style sheet, but I suspect that might be part of the solution. Thus far, my view just has the default: {{extend 'layout.html'}} at the top and then my fields. Basically I want the functionality that this form that I'm filling out right now has, my text will be rendered with new lines and indentations just as I've typed them into this text box (note I don't need the fancy code formating and all of the cool things I can do in this form). 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: Is it possible for Web2Py SOAP-Services to give feedback during lenghty operations?
On Thursday, October 20, 2016 at 7:38:16 AM UTC-7, Oliver Holmes wrote: > > I am using Web2Py on a RaspberryPI as a SOAP service provider and a very > rudimentary configuration is possible through some views. User interaction > is via a client application and users are mostly unaware that there is some > server running in one of their shelves. I have just recently implemented a > procedure to update a server via the client. It stores the current > web2py-app then exports the db as csv, updates any files that need > updating, clears all tables and reimports the csv. This works fine, but may > result in timeout messages on the client side, as tests have shown. > Besides, for the user there is no way of knowing how far the procedure has > gone, and how much longer the wait will be. Is there a possibility to give > feedback to the client? Any kind of message would be great just numeric to > fill a progress indicator or even text to display progress messages? > > Regards, > Oliver Holmes > Here;s what I would do: run the update as a queued task. Have a "progress" table in the db; it only needs to be 1 row. [Alternate idea; store progress in a file in the filesystem; I don't think you can update the session from the Scheduler environment, BICBW]. The page that starts the update goes to a status page which displays the current progress value and has refresh set to 10 seconds or such, or it has a javascript loop that fires an AJAX request off and sleeps for 10 seconds. There have been some progress bars discussed here, and that should be searchable in the forum archives, but I think stupid.css (used in the current Welcome app) has that built-in; check out Massiomo's examples at https://github.com/mdipierro/stupid.css>. /dps -- 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 do I display db text/string fields in the format in which they were entered on the form?
On Thursday, October 20, 2016 at 9:13:56 AM UTC-7, Steven Vannoy wrote: > > I have an app in which users can fill out a form and then that form is > displayed in a view. The form has many fields, several of which are free > form text boxes, where type is 'text'. Specifically my db table is called > 'sites' and a field related to my question is 'other', in which a user > might enter a long description of information not captured in any of the > fields of the form. Currently, to display the field in my view, I am just > using: > > {{if len(site.other) > 0:}} > Miscellaneous "Other" > {{=site.other}} > {{pass}} > > > The text is being displayed in one long string. New lines (returns) that > the user entered in the form are not reflected in the output. I don't know > much about html, but I do know that in general it ignores new lines (you > have to use a tag like to get a new line), but how can I display the > text the user entered into the form and have the new lines displayed? Some > users have also done indentation to display a list of items with asterisks > for bullets, so preferably that would render also. An example might be: > > We expect applicants to do the following > * show up on time > * dress professionally > * complete all tasks in a timely fashion > > > I am currently not using a CSS style sheet, but I suspect that might be > part of the solution. Thus far, my view just has the default: > > {{extend 'layout.html'}} > > > at the top and then my fields. > > Basically I want the functionality that this form that I'm filling out > right now has, my text will be rendered with new lines and indentations > just as I've typed them into this text box (note I don't need the fancy > code formating and all of the cool things I can do in this form). > > Thanks > I'm going to go out on a limb, and opine that you never even get the newlines or indentation (but do get the asterisks), all that having been stripped out by the textarea input control. You need something that actually makes it to you and that you can recognize as format control. The easiest is probably to use web2py's wiki support: http://web2py.com/books/default/chapter/29/03/overview#MARKMIN-basics> (BTW, under the covers, you *are* using CSS style sheets ... either Bootstrap3 or stupid.css, depending on which layout.html you started with; adding a *custom* style sheet probably isn't necessary for this task.) /dps -- 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 do I display db text/string fields in the format in which they were entered on the form?
You could use a tag: http://www.w3schools.com/tags/tag_pre.asp. You might need some CSS to get the font/styling you like. You could also replace the newlines with tags: {{=XML(site.other.replace('\n', ''), sanitize=True, permitted_tags=[ 'br/'])}} Because the text now contains HTML tags, it is necessary to wrap it in XML() to prevent web2py from escaping the HTML -- but you also want to sanitize the text and allow *only* tags to prevent malicious code from being executed. 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: How do I display db text/string fields in the format in which they were entered on the form?
On Thursday, October 20, 2016 at 2:01:09 PM UTC-4, Dave S wrote: > > > I'm going to go out on a limb, and opine that you never even get the > newlines or indentation (but do get the asterisks), all that having been > stripped out by the textarea input control. > No, a textarea does preserve newlines. 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.
Re: [web2py] Re: How do I display db text/string fields in the format in which they were entered on the form?
Thanks, the replace option from @Anthony worked pretty well, it got the new lines but didn't provide indentation (as expected). The tags get both, and I like the font well enough except that it is a lighter gray on a gray background so if I can manage to get that changed I'll probably go with that option. Yes Dave, you were right it wasn't stripping the asterisks but wasn't rendering them the way I would like. Steven On Thu, Oct 20, 2016 at 2:07 PM, Anthony wrote: > On Thursday, October 20, 2016 at 2:01:09 PM UTC-4, Dave S wrote: >> >> >> I'm going to go out on a limb, and opine that you never even get the >> newlines or indentation (but do get the asterisks), all that having been >> stripped out by the textarea input control. >> > > No, a textarea does preserve newlines. > > 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 a topic in the > Google Groups "web2py-users" group. > To unsubscribe from this topic, visit https://groups.google.com/d/ > topic/web2py/WM3hhsJVUYU/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.
Re: [web2py] Re: How do I display db text/string fields in the format in which they were entered on the form?
Oops, forgot about the indenting -- just replace all spaces with " ": {{=XML(site.other.replace('\n', '').replace(' ', ' '), sanitize=True, permitted_tags=['br/'])}} Anthony On Thursday, October 20, 2016 at 2:29:51 PM UTC-4, Steven Vannoy wrote: > > Thanks, the replace option from @Anthony worked pretty well, it got the > new lines but didn't provide indentation (as expected). The > tags get both, and I like the font well enough except that it is a lighter > gray on a gray background so if I can manage to get that changed I'll > probably go with that option. > > Yes Dave, you were right it wasn't stripping the asterisks but wasn't > rendering them the way I would like. > > Steven > > > On Thu, Oct 20, 2016 at 2:07 PM, Anthony wrote: > >> On Thursday, October 20, 2016 at 2:01:09 PM UTC-4, Dave S wrote: >>> >>> >>> I'm going to go out on a limb, and opine that you never even get the >>> newlines or indentation (but do get the asterisks), all that having been >>> stripped out by the textarea input control. >>> >> >> No, a textarea does preserve newlines. >> >> 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 a topic in the >> Google Groups "web2py-users" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/web2py/WM3hhsJVUYU/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] Is it safe to delete all folders from sessions? Does it have any side effect?
I need to use my app from fresh. Will it have any disadvantage? -- 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 it safe to delete all folders from sessions? Does it have any side effect?
On Thursday, October 20, 2016 at 12:55:22 PM UTC-7, Steve Joe wrote: > > I need to use my app from fresh. Will it have any disadvantage if I delete > everything inside sessions and error folder? > In my experience, safe=True and side_effects = "I don't remember that". It is similar to creating a new app by unpacking the welcome app's w2p file, and loading the DB with CSV file. /dps -- 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: temporary storage
Yes, that's along the lines of what I'm looking for; however, I'll need it to be in the database due to the fact that I'm going to loop through that list of requests with a for-loop and call a function on each one. The function adds that value to a field in the db.when I tried to require it in the db, I got a dropdown instead of just an input. Is there any way to remove that dropdown action? -- 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] the request value run well in terminal too like in browser
Is it possible the request value, run well in terminal too like in browser? *private/appconfig.ini* [environment] type = dev [dev_environment] server_name = test.local folder = /Users/test/site/web2py/applications/test/ server_software = Rocket 1.2.6 *models/db.py* environment_base = (request.env.server_name != myconf.get(myconf_env + '_' + 'environment.server_name') ) or \ (request.folder != myconf.get(myconf_env + '_' + 'environment.folder') ) version_base = (request.env.server_software != myconf.get(myconf_env + '_' + 'environment.server_software') ) if environment_base or version_base: raise HTTP(500, "Please contact your IT Support!") *Run in terminal* python ~/site/web2py/web2py.py --nogui --no-banner -S test -M -R ~/site/web2py/applications/test/modules/test_functional_test.py It return an error when running in terminal : Please contact your IT Support! (in browser it run well) Is there a way to have it run well in both terminal and web browser? thanks and 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] Re: the request value run well in terminal too like in browser
On Thursday, October 20, 2016 at 3:28:13 PM UTC-7, 黄祥 wrote: > > *[...]* > *Run in terminal* > python ~/site/web2py/web2py.py --nogui --no-banner -S test -M -R > ~/site/web2py/applications/test/modules/test_functional_test.py > > It return an error when running in terminal : Please contact your IT > Support! > (in browser it run well) > > Is there a way to have it run well in both terminal and web browser? > When I try -S, request.env.server_software has the value None, which makes sense because we aren't getting requests from the wire (er, from a socket), we're getting a request from the command line. /dps -- 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: represent list:reference
Up. Em terça-feira, 11 de setembro de 2012 18:35:25 UTC-3, Pepe Araya escreveu: > > Hello, > I need to display the format value of the referenced table in a > list:reference and not the list of ids. > > I have these tables: > db.define_table('personas', > Field('nombres'), > Field('apellidos'), > format='%(nombres)s %(apellidos)s') > > db.define_table('publicaciones', > Field('titulo'), > Field('descripcion', 'text', label='Descripción'), > Field('autores', 'list:reference db.personas', > requires= IS_IN_DB(db, 'personas.id', '%(nombres)s > %(apellidos)s', multiple=True)), > format='%(titulo)s') > > this controller function: > def filtro(): > tipo = request.args(0) > lista_publicaciones = db(db.publicaciones.tipo == tipo).select(orderby > =~ db.publicaciones.fecha) > if lista_publicaciones: > lista_publicaciones=lista_publicaciones > else: > lista_publicaciones = "0" > return dict(lista_publicaciones=lista_publicaciones) > > and this in the view: > > {{if lista_publicaciones !='0':}} > > {{for publicacion in lista_publicaciones:}} > > > href="{{=URL('publicaciones','ver_publicacion', args=publicacion.id)}}" > >{{=publicacion.titulo}} > Autores: {{=publicacion.autores}} > > {{=XML(publicacion.descripcion)}} > > {{pass}} > {{else:}} > something... > {{pass}} > > using this in the view: > {{=db.publicaciones.autores.represent(publicacion.autores) }} > > I get this error: > ('NoneType' object is not callable) > > If I use: > Autores: {{=publicacion.autores}} > > I get: > Autores: [5,66] > > and I want: > > Autores: nombres apellidos, nombres apellidos > > Please, any help is welcome. > 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.