[web2py] Re: Determine if a website is being accessed from a WebView?

2017-05-23 Thread Spokes
Anthony is correct about request.user_agent(): it will show the OS as Linux, it will show the distribution as 'Android', and it shows an inscrutable and unhelpful browser agent string. I followed Dave's suggestion, in checking request.env.http_user_agent, and it turns out that it does

[web2py] Determine if a website is being accessed from a WebView?

2017-05-23 Thread Spokes
I've created Android application, which is essentially a web2py website wrapped in a React Native WebView. I'd like the website to present slightly different content, depending on whether it's being accessed from an app or a browser.

[web2py] "psycopg2.DatabaseError: SSL SYSCALL error: Software caused connection abort" error occurs regularly

2016-11-02 Thread Spokes
I'm running a script which uses pydal outside of the web2py environment, in the following manner: from gluon import DAL, Field from gluon.validators import IS_LENGTH, IS_IN_SET, IS_EMPTY_OR, IS_URL, IS_INT_IN_RANGE db = DAL(.., pool_size = 1, check_reserved=['all'], lazy_tables = False,

Re: [web2py] Setting up nginx to enable CORS for a specific function?

2016-10-27 Thread Spokes
t/mime or form encoded var so no request.vars. > you should probably read the request.body content for JSON. > > try to look into restful services or json services (see the book) to have > that done automagically... > > > > > 2016-10-27 17:17 GMT+02:00 Spokes <spoke...@gma

Re: [web2py] Setting up nginx to enable CORS for a specific function?

2016-10-27 Thread Spokes
, **headers) > > > def cors_allow(action): > > def f(*args, **kwargs): > cors_origin() > return action(*args, **kwargs) > > f.__doc__ = action.__doc__ > f.__name__ = action.__name__ > f.__dict__.update(action.__dict__) > > return f >

[web2py] Setting up nginx to enable CORS for a specific function?

2016-10-26 Thread Spokes
This isn't necessarily a web2py-specific question, but perhaps there's a web2py-specific solution that's preferable to other solutions, so I thought I'd ask it here. I have some HTML code and javascript, which I'd like to be able to paste into any website, and which should access an API

[web2py] 502 Error when accessing Google Data API

2016-08-31 Thread Spokes
I have a website with a form in which a user enters an IP address. When the form is "submitted" (actually, an AJAX call is made, which updates the form), the part of the form that's updated via the AJAX call shows a "502 Bad Gateway nginx 1.8" error - this happens when attempting to get youtube

Re: [web2py] Re: Validating an input manually added to auth.register() form?

2016-01-28 Thread Spokes
On Thursday, January 28, 2016 at 12:56:15 AM UTC-5, mweissen wrote: > > I had the same problem: I want an extra field in the login form without an > additional field in auth_user. Some months ago I wrote a proposal how to > implement it, but I did not get any response. Here is the proposal

[web2py] Validating an input manually added to auth.register() form?

2016-01-27 Thread Spokes
I've manually added a field to the auth.register() form, but validation is not performed for the field upon form submission. The code is as follows: def create_zipcode_field_for_register_form(): input_zipcode = INPUT(_class = 'span4 string', _name = 'f_zipcode', _id = 'f_zipcode',

[web2py] Re: Validating an input manually added to auth.register() form?

2016-01-27 Thread Spokes
Hi, Massimo. Yes, I'm trying to add an extra input field to the registration form. The above code does this successfully, with the exception of validation, which is not performed. If I'm not mistaken, the 'extra_fields' way of solving this problem will add an otherwise useless field to the

[web2py] Change form style of a form created with auth.register()?

2016-01-26 Thread Spokes
Is there a way to specify the form style (i.e. 'ul', 'bootstrap', etc. - as with SQLFORM's 'formstyle' parameter) for registration forms created with auth.register()? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) -

[web2py] Re: Change form style of a form created with auth.register()?

2016-01-26 Thread Spokes
Thanks, niphlod. Following your suggestion, I found auth.settings.formstyle in the docs. I wasn't aware of response.formstyle either - seems to be undocumented, and there's a post from a while ago warning against it - it's

[web2py] Encoding-related exceptions produced when doing DB inserts or lookups

2015-10-24 Thread Spokes
An application has suddenly started generating exceptions pertaining to encoding, when I attempt to perform database inserts or lookups. The lookup operation produces this exception: 3. Exception in 'Agent_Base check_comparable_record_exists_in_db()': 'ascii' codec can't decode byte 0xe2 in

[web2py] Re: Text that follows a double-quote inside of current.T() is chopped when used as textarea placeholder

2015-05-18 Thread Spokes
), ...) Maybe submit a github issue about this and link to this post. Anthony On Sunday, May 17, 2015 at 12:29:00 PM UTC-4, Spokes wrote: I'm attempting to include a relatively lengthy passage of text in a textarea placeholder; the text contains some terms within double-quotes, and the text

[web2py] Text that follows a double-quote inside of current.T() is chopped when used as textarea placeholder

2015-05-17 Thread Spokes
I'm attempting to include a relatively lengthy passage of text in a textarea placeholder; the text contains some terms within double-quotes, and the text string is passed to current.T(). The problem is that everything following the first double-quote gets truncated. For example, let's say this

[web2py] Re: Text that follows a double-quote inside of current.T() is chopped when used as textarea placeholder

2015-05-17 Thread Spokes
quotes ? On Sunday, May 17, 2015 at 6:29:00 PM UTC+2, Spokes wrote: I'm attempting to include a relatively lengthy passage of text in a textarea placeholder; the text contains some terms within double-quotes, and the text string is passed to current.T(). The problem is that everything

Re: [web2py] Re: Creating a grid based on queries pertaining to a primary db table, and a table that references it

2015-05-11 Thread Spokes
).select(*fields, distinct=True, orderby=p.first_name) On Sat, May 9, 2015 at 9:24 PM, Spokes spoke...@gmail.com javascript: wrote: Thanks, Massimiliano. I was also considering an approach involving creating a list of IDs from the 'thing' table, but I'm not sure that this would be feasible

Re: [web2py] Re: Creating a grid based on queries pertaining to a primary db table, and a table that references it

2015-05-09 Thread Spokes
db(query).select(*fields, distinct=True, orderby=p.first_name) On Fri, May 8, 2015 at 10:49 PM, Spokes spoke...@gmail.com javascript: wrote: Hi, Dave. Yes, that seems to be an accurate summary of what I was attempting to do. On Friday, May 8, 2015 at 3:25:24 PM UTC-5, Dave S wrote

[web2py] Creating a grid based on queries pertaining to a primary db table, and a table that references it

2015-05-08 Thread Spokes
I'd like to create a grid based on criteria relating to a primary table, and a table that references that primary table. Slightly modifying the example from the web2py docs, let's say the primary table is 't_person', and it's referenced by the table, 't_thing'. I'd like the grid to list

[web2py] Re: Creating a grid based on queries pertaining to a primary db table, and a table that references it

2015-05-08 Thread Spokes
Hi, Dave. Yes, that seems to be an accurate summary of what I was attempting to do. On Friday, May 8, 2015 at 3:25:24 PM UTC-5, Dave S wrote: On Friday, May 8, 2015 at 11:55:13 AM UTC-7, Spokes wrote: I'd like to create a grid based on criteria relating to a primary table, and a table

[web2py] Getting list of ids of items in a grid?

2015-03-17 Thread Spokes
I'd like to get the id associated with each row of a grid. The grid is created like this: field_names = ['id'] field_list = [f for f in db.t_table1 if f.name in field_names] query = (db.t_table1.id 0) grid = SQLFORM.grid(query, fields = field_list, orderby

[web2py] Re: Getting list of ids of items in a grid?

2015-03-17 Thread Spokes
, however. Still, I've added an ellipsis to the code in the question to reflect that other fields may be present as well. On Tuesday, March 17, 2015 at 3:25:59 PM UTC-5, Dave S wrote: On Tuesday, March 17, 2015 at 12:38:18 PM UTC-7, Spokes wrote: I'd like to get the id associated with each row

[web2py] Example application demonstrating standard web2py login multiple social logins without janrain?

2015-02-13 Thread Spokes
Does anyone have a minimal example application demonstrating how to give the user the option of logging in with either social platforms (at least Twitter and Facebook) without using janrain, or with the standard web2py/login? I've gotten as far as implementing Twitter and FB classes in

[web2py] Stange behavior with SQLFORM 'fields' parameter

2015-02-11 Thread Spokes
After passing a list to SQLFORM's 'fields' parameter, it appears that 'id' is prepended to that list. For example: field_list = ['field_1', 'field_2', 'field_3', ...] form SQLFORM(db.t_table_1, fields = field_list) After the above statements are executed, 'field_list' is equal to ['id',

[web2py] Re: Stange behavior with SQLFORM 'fields' parameter

2015-02-11 Thread Spokes
. import copy form = SQLFORM(db.t_table_1, fields = copy.copy(field_list)) I suppose SQLFORM could be changed to do the copying itself. Anthony On Wednesday, February 11, 2015 at 12:10:53 PM UTC-5, Spokes wrote: After passing a list to SQLFORM's 'fields' parameter, it appears that 'id

[web2py] Having db().select() return rows with only one instance with a particular value for a given field?

2015-01-21 Thread Spokes
I'd like a db(query).select(...) operation to return a set of rows in which there can only be one instance of a row with a particular value for a certain field. My query is like this: book_query = ((db.t_article.f_book_id != None) (db.t_article.f_book_id == db.t_book_image.id))

[web2py] Re: Having db().select() return rows with only one instance with a particular value for a given field?

2015-01-21 Thread Spokes
Thanks, Niphlod. Guess this will be a bit less straightforward than I anticipated. On Wednesday, January 21, 2015 at 3:46:36 PM UTC-5, Niphlod wrote: I don't think there's a T-SQL statement for it. If you strongly need it, performance-wise, it's still best to distinct/groupby on the

[web2py] Re: Having db().select() return rows with only one instance with a particular value for a given field?

2015-01-21 Thread Spokes
a job for distinct=True (or a groupby) . Docs are here http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#orderby--groupby--limitby--distinct--having-orderby_on_limitby-left-cache On Wednesday, January 21, 2015 at 7:09:41 PM UTC+1, Spokes wrote: I'd like a db(query

[web2py] Re: Speeding up access of remote database from localhost?

2015-01-13 Thread Spokes
Why don't you install the database on your development machine or just use sqlite for development? I often do, but sometimes, I'd like to have access to the latest version of the database - accomplishing that through database exports/imports is too cumbersome, and doing it manually is

[web2py] Creating a rows object which only contains rows with a unique value for a given field

2015-01-12 Thread Spokes
I'm attempting to create a set of rows containing items (t_table1) which have an image (t_table1_image) associated with them, or which are referenced by an entry in another table (t_table2), with an image (t_table2_image) associated with that entry. I would like the corresponding rows

[web2py] Speeding up access of remote database from localhost?

2015-01-12 Thread Spokes
I'm initializing my db in the following way. if request.env.HTTP_HOST == '127.0.0.1:8000': db = DAL(postgres://...server details..., pool_size = 1, check_reserved=['postgres'], lazy_tables=True, fake_migrate_all=False) else:

[web2py] Running a site and its corresponding url shortener on the same web2py instance

2014-12-28 Thread Spokes
I'd like to run a site and a dedicated url shortener on the same instance of web2py. These are two different apps (let's call them MainApp and Short) corresponding to two different domains (let's say, mainapp.com and short.me). I've managed to set up my routes.conf and routes.py file such that

[web2py] Re: Running a site and its corresponding url shortener on the same web2py instance

2014-12-28 Thread Spokes
Nevermind. This solution seems to have worked: https://groups.google.com/d/msg/web2py/yi5rPK4APKs/rVBg9AiShPUJ On Sunday, December 28, 2014 8:40:10 AM UTC-5, Spokes wrote: I'd like to run a site and a dedicated url shortener on the same instance of web2py. These are two different apps (let's

[web2py] Sorting a grid by a field that's referenced by a referenced table

2014-12-06 Thread Spokes
I have a grid that I would like to sort by a field that's removed from the table referenced in the grid's query by two degrees of references. The situation is essentially like this: db.define_table('table1', ...) db.define_table('table2', dal.Field('f_table1_id', type='reference table1',

[web2py] Constructing a query which references multiple tables, and passing that query to SQLFORM.grid()

2014-11-14 Thread Spokes
I have a two tables, one of which references the other. I would like to create a complex query involving those two tables, and pass this query to an SQLFORM.grid() to view entries in the first table. Basically, I'd like the grid to show table1 entries which meet some preliminary set of

[web2py] Would appreciate a clarification on using redirect() from a component

2014-11-13 Thread Spokes
I have a view which contains a form that's within a LOAD component. The basic code for the component is something like this: def function1(): try: ... form = SQLFORM(db.my_table, row.id) ... if form.process().accepted: ...

[web2py] Re: Would appreciate a clarification on using redirect() from a component

2014-11-13 Thread Spokes
Got it. Thanks! On Thursday, November 13, 2014 2:07:08 PM UTC-5, Leonel Câmara wrote: Because when you don't specify, the URL function uses the extension of the current request. More specifically URL does this: if extension is None and r.extension != 'html': extension =

[web2py] Minor typo in online book

2014-11-04 Thread Spokes
In the grid section of the forms chapter http://web2py.com/books/default/chapter/29/07/forms-and-validators#SQLFORM, it says, links = [dict(header='Virtual Field 1',body=lamba row:row.vfield),...] - of course, lamba should be lambda. No big deal, but can cause a glitch if copying from the book

Re: [web2py] Minor typo in online book

2014-11-04 Thread Spokes
Thanks - done! On Tuesday, November 4, 2014 1:36:57 PM UTC-5, Richard wrote: You can log in github et submit a PR after having correct the typo : https://github.com/mdipierro/web2py-book :) Richard On Tue, Nov 4, 2014 at 11:32 AM, Spokes spoke...@gmail.com javascript: wrote

[web2py] generating an Excel file on the fly, and creating download link?

2014-11-04 Thread Spokes
I'd like to create an excel file, and create a link for it within a page, without writing the file to disk. I've been trying to do something like this : def create_excel_link(poll_id): import xlsxwriter import cStringIO stream = cStringIO.StringIO() ... workbook

[web2py] Re: generating an Excel file on the fly, and creating download link?

2014-11-04 Thread Spokes
= workbook.add_worksheet(...) ... stream.seek(0) return response.stream(stream) def create_excel_link(poll_id): return A('link', _href = URL('gimme',args=poll_id)) On Tuesday, 4 November 2014 16:53:02 UTC-6, Spokes wrote: I'd like to create an excel file

Re: [web2py] Changing column order in an SQLFORM.grid that takes a links parameter

2014-11-02 Thread Spokes
'* Kiran Subbaramanhttp://subbaraman.wordpress.com/about/ On Sun, 02-11-2014 6:08 AM, Spokes wrote: My page has an SQLFORM.grid which has a column that's created with the use of the links parameter. By default, this column is generated as the rightmost column

[web2py] Changing column order in an SQLFORM.grid that takes a links parameter

2014-11-01 Thread Spokes
My page has an SQLFORM.grid which has a column that's created with the use of the links parameter. By default, this column is generated as the rightmost column of the grid. If there a way to make this column the leftmost column instead? Thanks. -- Resources: - http://web2py.com -

[web2py] Re: Form generated in super class causes 303 error when validator is given the 'next' parameter

2014-10-26 Thread Spokes
Dabbled with it some more, and it seems that the problem doesn't exist only when using the super class to generate the form. I've tried a couple of functions that generate the form within the controller. The first variant is this (passing the 'next' directive to validate()): def create_form():

[web2py] Re: Form generated in super class causes 303 error when validator is given the 'next' parameter

2014-10-26 Thread Spokes
(...) except Exception as e: if isinstance(e, HTTP): raise e else: print e Anthony On Sunday, October 26, 2014 11:09:24 AM UTC-4, Spokes wrote: Dabbled with it some more, and it seems that the problem exists not only when using the super class to generate the form. I've

[web2py] Form generated in super class causes 303 error when validator is given the 'next' parameter

2014-10-25 Thread Spokes
I have a class (let's call it MyClass) which has a super class (let's call it SuperClass) - these classes are in separate files under 'models'. MyClass defines a database table, and it can call a SuperClass function to construct an SQLFORM for that table. This works perfectly fine unless a

[web2py] Re: Form generated in super class causes 303 error when validator is given the 'next' parameter

2014-10-25 Thread Spokes
I'll see if I can reproduce it in a minimal version. On Saturday, October 25, 2014 7:01:35 PM UTC-5, Anthony wrote: Hard to say without seeing the relevant code. On Saturday, October 25, 2014 7:16:55 PM UTC-4, Spokes wrote: I have a class (let's call it MyClass) which has a super class

[web2py] Is it sensible to generate images on the fly/use a base64 string as image source?

2014-10-20 Thread Spokes
For reasons of which I'm not totally sure, I was unable to use web2py's download function with a particular table's upload field https://groups.google.com/forum/#!topic/web2py/u60oQK-7EbM. Consequently, I hacked my way around it by doing something like this: def return_image_as_string(db,

[web2py] Re: Is it sensible to generate images on the fly/use a base64 string as image source?

2014-10-20 Thread Spokes
I still think your original code was failing due to the table not being defined I put a print statement in the 'download' function to check that the db instance being passed to that function contains the required table, and it did seem to confirm that the table was there. Specifically, I

[web2py] Re: Is it sensible to generate images on the fly/use a base64 string as image source?

2014-10-20 Thread Spokes
Indeed, you're right - the combination of the two changes solved the problem. I thought that I had tried this previously, but perhaps I had tried one or the other change, without doing both. Thank you! Still, isn't it possible to pretty much do away with modules without compromising

[web2py] Re: Is it sensible to generate images on the fly/use a base64 string as image source?

2014-10-20 Thread Spokes
Thanks - will keep this in mind. On Monday, October 20, 2014 11:23:01 AM UTC-5, Leonel Câmara wrote: It isn't as necessary as it used to be to move models into modules because of lazy tables and the fact that you can run models conditionally now. Either way I think that's usually a

[web2py] Image not showing: NetworkError: 404 NOT FOUND

2014-10-18 Thread Spokes
I'm doing something pretty routine in defining a db table in a class within a file in modules, and later, attempting to display an image associated with that table. The table is defined like so: class Image: def __init__(self, db, auth_signature, session, request, response): ...

[web2py] Re: Image not showing: NetworkError: 404 NOT FOUND

2014-10-18 Thread Spokes
Consider using current in your module so you don't have to pass everything as an argument. Awesome - thanks! I had no idea about that; was previously just using current to access current.T(). Anyway, if you change this does it work Thanks, Leonel. The suggested changes didn't fix it,

[web2py] Re: Image not showing: NetworkError: 404 NOT FOUND

2014-10-18 Thread Spokes
I've tried the following: def download(): print \ndb.tables:, db.tables print \ndb.tables fields:, db['t_image'].fields return response.download(request,db) It does show that t_image is part of the db definition, and that all the fields that should be there are present. On

[web2py] Re: Image not showing: NetworkError: 404 NOT FOUND

2014-10-18 Thread Spokes
Tried the approach of adding the table in the modules as well; it didn't produce any change in the results. Any other possibilities for what could be going on? Could it be a windows filesystem issue (although I've got uploads with more unwieldy names associated with other tables)? On

[web2py] Changing order of auth_user fields

2014-10-17 Thread Spokes
I've added a middle name field to *auth_user* by doing the following: auth.settings.extra_fields['auth_user']= [ Field('middle_name', type = string, length = 16, label = current.T('Middle Name'))] This means that when a form is automatically generated from *auth_user, *the order of the

[web2py] Password protect entire site?

2014-10-08 Thread Spokes
Individual views can be password protected with decorators, but I was wondering if there's a quick and convenient way to password-protect an entire web2py site. My intention is to only give access to people involved in the site's development. Thank you. -- Resources: - http://web2py.com -

[web2py] Re: Password protect entire site?

2014-10-08 Thread Spokes
Yeah, seems like that should do it. Thanks, Lionel! On Wednesday, October 8, 2014 10:04:34 AM UTC-5, Leonel Câmara wrote: Well the easiest way is to just do like appadmin does and defer that job to admin which already does it. Something like this in your models: import gluon.fileutils

[web2py] Re: Password protect entire site?

2014-10-08 Thread Spokes
provide access to users who should not have complete admin app privileges. Anthony On Wednesday, October 8, 2014 10:06:36 AM UTC-4, Spokes wrote: Individual views can be password protected with decorators, but I was wondering if there's a quick and convenient way to password-protect

[web2py] Changing a thumbnail's folder when using SMARTHUMB?

2014-09-13 Thread Spokes
I have a DB table which stores information for an image upload and a corresponding thumbnail image file. The table is defined something like this: db.define_table('t_image', ... Field('f_image', type='upload', # image field

[web2py] Re: Moving a file (upload) from one table to another

2014-09-01 Thread Spokes
, Spokes wrote: I have two tables, *t_image2* and *t_image1*, and I would like to copy an image (type: 'upload') from* t_image2* to *t_image1*.The tables are something like the following: db.define_table('t_image2', ... Field('name', requires=[IS_NOT_EMPTY(), IS_NOT_IN_DB(db

[web2py] Moving a file (upload) from one table to another

2014-08-31 Thread Spokes
I have two tables, *t_image2* and *t_image1*, and I would like to copy an image (type: 'upload') from* t_image2* to *t_image1*.The tables are something like the following: db.define_table('t_image2', ... Field('name', requires=[IS_NOT_EMPTY(), IS_NOT_IN_DB(db, 't_image2.name' )],

[web2py] Re: Moving a file (upload) from one table to another

2014-08-31 Thread Spokes
. On Sunday, August 31, 2014 11:29:44 AM UTC-5, Niphlod wrote: when you deal with upload fields, you should use the proper method (i.e. store()) http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#More-on-uploads On Sunday, August 31, 2014 2:52:45 PM UTC+2, Spokes wrote

[web2py] Re: Another multiple file upload and file drop area demo, this time using dropzone.js

2014-08-11 Thread Spokes
Thanks - looking forward to the updates! On Saturday, August 9, 2014 9:27:56 PM UTC-5, Massimo Di Pierro wrote: In the near future we may have a smarter mechanism for this On Saturday, 9 August 2014 15:46:49 UTC-5, Spokes wrote: Thanks, Massimo. I wasn't aware of that. Looks like I

[web2py] Re: Another multiple file upload and file drop area demo, this time using dropzone.js

2014-08-09 Thread Spokes
Thank you for the demo. However, I'm curious as to why it's necessary to use uploadseparate=True for the upload fields in the db table. Is there a way to get this to function with uploadseparate=False instead? If not, is there a convenient, automatic way, when a file and its thumbnail are

[web2py] Re: Another multiple file upload and file drop area demo, this time using dropzone.js

2014-08-09 Thread Spokes
uploadseparate. It should have been the default option but it is not for backward compatibility. On Saturday, 9 August 2014 09:18:11 UTC-5, Spokes wrote: Thank you for the demo - very useful! It would be fantastic if there were a web2py module or feature that implements this sort of functionality

[web2py] Submitting multiple ajax-generated forms with a single button?

2014-08-07 Thread Spokes
I have a page in which multiple forms may be submitted. * the main/primary form (which is mandatory) is generated with SQLFORM and is always present on the page (i.e. it is generated server-side when the page is loaded) * additional forms may be added to upload images. These forms are

[web2py] Replacing target with ajax?

2014-08-07 Thread Spokes
Web2py's ajax call replaces the content of a target div when used with a target, rather than with ':eval'. What's the best way, using the ajax call, to replace the target itself, rather than replacing the content of the target? Thank you. -- Resources: - http://web2py.com -

[web2py] Re: Replacing target with ajax?

2014-08-07 Thread Spokes
Thanks, Anthony. On Thursday, August 7, 2014 3:28:43 PM UTC-5, Anthony wrote: Put the target inside a DIV and make the outer DIV the new target. Or use ':eval' to do the replacing with JavaScript. Anthony On Thursday, August 7, 2014 9:00:50 PM UTC+2, Spokes wrote: When a target

[web2py] Somewhat confused about the way session is updated when using ajax

2014-08-06 Thread Spokes
I've got a page in which ajax is used to update the main content (a bunch of articles), and a variable stored in session is used as an index (let's say there are X articles per page, and the first article shown corresponds to the current index). Regardless of how far the user has scrolled, the

[web2py] Re: Somewhat confused about the way session is updated when using ajax

2014-08-06 Thread Spokes
, Spokes wrote: I've got a page in which ajax is used to update the main content (a bunch of articles), and a variable stored in session is used as an index (let's say there are X articles per page, and the first article shown corresponds to the current index). Regardless of how far the user

[web2py] Re: Somewhat confused about the way session is updated when using ajax

2014-08-06 Thread Spokes
that is being updated by your Ajax call. Anthony On Wednesday, August 6, 2014 6:14:27 PM UTC+2, Spokes wrote: I've got a page in which ajax is used to update the main content (a bunch of articles), and a variable stored in session is used as an index (let's say there are X articles per page

[web2py] Re: Somewhat confused about the way session is updated when using ajax

2014-08-06 Thread Spokes
, as the session files are locked in that case, which serializes all requests (including ajax requests). Anthony On Wednesday, August 6, 2014 9:30:30 PM UTC+2, Spokes wrote: I've been looking into it, and it appears that there is a race condition situation going on, in which it takes a little while

[web2py] Re: Is there a web2py plugin which lays out divs in a neat grid?

2014-06-13 Thread Spokes
let me know, I'll try to help you out. On Thursday, June 12, 2014 6:40:41 PM UTC-7, Spokes wrote: Thanks, Derek. I'd like to not animate at all, and I've adjusted freewall's settings accordingly, to no avail. The animation effect only happens under particular circumstances (i.e. when

[web2py] Re: Is there a web2py plugin which lays out divs in a neat grid?

2014-06-12 Thread Spokes
Thanks, Derek. I'd like to not animate at all, and I've adjusted freewall's settings accordingly, to no avail. The animation effect only happens under particular circumstances (i.e. when the page is updated with an ajax call, rather than refreshed or loaded through a link), which makes me

[web2py] Re: Is there a web2py plugin which lays out divs in a neat grid?

2014-06-10 Thread Spokes
the heights of these div cells within the controller? On Tuesday, June 10, 2014 1:02:15 PM UTC-5, Derek wrote: There's nothing preventing you from using freewall. What troubles have you had with it? On Monday, June 9, 2014 10:41:46 AM UTC-7, Spokes wrote: Is anyone aware of a web2py plugin which

[web2py] Re: Determining the height or width of an HTML object before it is rendered?

2014-06-10 Thread Spokes
(and you can't compare yourself with Apple plus Microsoft plus Mozilla Foundation plus Google plus Opera engineers)). On Tuesday, June 10, 2014 1:11:58 AM UTC+2, Spokes wrote: What was the problem with the approach mentioned above? Anyway, here is what I was trying to do: my page has a bunch

[web2py] Is there a web2py plugin which lays out divs in a neat grid?

2014-06-09 Thread Spokes
Is anyone aware of a web2py plugin which can take a bunch of divs (let's say, of the same class name) and lay them out, in sequence, in a neat grid? I'm looking for something like the following jquery plugin: http://vnjs.net/www/project/freewall/. Thank you. -- Resources: -

[web2py] Determining the height or width of an HTML object before it is rendered?

2014-06-09 Thread Spokes
Is there a server-side way in web2py to determine the height or width of an HTML object, as it would be rendered by the browser, if the object's height, width, and style have not been explicitly assigned (i.e. the height may be dependent on inner HTML objects/content)? Thanks. -- Resources: -

[web2py] Re: Determining the height or width of an HTML object before it is rendered?

2014-06-09 Thread Spokes
What was the problem with the approach mentioned above? Anyway, here is what I was trying to do: my page has a bunch of divs (let's call them cells), each containing content which makes their height distinct from other cells, while the width more or less remains constant. I'd like to arrange

[web2py] Re: Uploading with SQLFORM.factory: specifying tablename component of filename

2014-06-06 Thread Spokes
): if request.vars.upload_field_name != None and not isinstance(request. vars.upload_field_name, str): return request.env.content_length On Thursday, June 5, 2014 7:46:32 PM UTC-4, Spokes wrote: When you upload a file with SQLFORM factory, the file is assigned a name along the lines

[web2py] Uploading with SQLFORM.factory: specifying tablename component of filename

2014-06-05 Thread Spokes
When you upload a file with SQLFORM factory, the file is assigned a name along the lines of no_table.[something1].[something2] If you've manually written the form validation/accept code, you can change the file name that is stored in the table by changing the form.vars.[name_of_field]

[web2py] Re: Modifying select element created from a list:reference field

2014-06-03 Thread Spokes
UTC-4, Spokes wrote: Thanks! I removed that while doing some debugging, and forgot to bring it back in - it seems to have fixed the error originating in the model. Now that that's resolved, I'm a bit confused about how to use the gallery table in the controller with SQLFORM(). If I do

[web2py] Modifying select element created from a list:reference field

2014-06-02 Thread Spokes
I have a table that contains the following field: Field('images', 'list:reference t_image'), I'd like to do the following: -make it so that the input for that field cannot be empty upon submission, and the number of references the user must select is in some range of numbers, (n_min, n_max)

[web2py] Re: Modifying select element created from a list:reference field

2014-06-02 Thread Spokes
Thanks, Anthony. I'm trying the following: Model: query_list = [(db.t_image.created_by == None)] if session.auth: query_list.append((db.t_image.created_by == session.auth.user.id)) query = reduce_db_queries(query_list, 'or') set = db.t_image.id.belongs(db(query)._select(limitby=(0,48)))

[web2py] Re: Modifying select element created from a list:reference field

2014-06-02 Thread Spokes
, Anthony wrote: Not sure if this is the only problem, but when you d do nested select, you should select only one column: set = db.t_image.id.belongs(db(query)._select(db.t_image.id, limitby=(0,48 ))) Anthony On Monday, June 2, 2014 1:56:30 PM UTC-4, Spokes wrote: Thanks, Anthony. I'm

[web2py] Re: Modifying select element created from a list:reference field

2014-06-02 Thread Spokes
2, 2014 2:50:53 PM UTC-4, Spokes wrote: I made the modification, and it's still producing the same error message. I get the impression that it has to do with *db.t_image*'s format field. Do you think that this may be the case? Any other suggestions on how to go about resolving the issue

[web2py] Fields with duplicate names not showing up in form generated by SQLFORM.factory()

2014-04-21 Thread Spokes
I'm using SQLFORM.factory() to generate a form from multiple tables, some of which have fields that have the same names as fields in other tables. In the form that's generated, the first instance of the field with the common name appears, but any subsequent instances of the field with that name

[web2py] Re: Fields with duplicate names not showing up in form generated by SQLFORM.factory()

2014-04-21 Thread Spokes
this as a limitation of using SQLFORM.factory with multiple tables. On Monday, April 21, 2014 1:56:44 PM UTC-4, Spokes wrote: I'm using SQLFORM.factory() to generate a form from multiple tables, some of which have fields that have the same names as fields in other tables. In the form that's

[web2py] 'auth.settings.register_verify_password = True' does not generate password confirmation field

2014-04-16 Thread Spokes
I am writing a custom registration form, and would like the form to contain a field in which the user has to re-enter/confirm the password they want. The new user() function contains the following lines: def user(): if request.args(0) == 'login': return dict(form = auth())