[web2py] Re: Json, Ajax, Inner Join , Group By and '_extra' revisited - code example included

2017-01-18 Thread James Burke
Thank you Brendan. 5 years later this is still an issue. I am using the pyDAL library with the bottle framework. It is very nasty to try and access the count value in JavaScript buried under, e.g. _extra.count(tagref.tag) If you just want to get rid of the _extra part, you can simple use for

[web2py] Odd behaviour with uploaded gzip file

2016-06-16 Thread James Burke
Hi, I was trying to parse the contents of a single gzipped file, but kept getting an empty file. @auth.allows_jwt() @request.restful() def log(): def POST(*args,**vars): with gzip.GzipFile(fileobj=request.vars.file.file, mode='rb') as f: test = f.readlines()

[web2py] upload file to rest service on GAE

2015-11-27 Thread James Burke
I'm having some trouble uploading/accessing a file on Google App Engine (GAE). This is the code used to store the file: @request.restful() def workspace(): def POST(*args,**vars): workspace_id = db.workspace.insert(repository=request.vars. repository,

[web2py] REST API POST Return non-dict creates an obscure error message

2015-11-21 Thread James Burke
I recently upgraded an application on Pythonanywhere.com to: Version 2.12.3-stable+timestamp.2015.08.19.00.18.03 Part of the application uses jQuery to post files to a web2py REST API. After the upgrade I noticed that I kept getting this unhelpful error 500 message: PythonAnywhere: something

[web2py] Re: New feature in trunk. bulk_register/invite

2015-10-30 Thread James Burke
Thank you Massimo. Also I just noticed the subject line variable line 1255: bulk_invite_subject='Invitation to join%(site)s’, Should be: bulk_invite_subject='Invitation to join %(site)s’, And if I may suggest exposing bulk_register_enabled in the welcome app models/dp.py file to alert

Re: [web2py] Re: CMS WEB2PY

2015-10-27 Thread James Burke
Thanks Selman. I have already begun work to put a version up on github. Hopefully I'll have something up tonight. On 27 Oct 2015 1:27 PM, "Selman Kocael" <selciu...@gmail.com> wrote: > it's nice. > > 2015-10-26 21:49 GMT+02:00 James Burke <james.burke1...@gmail.com&

[web2py] Re: CMS WEB2PY

2015-10-27 Thread James Burke
I've posted the source code of my CMS on github: https://github.com/peregrinius/web2py-liscio I migrated it onto the latest version of web2py, but there is a change on the new version which means a menu items with children is no longer clickable link. I guess this is for the benefit of

[web2py] Re: New feature in trunk. bulk_register/invite

2015-10-26 Thread James Burke
Ok I've done some testing and found a couple of typos, including, tools.py - line 3283: if not self.setting.bulk_register_enabled: should be if not self.settings.bulk_register_enabled: This results in an exception preventing the feature from working. I tried submitting a pull request

[web2py] Re: CMS WEB2PY

2015-10-26 Thread James Burke
I created a CMS a few years ago now in web2py... It is fairly basic compared to Carlos one. I have a test website for a client on GAE http://badevday-test.appspot.com/ to access the backend http://badevday-test.appspot.com/admin login: user-gr...@web2py.com password: passw0rd It doesn't

[web2py] GAE bitbucket mirror - ImportError: Cannot import module 'applications.init.modules.pydal'

2015-10-21 Thread James Burke
I've just uploaded a simple app to GAE using the bitbucket mirror. Seems odd that it is looking for pydal in an applications modules... I get the same error with versions: Version 2.12.3 & Version 2.9.12 But I don't get the error deploying from GAE Launcher Unable to store in FILE:

[web2py] Re: GAE bitbucket mirror - ImportError: Cannot import module 'applications.init.modules.pydal'

2015-10-21 Thread James Burke
Thank you for your reply Leonel. Is that a setting in Google Developers Console? I think I remember seeing it somewhere but can't recall where! -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) -

[web2py] Re: Email invite users - peer review

2015-05-29 Thread James Burke
. On Wednesday, 20 May 2015 03:12:24 UTC-5, James Burke wrote: Hi, I'm looking for a peer review of some code I put together for email inviting users to join an application. I couldn't find anything suitable looking around, hopefully I didn't overlook anything! The idea is, you enter in email

[web2py] Re: Email invite users - peer review

2015-05-28 Thread James Burke
to be tested and maintained by the developers indefinitely). Instead, maybe this could be a plugin. Anthony On Thursday, May 28, 2015 at 1:19:07 AM UTC-4, Massimo Di Pierro wrote: think this is an excellent idea. Please submit a pull request. On Wednesday, 20 May 2015 03:12:24 UTC-5, James Burke

[web2py] Re: Email invite users - peer review

2015-05-28 Thread James Burke
Will do. Thank you for your feedback. On Thursday, May 28, 2015 at 5:19:07 PM UTC+12, Massimo Di Pierro wrote: think this is an excellent idea. Please submit a pull request. On Wednesday, 20 May 2015 03:12:24 UTC-5, James Burke wrote: Hi, I'm looking for a peer review of some code I put

[web2py] Email invite users - peer review

2015-05-20 Thread James Burke
Hi, I'm looking for a peer review of some code I put together for email inviting users to join an application. I couldn't find anything suitable looking around, hopefully I didn't overlook anything! The idea is, you enter in email addresses into a form, click submit and it will send an email

[web2py] Sorting contains results based on number of matches

2015-02-26 Thread James Burke
Is there a way to sort the query below by the number of search items found in each result? def GET(*args,**vars): search = [x for x in request.vars['search'].split(' ') if len(x) 3] result = [] if search: query = db.question.heading.contains(search,

[web2py] Re: Dynamic Upload Uploadfolder

2014-12-03 Thread James Burke
Final solution was this: _tables.py def store_file(file, filename=None, path=None): path = path #applications/init/uploads if not os.path.exists(path): os.makedirs(path) pathfilename = os.path.join(path, filename) dest_file = open(pathfilename, 'wb') try:

[web2py] Re: Dynamic Upload Uploadfolder

2014-12-02 Thread James Burke
Thank you Leonel, great idea. Although I'll need to use oncreate/onupdate since I'm using a smartgrid Cheers, -James On Tuesday, December 2, 2014 10:28:49 PM UTC+13, Leonel Câmara wrote: There are lots of ways to do this, the easiest is probably to just define the uploadfolder for the

[web2py] Re: Dynamic Upload Uploadfolder

2014-12-01 Thread James Burke
the upload folder as function of something that happens after. Please explain to us in english of the folder should depend on the upload and perhaps we can suggest a way to do it. On Saturday, 29 November 2014 14:08:20 UTC-6, James Burke wrote: How do you create a dynamic uploadfolder

[web2py] Re: Dynamic Upload Uploadfolder

2014-11-30 Thread James Burke
suggest a way to do it. On Saturday, 29 November 2014 14:08:20 UTC-6, James Burke wrote: How do you create a dynamic uploadfolder for an upload Field? I tried using: uploadfolder= lambda r: db.repository(r.repository_id).directory but i get the error message, I guess it doesn't have the same

[web2py] Dynamic Upload Uploadfolder

2014-11-29 Thread James Burke
How do you create a dynamic uploadfolder for an upload Field? I tried using: uploadfolder= lambda r: db.repository(r.repository_id).directory but i get the error message, I guess it doesn't have the same functionality as compute: cannot concatenate 'str' and 'function' objects I'm also using

[web2py] Re: Is there a way to cache images from download function?

2014-01-28 Thread James Burke
Ok I tried: @cache.action(time_expire=1200, cache_model=cache.memcache, quick='SVL') def fast_download(): import time, os import contenttype as c # very basic security: if not request.args(0).startswith(file.file): return download() file_id = request.args(-1)

[web2py] Re: Is there a way to cache images from download function?

2014-01-28 Thread James Burke
I'm exploring options. I want to be able to cache my images. Client side, server side it doesn't matter. What is the best method to go about this? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) -

[web2py] Re: Is there a way to cache images from download function?

2014-01-27 Thread James Burke
Version 2.7.4-stable+timestamp.2013.10.14.15.16.29 recent enough? It's after your original post. On Tuesday, January 28, 2014 2:49:52 AM UTC+13, Niphlod wrote: probably you're not running a recent web2py release. On Saturday, January 25, 2014 9:37:12 PM UTC+1, James Burke wrote: def

[web2py] Re: Is there a way to cache images from download function?

2014-01-25 Thread James Burke
I tried using the above code, but results in the follow error message: cache.client(time_expire=604800, quick='SVL')(lambda: 0)() AttributeError: 'Cache' object has no attribute 'client' Am I missing something? Cheers -James On Monday, April 15, 2013 1:21:18 AM UTC+12, Niphlod wrote:

[web2py] Re: Weird problems generating menu from database

2014-01-21 Thread James Burke
, would it be possible to somehow incorporate that into what I have? Could you also explain why you used += instead of append? Maybe I could figure out something from that. Thanks On Tuesday, January 21, 2014 12:11:59 AM UTC-6, James Burke wrote: Hi, I managed to get one working a little

[web2py] Re: Weird problems generating menu from database

2014-01-21 Thread James Burke
You could simply declare it for testing purposes. Set it to false. -- 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

[web2py] Re: @Cache on GAE

2014-01-20 Thread James Burke
Thanks for the solution Quint, I think I've got it: _db.py - model if not request.env.web2py_runtime_gae: ## if NOT running on Google App Engine use SQLite or other DB db = DAL('sqlite://storage.sqlite', pool_size=1, migrate=True) #,check_reserved=['all'] else: ## connect to Google

[web2py] Re: Weird problems generating menu from database

2014-01-20 Thread James Burke
Hi, I managed to get one working a little while ago doing this. This has been adapted for your situation, may require some tweaking: _tables.py - model db.define_table('store_catelog') db.define_table('store_catelog', Field('title', 'string'), Field('description', 'text'),

[web2py] @Cache on GAE

2014-01-19 Thread James Burke
Hi, I'm having difficulty setting up cache on GAE. @cache(request.env.path_info, time_expire=60*60, cache_model=cache.ram) def index(): index = db(db.page.sequence==0).select(db.page.title, db.page.body, db. page.side, cacheable=True).first() return dict(index=index) Using the

[web2py] Re: @Cache on GAE

2014-01-19 Thread James Burke
I found a cache.memcache example on this page: http://web2py.com/book/default/chapter/13#Memcache from gluon.contrib.gae_memcache import MemcacheClient from gluon.contrib.memdb import MEMDB cache.memcache = MemcacheClient(request) cache.ram = cache.disk = cache.memcache

[web2py] Re: GAE - Not Working || Full Code Attached

2013-12-05 Thread James Burke
Hi Prachi, Your code works fine for me, uploading to GAE. It may be that your app.yaml file is configured incorrectly. Do you have it setup to use python 2.5 or 2.7? # use this line for Python 2.5 # #runtime: python # use these lines for Python 2.7 # upload app with: appcfg.py update web2py

Re: [web2py] Re: GAE - Not Working || Full Code Attached

2013-12-05 Thread James Burke
Hi Prachi When I ran the code the form appeared. I didn't try the form. Will do so when I get home James Burke On 6/12/2013, at 8:28 am, PRACHI VAKHARIA prachivakha...@gmail.com wrote: Dear James, First, thank you very much for the response, and taking the effort to try out

[web2py] Re: uploading files on GAE - 404 NOT FOUND

2013-12-05 Thread James Burke
share the log/stack trace from when that happens? does the form post to the same function that generated it? i have not tried upload in grid()wonder if there is something there that doesn't quite work on app engine? On Tuesday, December 3, 2013 10:49:47 AM UTC-8, James Burke wrote: Hi

[web2py] Re: GAE - Not Working || Full Code Attached

2013-12-04 Thread James Burke
Nothing looks obvious at first glance... if the ticket issued is unrecoverable then it can be that GAE hasn't created the indexes for your datastore table yet. It may be just a case of waiting a few minutes and refreshing the page. -- Resources: - http://web2py.com - http://web2py.com/book

[web2py] uploading files on GAE - 404 NOT FOUND

2013-12-03 Thread James Burke
Hi, Uploading files into my table on GAE, when I hit submit I'm presented with a 404 NOT FOUND error message. Works fine using Rocket, but not in GAE SDK or when uploaded to GAE. _tables.py - in models db.define_table('file', Field('name', unique=True, compute=lambda r:

[web2py] Re: Add extra fields to db.auth_user

2013-12-03 Thread James Burke
For problem no1, you could try using required=True instead of requires=IS_NOT_EMPTY() For your second problem you can define the auth_user table yourself (from web2py book): Another way to do this, although not really recommended, consists of defining your auth tables yourself. If a table is

[web2py] Re: LOAD Helper ajax True produces only Loading... message.

2013-11-23 Thread James Burke
That fixed it, thanks Anthony! On Sunday, November 24, 2013 2:32:24 AM UTC+13, Anthony wrote: When you upgrade, you also have to upgrade the web2py.js file (and possibly the web2py_ajax.html and appadmin files as well). Those files are in the app folder but are part of the framework.

[web2py] LOAD Helper ajax True produces only Loading... message.

2013-11-22 Thread James Burke
Hi, I've just upgraded to the latest release of web2py 2.7.4-stable+timestamp.2013.10.14.15.16.29 . Using a modified version of the Manage Users and Members slice found here: http://www.web2pyslices.com/slice/show/1542/manage-users-and-memebership-in-the-same-form My LOAD helper now only

[web2py] smartgrid linked list custom buttons

2013-10-21 Thread James Burke
Hi, I'd like to have my links to child tables in the smartgrid displayed as buttons (like view/edit/delete) rather than links. I'd also like to add icons. Is there an specific way to do this, or do I need to create them using links instead? Cheers, -James -- Resources: - http://web2py.com

[web2py] Re: smartgrid linked list custom buttons

2013-10-21 Thread James Burke
Thanks Dave. Unfortunately they didn't use the term 'buttonification' in their thread. =) -- 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

[web2py] Re: smartgrid linked list custom buttons

2013-10-21 Thread James Burke
Perhaps my question isn't very well defined. When defining a linked table in a smartgrid like so: linked_tables = dict(supply=['file']) results in: a data-w2p_disable_with=default href= /init/supply/index/supply/file.supply/64spanFiles/span/a I want it to be like this (how the view/edit/del

[web2py] Re: Google crawler error

2013-08-05 Thread James Burke
? On Saturday, August 3, 2013 9:07:45 PM UTC-7, James Burke wrote: Hi, My site seems to be working fine, but when I go onto Google Webmaster Tools there are crawler errors. So I run the Fetch as Google tool and get *Unreachable page*. Which produces the following ticket: Traceback (most recent call

[web2py] Google crawler error

2013-08-03 Thread James Burke
Hi, My site seems to be working fine, but when I go onto Google Webmaster Tools there are crawler errors. So I run the Fetch as Google tool and get *Unreachable page*. Which produces the following ticket: Traceback (most recent call last): File

[web2py] Re: linked_list dict() - local variable 'fld' referenced before assignment

2013-07-28 Thread James Burke
Playing around with it again, seems to be working now. No idea why it wasn't showing up before. On Sunday, July 28, 2013 12:34:02 PM UTC+12, James Burke wrote: Ok i got the updated code. No error anymore, but the linked tables don't appear either when linked_tables is a dict. -James

[web2py] Re: linked_list dict() - local variable 'fld' referenced before assignment

2013-07-27 Thread James Burke
Thanks for looking into this. I'm not exactly sure what 'Trunk' is. =) On Friday, July 26, 2013 8:03:32 PM UTC+12, Massimo Di Pierro wrote: There is a bug in SQLFORM.grid. I just pushed a fix to trunk. Please check it. On Thursday, 25 July 2013 20:10:52 UTC-5, James Burke wrote: Hi, I

[web2py] Re: linked_list dict() - local variable 'fld' referenced before assignment

2013-07-27 Thread James Burke
one include the fix you want to test. Massimo On Saturday, 27 July 2013 01:27:13 UTC-5, James Burke wrote: Thanks for looking into this. I'm not exactly sure what 'Trunk' is. =) On Friday, July 26, 2013 8:03:32 PM UTC+12, Massimo Di Pierro wrote: There is a bug in SQLFORM.grid. I just

[web2py] Re: linked_list dict() - local variable 'fld' referenced before assignment

2013-07-27 Thread James Burke
:48:39 UTC-5, James Burke wrote: Thank you for clarifying. I've taken the latest version off github and I'm still having issues. Works if linked_tables is a list, but not as a dict. # db model db.define_table('supply', Field('test'), format='%(test)s') db.define_table('job

[web2py] Re: linked_list dict() - local variable 'fld' referenced before assignment

2013-07-27 Thread James Burke
Ok i got the updated code. No error anymore, but the linked tables don't appear either when linked_tables is a dict. -James -- --- 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,

[web2py] linked_list dict() - local variable 'fld' referenced before assignment

2013-07-25 Thread James Burke
Hi, I just migrated my code from 2.4.6 to 2.5.1, I've encountered a problem trying to use a dict in my smartgrid with the following code: def test(): form = SQLFORM.smartgrid(db.supply, fields=dict(supply=[db.supply.id]),linked_tables =dict(supply=['job','file'])) return

[web2py] Stop menu from collapsing

2013-06-27 Thread James Burke
Hi, Is it possible to stop the menu from collapsing into a button when the window width is resized smaller? Or do I have to start from scratch. Cheers James -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group

[web2py] Re: Stop menu from collapsing

2013-06-27 Thread James Burke
Good to know. =) -- --- 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

[web2py] Re: calling custom_store and custom_retrieve using parameters

2013-04-22 Thread James Burke
Hello again, What does the autodelete function use to locate files? I seem to have broken mine. Cheers, -James On Thursday, April 11, 2013 12:01:11 PM UTC+12, James Burke wrote: Here's what I came up with. Perhaps not such a great solution, because it pigeon holes my download function

[web2py] Re: Smartgrid drop-down field orderby

2013-04-21 Thread James Burke
Thanks Anthony, although thinking about it... it might be easier just to use a date field with a date picker. -- --- 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

[web2py] Smartgrid drop-down field orderby

2013-04-20 Thread James Burke
Hi, In the edit/add page for smartgrid, I have a reference field displaying Months which are sorted alphabetically (by default). How can I sort them by id instead? Cheers, -James -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To

[web2py] Re: calling custom_store and custom_retrieve using parameters

2013-04-09 Thread James Burke
id is passed as an argument when I client on the files link. On Tuesday, April 9, 2013 2:34:35 PM UTC+12, James Burke wrote: Thanks for your swift response. I kind of understand that, but how do you get the value rather than the field name? db.define_table('file', Field('client

[web2py] Re: calling custom_store and custom_retrieve using parameters

2013-04-08 Thread James Burke
Hi Anthony, I've tried the solution you've posted below: Field('file', 'upload', custom_store=lambda file, filename, path: store_file(file, filename,path , db.table.new_filename), ...) But when my additional parameter gets sent to store_file it sends 'table.new_filename' def

[web2py] Re: calling custom_store and custom_retrieve using parameters

2013-04-08 Thread James Burke
. If you want to include an actual filename string, then that's what you have to pass to the function. Anthony On Monday, April 8, 2013 9:34:45 PM UTC-4, James Burke wrote: Hi Anthony, I've tried the solution you've posted below: Field('file', 'upload', custom_store=lambda file

[web2py] Re: calling custom_store and custom_retrieve using parameters

2013-04-08 Thread James Burke
when I client on the files link. On Tuesday, April 9, 2013 2:34:35 PM UTC+12, James Burke wrote: Thanks for your swift response. I kind of understand that, but how do you get the value rather than the field name? db.define_table('file', Field('client', 'reference client'), Field('type

[web2py] Re: Sitemap Plugin or Sitemap Generator

2013-03-26 Thread James Burke
Thanks so much for this code, it's really helpful. @BlueShadow - I keep my auth functions in a separate controller i.e. admin.py and can simply exclude this function from the list like so: if 'admin.py' in ctls: ctls.remove('admin.py') If you have functions in default.py that you wish to

[web2py] Re: How can I store upload original filename using smartgrid?

2013-03-24 Thread James Burke
Found exactly what I was after here: http://stackoverflow.com/questions/8008213/web2py-upload-with-original-filename/8185933#8185933 -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails

[web2py] How can I store upload original filename using smartgrid?

2013-03-22 Thread James Burke
I'm having trouble working this one out. I've tried using the example in the book with no success. Model: db.define_table('file', Field('client', 'reference client'), Field('file', type='upload', autodelete=True), Field('filename', 'string'), format='%(file)s') Controller: def

[web2py] Re: database locked SQLITE

2012-09-20 Thread James Burke
I was experiencing the same problem, adding db.commit() after my insert statements fixed it. --