[web2py] How to create, log-in, and delete user in auth via command line

2013-02-04 Thread Ian W. Scott
I need to create a few user accounts as testing fixtures during some unit 
tests. How can I do the following via the web2py api? 

- create a new user account using Auth
- log that new user in using Auth
- log that user out
- delete that user account (as part of test tear-down)

If I've missed this in the manual, I'd be happy just to know what pages to 
look at. So far my reading hasn't yielded anything.

To clarify, I want to do this from within a pytest test module/suite where 
I already have a web2py environment (access to current, db, etc.) but do 
not have a user logged in. (I know, by the way, that I could mock the 
users, but so many tests will use them that it will be *much* easier to 
work with functional fixtures.)

Thanks,

Ian

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: How to create, log-in, and delete user in auth via command line

2013-02-04 Thread Ian W. Scott
Ah, perfect! I don't know how I missed that section. Thanks once again, 
Massimo.

Ian

On Monday, February 4, 2013 9:34:14 AM UTC-5, Massimo Di Pierro wrote:
>
> Look into functional testing: 
> http://web2py.com/books/default/chapter/29/14?search=webclient
>
> On Monday, 4 February 2013 08:32:49 UTC-6, Ian W. Scott wrote:
>>
>> I need to create a few user accounts as testing fixtures during some unit 
>> tests. How can I do the following via the web2py api? 
>>
>> - create a new user account using Auth
>> - log that new user in using Auth
>> - log that user out
>> - delete that user account (as part of test tear-down)
>>
>> If I've missed this in the manual, I'd be happy just to know what pages 
>> to look at. So far my reading hasn't yielded anything.
>>
>> To clarify, I want to do this from within a pytest test module/suite 
>> where I already have a web2py environment (access to current, db, etc.) but 
>> do not have a user logged in. (I know, by the way, that I could mock the 
>> users, but so many tests will use them that it will be *much* easier to 
>> work with functional fixtures.)
>>
>> Thanks,
>>
>> Ian
>>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Append() multiple components to html helper

2013-05-23 Thread Ian W. Scott
Is there a way to append multiple components to an HTML helper in a single 
append() call, or do we have to use a separate append() call for each 
component?

I'm trying to append four components to a SPAN helper held in the variable 
"wrapper." I've tried it this way:

wrapper.append(new_component_1, new_component_2, new_component_3, 
new_component_4)

But the append() function seems to want only one argument. The code above 
raises an error, saying that I've submitted too many arguments.

Thanks!

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Append() multiple components to html helper

2013-05-24 Thread Ian W. Scott
Excellent. Thanks.

On Thursday, May 23, 2013 6:09:58 PM UTC-4, Anthony wrote:
>
> The .components attribute of the helper is a Python list, so you can use 
> all the standard list methods, such as .extend():
>
> wrapper.components.extend([new_component_1, new_component_2,new_component_3
> , new_component_4])
>
> Perhaps we should add an .extend() method directly to the helpers, as we 
> already have .append() and .insert().
>
> Anthony
>
>
> On Thursday, May 23, 2013 5:49:34 PM UTC-4, Ian W. Scott wrote:
>>
>> Is there a way to append multiple components to an HTML helper in a 
>> single append() call, or do we have to use a separate append() call for 
>> each component?
>>
>> I'm trying to append four components to a SPAN helper held in the 
>> variable "wrapper." I've tried it this way:
>>
>> wrapper.append(new_component_1, new_component_2, new_component_3, 
>> new_component_4)
>>
>> But the append() function seems to want only one argument. The code above 
>> raises an error, saying that I've submitted too many arguments.
>>
>> Thanks!
>>
>>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Can I have access to the LESS files that generate the welcome app css?

2013-06-17 Thread Ian W. Scott
Hi. I noticed on the forum here mention of LESS files that are used to 
generate the welcome app css but are not included in the web2py 
distribution. I'm trying to customize Bootstrap from the LESS files, and it 
would make things easier if I could have those LESS files. Is there any 
particular reason they aren't distributed?

Thanks,

Ian

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Can I have access to the LESS files that generate the welcome app css?

2013-06-17 Thread Ian W. Scott
Thanks Ales, but web2py_bootstrap.css (and maybe web2py.css) overrides some 
of those stock Bootstrap settings. I want to override some of those 
overrides (!), and this will be simplest if I have the LESS files behind 
web2py_bootstrap.css. This is assuming that I read the earlier post 
correctly, and that such LESS files do exist. 

Ian

On Monday, June 17, 2013 4:42:36 PM UTC-4, LightDot wrote:
>
> The Bootstrap version included in web2py welcome app is completely stock, 
> straight download from their page, so you can get LESS files from them. At 
> the moment, welcome app is still using Bootstrap version 2.2.2, although 
> 2.3.2 is pretty much a drop in replacement.
>
> Regards,
> Ales
>
> On Monday, June 17, 2013 9:50:16 PM UTC+2, Ian W. Scott wrote:
>>
>> Hi. I noticed on the forum here mention of LESS files that are used to 
>> generate the welcome app css but are not included in the web2py 
>> distribution. I'm trying to customize Bootstrap from the LESS files, and it 
>> would make things easier if I could have those LESS files. Is there any 
>> particular reason they aren't distributed?
>>
>> Thanks,
>>
>> Ian
>>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] How to remove test user's registration

2013-06-25 Thread Ian W. Scott
Hi again,

I'm working on returning my test db to its initial state after I run my 
unit/integration tests. I'm registering a test user just fine using the 
fantastic WebClient. But how can I remove that test user afterwards? 
(Otherwise I'll end up with my test db cluttered with redundant test users, 
created every time my test suite runs.)

Thanks ahead of time,

Ian  

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: How to remove test user's registration

2013-06-25 Thread Ian W. Scott
Ok, thanks Anthony. So what you're saying is that there's no auth method or 
anything parallel to user/register. You just remove the db.auth row 
directly.
That's simple enough.

Ian


On Tuesday, June 25, 2013 1:57:23 PM UTC-4, Ian W. Scott wrote:
>
> Hi again,
>
> I'm working on returning my test db to its initial state after I run my 
> unit/integration tests. I'm registering a test user just fine using the 
> fantastic WebClient. But how can I remove that test user afterwards? 
> (Otherwise I'll end up with my test db cluttered with redundant test users, 
> created every time my test suite runs.)
>
> Thanks ahead of time,
>
> Ian  
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Flat text files as data source for web2py

2013-06-25 Thread Ian W. Scott
I'm attracted to the spate of recent flat-file blogging platforms, using 
plain text (markdown) files to store the blog posts. I especially like the 
idea of using dropbox or a git repo to store the files. 

Has anyone experimented with this in web2py? I can imagine at least two 
ways of doing it:

1. A controller retrieves the text file at runtime based on its filename, 
parses it as necessary, and passes it through to the view. This strikes me 
as both simplest and slowest. It would bypass the web2py model structure 
altogether. It could be sped up significantly by caching pages on the 
server. 

2. A watcher of some sort (cron/scheduler job, other utility watching for 
file changes, git hook?) notices any new/changed files in the content 
directory. This triggers a call to a background process that parses the 
file and stores its content in the db. This would have the advantage of 
using a model and the associated data abstraction, and on first page access 
I assume it would be faster. But I'm not sure that the small speed-up is 
worth the extra complexity, especially if the speed is negated by 
server-side caching.

I suppose that something like 2 would have to be present in 1 anyway, since 
the system would have to recognize the presence of a new file and add it to 
the index of available posts.

Are there other approaches I'm not thinking of? Tools or libraries that 
would be useful in the process? Or do you think it's all just not worth the 
trouble?

Thanks,

Ian 

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Flat text files as data source for web2py

2013-06-26 Thread Ian W. Scott
Thanks Niphlod. I'm intrigued by the diffbook project, so I'll take a look 
at your github repo. My main interest is in streamlining my workflow (not 
just webdev, but my academic research and teaching as well) around a large 
folder of flat files that, when changed, will trigger other events (like 
publishing to a blog) automatically.

I think you're right that I've confused this kind of flat-file storage with 
static site generators like Nikola. So I'll have to think more about it.

When you suggest auth.wiki() you mean to publish text in blog format, 
right? It doesn't have anything built in to pull in text files--or does it?

Ian

On Tuesday, June 25, 2013 4:24:45 PM UTC-4, Niphlod wrote:
>
> if you want to reinvent the wheel you can play with that, but the "spate" 
> (as you describe that) is actually something that serialize into STATIC 
> webpages a somewhat fixed structure of flat files, on a given command.
>
> I actually did it for the diffbook, http://niphlod.github.io/diffbook/, 
> to use gh-pages as a hosting platform. That is a web2py application that 
> does its own processing, and then gets serialized by a script (a simple 
> wget)
>
> AFAIK, none of the recent "spates" are based on real-time 
> retrieving/recompiling blog posts.
>
> If you need that kind of "process", just use auth.wiki().
>
> On Tuesday, June 25, 2013 8:55:58 PM UTC+2, Ian W. Scott wrote:
>>
>> I'm attracted to the spate of recent flat-file blogging platforms, using 
>> plain text (markdown) files to store the blog posts. I especially like the 
>> idea of using dropbox or a git repo to store the files. 
>>
>> Has anyone experimented with this in web2py? I can imagine at least two 
>> ways of doing it:
>>
>> 1. A controller retrieves the text file at runtime based on its filename, 
>> parses it as necessary, and passes it through to the view. This strikes me 
>> as both simplest and slowest. It would bypass the web2py model structure 
>> altogether. It could be sped up significantly by caching pages on the 
>> server. 
>>
>> 2. A watcher of some sort (cron/scheduler job, other utility watching for 
>> file changes, git hook?) notices any new/changed files in the content 
>> directory. This triggers a call to a background process that parses the 
>> file and stores its content in the db. This would have the advantage of 
>> using a model and the associated data abstraction, and on first page access 
>> I assume it would be faster. But I'm not sure that the small speed-up is 
>> worth the extra complexity, especially if the speed is negated by 
>> server-side caching.
>>
>> I suppose that something like 2 would have to be present in 1 anyway, 
>> since the system would have to recognize the presence of a new file and add 
>> it to the index of available posts.
>>
>> Are there other approaches I'm not thinking of? Tools or libraries that 
>> would be useful in the process? Or do you think it's all just not worth the 
>> trouble?
>>
>> Thanks,
>>
>> Ian 
>>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Help with WebClient and Pytest

2013-06-26 Thread Ian W. Scott
I'm trying to use WebClient in a pytest suite and getting an error that I 
don't understand. I try to connect like this:

client = WebClient('http://127.0.0.1:8000/paideia/default/', postbacks=
True)
client.get('index')

But client.get('index') throws an error. The error arises in urllib2.py 
line 1184:
   
URLError: 

I assume this means that the rocket server isn't running properly. But I 
can't quite see what the problem is. I set up the test suite like this:

1. from the command-line I launch web2py in the app "paideia" and execute 
the test launcher (runtest.py) in that web2py environment:

python ~/web/web2py/web2py.py -S --ip=127.0.0.1 --port=8000 
--password=password 
paideia -M -R applications/paideia/bin/runtest.py

2. In runtest.py I call pytest programmatically:

import pytest
pytest.main(path/to/test/dir/)

3. Pytest then finds my test suite file (there's only one so far) and runs 
the test, running into the error when I try to access default/index via the 
webclient.

The strange thing is that the web2py environment seems to be there. I have 
access to current and to db. But the http connection seems to fail. 

Any help would be greatly appreciated!

Ian

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Flat text files as data source for web2py

2013-06-26 Thread Ian W. Scott
Ah, I get it. That makes sense.

On Wednesday, June 26, 2013 4:32:50 PM UTC-4, Niphlod wrote:
>
>
>
> On Wednesday, June 26, 2013 7:07:33 PM UTC+2, Ian W. Scott wrote:
>>
>> Thanks Niphlod. I'm intrigued by the diffbook project, so I'll take a 
>> look at your github repo. My main interest is in streamlining my workflow 
>> (not just webdev, but my academic research and teaching as well) around a 
>> large folder of flat files that, when changed, will trigger other events 
>> (like publishing to a blog) automatically.
>>
>> I think you're right that I've confused this kind of flat-file storage 
>> with static site generators like Nikola. So I'll have to think more about 
>> it.
>>
>> When you suggest auth.wiki() you mean to publish text in blog format, 
>> right? It doesn't have anything built in to pull in text files--or does it?
>>
>> Ian
>>
>
> Nope, it doesn't. I was suggesting that in the case you need to have an 
> actual app running that reads something and outputs the HTML every time it 
> gets hit by a request.
>
> That exactly the opposite of the blogging/generator "pattern" of most of 
> those libraries/projects that you referred to, that needs something 
> "external" (i.e. a process watching over files, you manually launching it, 
> etc etc) to trigger a rebuild that outputs the HTML one-time-only (and then 
> save it to disk and/or ship to a static hosting website)
>
> diffbook has no source-code on github: as said before it's a "frozen" 
> version of a "real" app that I freeze with wget and then ship to a static 
> hosting platform (in this case, github pages). 
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: I cannot get track_changes to work

2013-06-26 Thread Ian W. Scott
I just have this snippet as the first code (after imports) in my 
models/db.py:

from gluon.custom_import import track_changes
track_changes(True)

I don't use the condition that is recommended: 

if request.is_local:

I seem to remember having trouble when that condition was present. So I 
just remember to comment out the two lines when I move the app to 
production. (These problems may also have disappeared. It was a while ago.)

Maybe also try reloading routes (from the admin dashboard)? I'm not sure if 
that would be necessary or not.

Ian

On Wednesday, June 26, 2013 5:29:24 PM UTC-4, jc wrote:
>
> I have a model file which contains
>
> from gluon.custom_import import track_changes; track_changes(True)
>
> When I change a module file in the applications/app/modules directory, the 
> changes don't appear. I have to kill and restart web2py to get the changes.
>
> Seems a simple recipe to follow from Chapter 4 of the book. Can anybody 
> advise me what I am doing wrong?
>
> Thanks.
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Help with WebClient and Pytest

2013-06-26 Thread Ian W. Scott
Thanks, that looks really promising. I'll let you know what I come up with 
once I've had a chance to look through the repo.

Ian

On Wednesday, June 26, 2013 6:21:55 PM UTC-4, viniciusban wrote:
>
> See if something in https://github.com/viniciusban/web2py.test helps you. 
>
> On Wed, Jun 26, 2013 at 3:21 PM, Ian W. Scott 
> > 
> wrote: 
> > I'm trying to use WebClient in a pytest suite and getting an error that 
> I 
> > don't understand. I try to connect like this: 
> > 
> > client = WebClient('http://127.0.0.1:8000/paideia/default/', 
> > postbacks=True) 
> > client.get('index') 
> > 
> > But client.get('index') throws an error. The error arises in urllib2.py 
> line 
> > 1184: 
> > 
> > URLError:  
> > 
> > I assume this means that the rocket server isn't running properly. But I 
> > can't quite see what the problem is. I set up the test suite like this: 
> > 
> > 1. from the command-line I launch web2py in the app "paideia" and 
> execute 
> > the test launcher (runtest.py) in that web2py environment: 
> > 
> > python ~/web/web2py/web2py.py -S --ip=127.0.0.1 --port=8000 
> > --password=password paideia -M -R applications/paideia/bin/runtest.py 
> > 
> > 2. In runtest.py I call pytest programmatically: 
> > 
> > import pytest 
> > pytest.main(path/to/test/dir/) 
> > 
> > 3. Pytest then finds my test suite file (there's only one so far) and 
> runs 
> > the test, running into the error when I try to access default/index via 
> the 
> > webclient. 
> > 
> > The strange thing is that the web2py environment seems to be there. I 
> have 
> > access to current and to db. But the http connection seems to fail. 
> > 
> > Any help would be greatly appreciated! 
> > 
> > Ian 
> > 
> > -- 
> > 
> > --- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "web2py-users" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an 
> > email to web2py+un...@googlegroups.com . 
> > For more options, visit https://groups.google.com/groups/opt_out. 
> > 
> > 
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Problem viewing error tickets: no attribute 'lazyT_unpickle'

2013-09-18 Thread Ian W. Scott
Hi everyone,

I've suddenly started running into an error whenever I try to view error 
tickets through the admin app: 

AttributeError: 'module' object has no attribute 'lazyT_unpickle'


Any idea what is causing it? I'm running the latest stable version (2.6.3) 
on python 2.7 (Linux). The problem seems to have begun after I tried to use 
the (beta status) automatic upgrade function. It didn't work and I manually 
upgraded. I even deleted the admin app entirely and copied it fresh from 
the source download. But the error is still there. I can use every other 
part of admin, but I can't view error tickets for any installed application.

Here's the complete traceback: 

ERROR:web2py:Traceback (most recent call last):
  File "/home/ian/web/web2py/gluon/restricted.py", line 217, in restricted
exec ccode in environment
  File "/home/ian/web/web2py/applications/admin/controllers/default.py",line 
1795, in 
  File "/home/ian/web/web2py/gluon/globals.py", line 378, in 
self._caller = lambda f: f()
  File "/home/ian/web/web2py/applications/admin/controllers/default.py",line 
1446, in errors
error = pickle.load(fullpath_file)
  File "/usr/lib/python2.7/pickle.py", line 1378, in load
return Unpickler(file).load()
  File "/usr/lib/python2.7/pickle.py", line 858, in load
dispatch[key](self)
  File "/usr/lib/python2.7/pickle.py", line 1090, in load_global
klass = self.find_class(module, name)
  File "/usr/lib/python2.7/pickle.py", line 1126, in find_class
klass = getattr(mod, name)
AttributeError: 'module' object has no attribute 'lazyT_unpickle'


Thanks in advance for your help.

Ian


-- 
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/groups/opt_out.


[web2py] Some forms need to be submitted multiple times.

2013-09-18 Thread Ian W. Scott
I'm experiencing an odd problem where some of my forms (including 
registration and login forms) need to be submitted 2 or 3 times before they 
are processed. It's been hard to solve because it doesn't seem entirely 
consistent. Has anyone run into this, and does anyone have any idea what 
the cause would be?

Thanks,

Ian

-- 
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/groups/opt_out.


[web2py] Re: Some forms need to be submitted multiple times.

2013-09-20 Thread Ian W. Scott
Sorry for the slow response. I'm experiencing this with 2.6.3 but have also 
had the problem with the last couple of versions. It has been the kind of 
thing that I keep putting off debugging because I'm not sure where to start.

Could it have to do with the way I'm extending the auth_user table? In my 
db.py I have

auth = Auth(db, hmac_key=Auth.get_or_create_key())  # authent/authorization

#adding custom field for user time zone
auth.settings.extra_fields['auth_user'] = [
Field('time_zone',
  'string',
  default='America/Toronto',
  requires=IS_IN_SET((common_timezones)),
  widget=SQLFORM.widgets.options.widget
  )
]

Although I'm able to use the data from that field without any trouble.

Ian

On Wednesday, September 18, 2013 12:41:19 PM UTC-4, Massimo Di Pierro wrote:
>
> Which version?
>
> On Wednesday, 18 September 2013 10:15:46 UTC-5, Ian W. Scott wrote:
>>
>> I'm experiencing an odd problem where some of my forms (including 
>> registration and login forms) need to be submitted 2 or 3 times before they 
>> are processed. It's been hard to solve because it doesn't seem entirely 
>> consistent. Has anyone run into this, and does anyone have any idea what 
>> the cause would be?
>>
>> Thanks,
>>
>> Ian
>>
>

-- 
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/groups/opt_out.


[web2py] Re: Problem viewing error tickets: no attribute 'lazyT_unpickle'

2013-09-20 Thread Ian W. Scott
Ah, yes that may be it. Would that cause the error I'm getting?

On Wednesday, September 18, 2013 12:40:58 PM UTC-4, Massimo Di Pierro wrote:
>
> Are you using web2py 2.6.x to view a ticket created by a previous version?
>
> On Wednesday, 18 September 2013 09:58:20 UTC-5, Ian W. Scott wrote:
>>
>> Hi everyone,
>>
>> I've suddenly started running into an error whenever I try to view error 
>> tickets through the admin app: 
>>
>> AttributeError: 'module' object has no attribute 'lazyT_unpickle'
>>
>>
>> Any idea what is causing it? I'm running the latest stable version 
>> (2.6.3) on python 2.7 (Linux). The problem seems to have begun after I 
>> tried to use the (beta status) automatic upgrade function. It didn't work 
>> and I manually upgraded. I even deleted the admin app entirely and copied 
>> it fresh from the source download. But the error is still there. I can use 
>> every other part of admin, but I can't view error tickets for any installed 
>> application.
>>
>> Here's the complete traceback: 
>>
>> ERROR:web2py:Traceback (most recent call last):
>>   File "/home/ian/web/web2py/gluon/restricted.py", line 217, inrestricted
>> exec ccode in environment
>>   File "/home/ian/web/web2py/applications/admin/controllers/default.py",line 
>> 1795, in 
>>   File "/home/ian/web/web2py/gluon/globals.py", line 378, in 
>> self._caller = lambda f: f()
>>   File "/home/ian/web/web2py/applications/admin/controllers/default.py",line 
>> 1446, in errors
>> error = pickle.load(fullpath_file)
>>   File "/usr/lib/python2.7/pickle.py", line 1378, in load
>> return Unpickler(file).load()
>>   File "/usr/lib/python2.7/pickle.py", line 858, in load
>> dispatch[key](self)
>>   File "/usr/lib/python2.7/pickle.py", line 1090, in load_global
>> klass = self.find_class(module, name)
>>   File "/usr/lib/python2.7/pickle.py", line 1126, in find_class
>> klass = getattr(mod, name)
>> AttributeError: 'module' object has no attribute 'lazyT_unpickle'
>>
>>
>> Thanks in advance for your help.
>>
>> Ian
>>
>>
>>

-- 
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/groups/opt_out.


[web2py] Re: Some forms need to be submitted multiple times.

2013-09-21 Thread Ian W. Scott
Thanks Niphlod. I submit the form and get back the same form, empty. It's 
as if the submitted data is just dumped and the page reloads as if nothing 
had been sent.

I'll try the replacement you suggest and get back to you.

Ian

On Friday, September 20, 2013 5:12:35 PM UTC-4, Niphlod wrote:
>
> I can't replicate it  but 1st thing to debug: remove that requires and 
> replace with a requires=IS_IN_SET(('America/Toronto')) ... 
>
> BTW: "submitting 2 or 3 times" what means exactly? that you put email and 
> password and you hit submit and you get back an error, the same login form, 
> the login form empty,  (fill the blanks :-P) ?
>
> On Friday, September 20, 2013 10:26:39 PM UTC+2, Ian W. Scott wrote:
>>
>> Sorry for the slow response. I'm experiencing this with 2.6.3 but have 
>> also had the problem with the last couple of versions. It has been the kind 
>> of thing that I keep putting off debugging because I'm not sure where to 
>> start.
>>
>> Could it have to do with the way I'm extending the auth_user table? In my 
>> db.py I have
>>
>> auth = Auth(db, hmac_key=Auth.get_or_create_key())  # 
>> authent/authorization
>>
>> #adding custom field for user time zone
>> auth.settings.extra_fields['auth_user'] = [
>> Field('time_zone',
>>   'string',
>>   default='America/Toronto',
>>   requires=IS_IN_SET((common_timezones)),
>>   widget=SQLFORM.widgets.options.widget
>>   )
>> ]
>>
>> Although I'm able to use the data from that field without any trouble.
>>
>> Ian
>>
>> On Wednesday, September 18, 2013 12:41:19 PM UTC-4, Massimo Di Pierro 
>> wrote:
>>>
>>> Which version?
>>>
>>> On Wednesday, 18 September 2013 10:15:46 UTC-5, Ian W. Scott wrote:
>>>>
>>>> I'm experiencing an odd problem where some of my forms (including 
>>>> registration and login forms) need to be submitted 2 or 3 times before 
>>>> they 
>>>> are processed. It's been hard to solve because it doesn't seem entirely 
>>>> consistent. Has anyone run into this, and does anyone have any idea what 
>>>> the cause would be?
>>>>
>>>> Thanks,
>>>>
>>>> Ian
>>>>
>>>

-- 
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/groups/opt_out.


[web2py] Get return value from controller function via ajax

2016-01-20 Thread Ian W. Scott
I'm trying to use ajax calls to update the data for a chart dynamically. I 
don't want to make the chart a component that refreshes, I just want to get 
the controller return value back to the javascript in the view, so that I 
can update the chart via javascript. But web2py's ajax function seems to 
only (a) update a part of the page html, or (b) send page data to the 
controller for use in the back-end. There doesn't seem to be any way to get 
the controller's return value as a data object for the javascript to use.

I've tried just using jquery's get() method like this:

$.get(my_controller_url, function(data){
console.log('got ajax data', data);
});

But if the controller's return value is a tuple there seems to be no data 
sent back, or at least I don't know how to access it from the 'data' 
variable in this example. If I make the controller a dictionary I get html 
back. But I don't want html. I just want the data.

So how can I do this?

-- 
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: Get return value from controller function via ajax

2016-01-20 Thread Ian W. Scott
Thanks. So to clarify, if I serialize the return value as json in the 
controller, then I can use it in javascript. It looks like I still have to 
parse the json on the javascript end (like $.parseJSON(mydata)) but it 
works like a charm.

Ian

On Wednesday, January 20, 2016 at 2:50:35 PM UTC-5, Niphlod wrote:
>
> from gluon.serializers import json
>
> def uh():
> return json(blablabla)
>
> On Wednesday, January 20, 2016 at 8:45:55 PM UTC+1, Ian W. Scott wrote:
>>
>> I'm trying to use ajax calls to update the data for a chart dynamically. 
>> I don't want to make the chart a component that refreshes, I just want to 
>> get the controller return value back to the javascript in the view, so that 
>> I can update the chart via javascript. But web2py's ajax function seems to 
>> only (a) update a part of the page html, or (b) send page data to the 
>> controller for use in the back-end. There doesn't seem to be any way to get 
>> the controller's return value as a data object for the javascript to use.
>>
>> I've tried just using jquery's get() method like this:
>>
>> $.get(my_controller_url, function(data){
>> console.log('got ajax data', data);
>> });
>>
>> But if the controller's return value is a tuple there seems to be no data 
>> sent back, or at least I don't know how to access it from the 'data' 
>> variable in this example. If I make the controller a dictionary I get html 
>> back. But I don't want html. I just want the data.
>>
>> So how can I do this?
>>
>

-- 
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: Get return value from controller function via ajax

2016-01-21 Thread Ian W. Scott
Ah, thanks Anthony. I didn't realize that the third argument in the ajax()
function was that flexible. That helps.

Ian

On Wed, Jan 20, 2016 at 4:45 PM, Anthony  wrote:

> Additionally, if you still want to use the ajax() function, the third
> argument can be ":eval", in which case, you can return some Javascript code
> to be executed when the response is returned. Alternatively, the third
> argument can be an actual Javascript function, in which case, the returned
> value will be passed to that function.
>
> Anthony
>
>
> On Wednesday, January 20, 2016 at 4:20:22 PM UTC-5, Ian W. Scott wrote:
>>
>> Thanks. So to clarify, if I serialize the return value as json in the
>> controller, then I can use it in javascript. It looks like I still have to
>> parse the json on the javascript end (like $.parseJSON(mydata)) but it
>> works like a charm.
>>
>> Ian
>>
>> On Wednesday, January 20, 2016 at 2:50:35 PM UTC-5, Niphlod wrote:
>>>
>>> from gluon.serializers import json
>>>
>>> def uh():
>>> return json(blablabla)
>>>
>>> On Wednesday, January 20, 2016 at 8:45:55 PM UTC+1, Ian W. Scott wrote:
>>>>
>>>> I'm trying to use ajax calls to update the data for a chart
>>>> dynamically. I don't want to make the chart a component that refreshes, I
>>>> just want to get the controller return value back to the javascript in the
>>>> view, so that I can update the chart via javascript. But web2py's ajax
>>>> function seems to only (a) update a part of the page html, or (b) send page
>>>> data to the controller for use in the back-end. There doesn't seem to be
>>>> any way to get the controller's return value as a data object for the
>>>> javascript to use.
>>>>
>>>> I've tried just using jquery's get() method like this:
>>>>
>>>> $.get(my_controller_url, function(data){
>>>> console.log('got ajax data', data);
>>>> });
>>>>
>>>> But if the controller's return value is a tuple there seems to be no
>>>> data sent back, or at least I don't know how to access it from the 'data'
>>>> variable in this example. If I make the controller a dictionary I get html
>>>> back. But I don't want html. I just want the data.
>>>>
>>>> So how can I do this?
>>>>
>>> --
> 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/4gSYo-Th4vw/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.
>



-- 
Ian W. Scott, PhD (McMaster RS)
Associate Professor of New Testament
Tyndale Seminary
Toronto, Ontario, Canada
http://www.ian-w-scott.com

*Paul's Way of Knowing: Story, Experience and the Spirit* (WUNT II/205;
Tübingen: Mohr Siebeck, 2006/Grand Rapids: Baker Academic, 2008).

*The Online Critical Pseudepigrapha* (Atlanta: Society of Biblical
Literature, 2006-). Online: http://www.purl.org/net/ocp.

-- 
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] Old field value returns in custom select widget

2016-02-18 Thread Ian W. Scott
I've got a custom select widget class that is working nicely except that 
when I submit a form via ajax the refreshed widget shows the old 
(pre-submission) field value. But the changes have been made properly to 
the database. If I refresh the page containing the form (not via ajax) the 
new correct value appears. It's just when the field is refreshed after ajax 
submission that the old value re-appears. To be clear, I

1. change the value for a field using my select widget
2. submit the form via ajax (preserving the values normally)
3. when the form refreshes my select widget shows the original (wrong) value
4. I refresh the whole page and the select widget now shows the changed 
(correct) value

I set up the widget (called AjaxSelect) like this:

db.lemmas.extra_tags.widget = lambda field, value: AjaxSelect(field, value,

 indx=1, 
multi='basic', lister='simple', orderby='tag'

 
).widget()

I can't see where the problem is in my own code because the wrong value is 
received right when the AjaxSelect class is instantiated. There's obviously 
something about the process of preserving form values that I don't 
understand.

Thanks,

Ian

-- 
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: Old field value returns in custom select widget

2016-02-18 Thread Ian W. Scott
Okay, that explains the behaviour. How, then, are values usually preserved 
on an ajax form for the built-in widgets? When I submit the form all of the 
other fields (not using my widget) preserve the newly submitted values.

Ian

On Thursday, February 18, 2016 at 3:51:59 PM UTC-5, Anthony wrote:
>
> Hard to say without seeing more code, but note that the widgets are 
> constructed before any database IO, so any database changes from the 
> current submission will not be reflected in the returned copy of the form.
>
> Anthony
>
> On Thursday, February 18, 2016 at 3:40:32 PM UTC-5, Ian W. Scott wrote:
>>
>> I've got a custom select widget class that is working nicely except that 
>> when I submit a form via ajax the refreshed widget shows the old 
>> (pre-submission) field value. But the changes have been made properly to 
>> the database. If I refresh the page containing the form (not via ajax) the 
>> new correct value appears. It's just when the field is refreshed after ajax 
>> submission that the old value re-appears. To be clear, I
>>
>> 1. change the value for a field using my select widget
>> 2. submit the form via ajax (preserving the values normally)
>> 3. when the form refreshes my select widget shows the original (wrong) 
>> value
>> 4. I refresh the whole page and the select widget now shows the changed 
>> (correct) value
>>
>> I set up the widget (called AjaxSelect) like this:
>>
>> db.lemmas.extra_tags.widget = lambda field, value: AjaxSelect(field, 
>> value,
>> 
>>  indx=1, 
>> multi='basic', lister='simple', orderby='tag'
>>  
>> 
>> ).widget()
>>
>> I can't see where the problem is in my own code because the wrong value 
>> is received right when the AjaxSelect class is instantiated. There's 
>> obviously something about the process of preserving form values that I 
>> don't understand.
>>
>> Thanks,
>>
>> Ian
>>
>

-- 
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: Old field value returns in custom select widget

2016-02-18 Thread Ian W. Scott
The code is very extensive (it's a complex widget) so first I'm just trying 
to understand what happens in a normal form. You say that other widgets 
aren't preserving values from the db. So where do the values come from if 
you have keepvalues=True?

Also, this *is* a situation where an existing record is loaded into the 
form, then modified on form submission. So how does the form present to me 
the values I just changed if it's not coming from the db? I think if I can 
understand how that works I'll be able to solve the problem in my code 
myself.

Thanks,

Ian

On Thursday, February 18, 2016 at 4:06:06 PM UTC-5, Anthony wrote:
>
> On Thursday, February 18, 2016 at 3:54:43 PM UTC-5, Ian W. Scott wrote:
>>
>> Okay, that explains the behaviour. How, then, are values usually 
>> preserved on an ajax form for the built-in widgets? When I submit the form 
>> all of the other fields (not using my widget) preserve the newly submitted 
>> values.
>>
>
> Again, hard to say what's going on in your case without seeing any code, 
> but the other widgets are not presenting values from the database (unless a 
> pre-existing record has been loaded).
>
> 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: Old field value returns in custom select widget

2016-02-19 Thread Ian W. Scott
t = self.create_widget()
refreshlink = self.make_refresher(self.wrappername, self.linktable,
  self.uargs, self.uvars)
adder, modal = self.make_adder(self.wrappername, self.linktable)
wrapper.components.extend([widget, refreshlink, adder])

# create and add tags/links if multiple select widget
if self.multi and (self.lister == 'simple'):
taglist = self.make_taglist()
elif self.multi and (self.lister == 'editlinks'):
taglist = self.make_linklist()
else:
taglist = ''
wrapper.append(taglist)

return wrapper, modal

def create_widget(self):
"""
create either a single select widget or multiselect widget
"""
if not self.multi in [None, False, 'False']:
if self.orderby:
w = FilteredMultipleOptionsWidget.widget(self.field, self.
value,
 orderby=self.orderby,
 multiple='multiple')
else:
w = MultipleOptionsWidget.widget(self.field, self.value)
#place selected items at end of sortable select widget
if self.sortable:
try:
for v in self.value:
opt = w.element(_value=v)
i = w.elements().index(opt)
w.append(opt)
del w[i - 1]
except AttributeError, e:
if type(v) == 'IntType':
opt = w.element(_value=self.value)
i = w.elements().index(opt)
            w.append(opt)
del w[i - 1]
else:
print e
except Exception, e:
print e, type(e)
else:
if self.orderby:
w = FilteredOptionsWidget.widget(self.field, self.value,
 orderby=self.orderby)
else:
w = OptionsWidget.widget(self.field, self.value)

w['_id'] = '{}_{}'.format(self.fieldset[0], self.fieldset[1])
w['_name'] = self.fieldset[1]
return w








On Thursday, February 18, 2016 at 8:33:23 PM UTC-5, Anthony wrote:
>
> When you pass a record to SQLFORM, it retains the changed values by 
> passing the values in request.post_vars to the respective field widgets. 
> Can't say what's going on in your case without the code.
>
> Anthony
>
> On Thursday, February 18, 2016 at 4:13:23 PM UTC-5, Ian W. Scott wrote:
>>
>> The code is very extensive (it's a complex widget) so first I'm just 
>> trying to understand what happens in a normal form. You say that other 
>> widgets aren't preserving values from the db. So where do the values come 
>> from if you have keepvalues=True?
>>
>> Also, this *is* a situation where an existing record is loaded into the 
>> form, then modified on form submission. So how does the form present to me 
>> the values I just changed if it's not coming from the db? I think if I can 
>> understand how that works I'll be able to solve the problem in my code 
>> myself.
>>
>> Thanks,
>>
>> Ian
>>
>> On Thursday, February 18, 2016 at 4:06:06 PM UTC-5, Anthony wrote:
>>>
>>> On Thursday, February 18, 2016 at 3:54:43 PM UTC-5, Ian W. Scott wrote:
>>>>
>>>> Okay, that explains the behaviour. How, then, are values usually 
>>>> preserved on an ajax form for the built-in widgets? When I submit the form 
>>>> all of the other fields (not using my widget) preserve the newly submitted 
>>>> values.
>>>>
>>>
>>> Again, hard to say what's going on in your case without seeing any code, 
>>> but the other widgets are not presenting values from the database (unless a 
>>> pre-existing record has been loaded).
>>>
>>> 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] Change 'working...' message in ajax links

2014-03-18 Thread Ian W. Scott
I want to change the default 'working...' message presented in an ajax link 
while it is waiting for the callback to return. I couldn't find anything 
about this in the web2py manual, but looking in web2py.js it looks like the 
message can be overridden by setting the data-disable-with value on the 
link, e.g.:

myargs = {'data-disable-with': IMG(_src='coolspinner.gif')}
A('mylink', _href=URL('some', 'view'), **myargs)

(I believe the indirect insertion of the data-disable-with property is 
necessary because of the hyphens in the property name.)

But how would I change the default for all of my ajax links? Obviously I 
can just change line 474 of web2py.js, but that's a bit fragile because 
when I update my app with new versions of that file there's the risk of 
regression. So is there any way of setting this default value, say in 
db.py, for the whole app? If not, is this something we could add to the 
api? I suspect it's something that many will want to tweak to fit their own 
themes.

On a similar note, is there a way to set a custom default value for the 
'content' property of the LOAD helper? (Again, I'd like to set the new 
default in one place for the whole app.) I suppose I could subclass the 
LOAD helper, but that seems a bit heavy-handed. 

Thanks,

Ian

-- 
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: Bootstrap3 package - help to test

2014-03-18 Thread Ian W. Scott
Although I'm replying late, I just want to say a huge "thanks" for tackling 
this. It's something I've wanted to get to for a few months, and it's great 
to see that I don't have to start from scratch. If there was an initial 
lack of response I suspect it's just that many people like me happened to 
miss the thread.

Kudos.

On Wednesday, January 15, 2014 6:10:25 PM UTC-5, LightDot wrote:
>
> Hm. I expected a flurry of responses by now. I haven't been able to work 
> on this since Christmas, but... come on, anyone?? :) I would think a 
> possibility of Bootstrap 3 and Zorb Foundation 5 welcome apps would draw 
> crowds...
>
> Anyway, layout.html:
> - web2py.css needs minor adjustments as there are no .main, .footer, 
> .footer-content and .header in layout anymore (btw, .push is also obsolete, 
> it disappeared almost 2 years ago, when skeleton.css was replaced by 
> bootstrap)
> - I did not test this part, but changes in regards to modernizr.custom.js 
> and respond.js seem appropriate. I would suggest a free CDN instead of 
> maxcdn.com, though. How about 
> cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.js ? We could 
> suggest the same for Modernizr (
> cdnjs.cloudflare.com/ajax/libs/modernizr/2.7.1/modernizr.min.js) and 
> remove it from static/js
>
> web2py-bootstrap3.css, web2py-bootstrap3.js, bootstrap3.py:
> - I see no issues so far, admittedly my tests were in no way extensive
>
> licenses:
> - IANAL, so this being my personal and layman opinion, chosen licenses 
> seem correct for all intended purposes.
>
> I'll try and do more tests soon.
>
> Regards
>
>
> On Monday, December 23, 2013 9:20:48 PM UTC+1, Paolo Caruccio wrote:
>>
>> I just completed a package that applies the bootstrap3 style to some 
>> web2py elements - the current version covers the navigation menus, the auth 
>> navbar and SQLFORMs (via formstyle) - but I need your help for testing it.
>>
>> The package includes the following files:
>>
>>  - bootstrap3.py
>>  - web2py-bootstrap3.css
>>  - web2py-bootstrap3.js
>>  - example of layout.html
>>  - a readme file containing the istallation and usage instructions
>>  - license (please report if the license is right for a future inclusion 
>> in web2py)
>>
>> Here attached some screenshots and a web2py app with examples. 
>>
>> Thank you in advance for your feedbacks, suggestions for optimizing the 
>> code and any additions and everything else useful to improve the package.
>>
>> Marry Christmas. 
>>
>>

-- 
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 migrate to UUID references in db without messing up reference fields

2014-05-14 Thread Ian W. Scott
I need to take an existing db and implement a UUID referencing system so 
that I can sync local db's with a central remote version. But I'm concerned 
that this will break reference fields that refer to the newly synced rows.

My understanding is that the UUID field is necessary because a csv import 
will assign different row ids to the new entries in the target db than the 
ones they had in the source db (especially if new records have been added 
to the target db in the meantime). The UUID is supposed to overcome this, 
by allowing the db to recognize that rows are equivalent even if they have 
different ids. But in that case, won't reference fields in other tables 
often be pointing to the wrong ID number in the target db? (i.e., they'll 
keep the row ID of the db version in which they were created, and if this 
ID changes in the target db they will then be referencing a different 
record.)

Sorry if this explanation is overly complicated. I'm just trying to get 
things clear in my own mind.

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 migrate to UUID references in db without messing up reference fields

2014-05-23 Thread Ian W. Scott
After 10 days I've received no help on this. Is there something about the 
question that is inappropriate?

On Wednesday, May 14, 2014 11:44:43 AM UTC-4, Ian W. Scott wrote:
>
> I need to take an existing db and implement a UUID referencing system so 
> that I can sync local db's with a central remote version. But I'm concerned 
> that this will break reference fields that refer to the newly synced rows.
>
> My understanding is that the UUID field is necessary because a csv import 
> will assign different row ids to the new entries in the target db than the 
> ones they had in the source db (especially if new records have been added 
> to the target db in the meantime). The UUID is supposed to overcome this, 
> by allowing the db to recognize that rows are equivalent even if they have 
> different ids. But in that case, won't reference fields in other tables 
> often be pointing to the wrong ID number in the target db? (i.e., they'll 
> keep the row ID of the db version in which they were created, and if this 
> ID changes in the target db they will then be referencing a different 
> record.)
>
> Sorry if this explanation is overly complicated. I'm just trying to get 
> things clear in my own mind.
>
> 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.


Re: [web2py] How to migrate to UUID references in db without messing up reference fields

2014-05-24 Thread Ian W. Scott
Thanks, Phil. I think you've understood my problem fairly well. If I'm 
unclear it's partly because I'm new to db mechanics, but I'll try to lay 
things out more clearly:

My existing setup:

   - I have two existing instances of the same web2py application
   - Currently the models just use web2py's native ID for referencing.
   - I have a lot of *existing* records with reference fields that use 
   those ID numbers. 
   - my back-end is sqlite

My goal:

   - I need to set up a way to synchronize the database information between 
   the two instances (not just replicate an identical db instance).
   - It is quite likely that different data may be created in *both* 
   instances between synchronizations.

My partial solution:

   - I wanted to allow either instance to draw in new (or updated) data 
   from the other via a csv file (generated by the other instance).
   - I was focusing on this approach because it's the only one suggested in 
   the web2py manual for syncing db instances.
   - Adding a UUID field to the existing model would allow me to recognize 
   duplicate records accurately.

My problem with this solution:

   - I have a whole lot of reference fields in multiple tables that use the 
   current ID numbers. When I start syncing based on UUID, these ID references 
   will be broken on one or the other app instance.

Possible workarounds?

   1. I could follow the approach in the web2py manual (UUID fields, csv as 
   the vehicle for getting new data) and migrate all of my reference fields to 
   use the UUID field instead of ID. I'm a bit nervous about the potential for 
   data corruption and errors in executing such a large-scale migration with 
   my own migration script. This would also mean my reference fields are (as 
   you say) only enforced at the web2py level, not at the db (sqlite) level. I 
   think it would also limit my use of web2py's model features (e.g., 
   list-reference fields would have to become simple list-string fields?).
   2. I could move the whole db to use UUIDs for the PK of each table. I 
   much prefer this idea. It sounds more elegant and would allow me to 
   continue using my current model structure (with regular reference fields, 
   list-reference fields, etc.). But I have no idea how to go about setting 
   this up, either on the sqlite end (can sqlite use UUIDs as PKs?) or on the 
   web2py end.

Any help would be greatly appreciated!

Ian


On Saturday, May 24, 2014 4:02:37 AM UTC-4, Philip Kilner wrote:
>
> Hi Ian, 
>
> I see that Massimo has answered you, but on re-reading your question I 
> wasn't clear quite what you were asking. I have an application that 
> needs to use UUIDs myself, so thought it worth jumping in. 
>
> On 14/05/14 16:44, Ian W. Scott wrote: 
> > I need to take an existing db and implement a UUID referencing system so 
> > that I can sync local db's with a central remote version. But I'm 
> > concerned that this will break reference fields that refer to the newly 
> > synced rows. 
> > 
>
> Is this an existing web2py-generated db, or a legacy db? Am assuming the 
> former, but tell me if I'm wrong... 
>
> Do you have existing ID fields which you wish to /convert/ to UUIDs, so 
> that you are using UUIDs *instead* of IDs? 
>
> Or are the IDs exposed in the application, such that you wish to 
> /supplement/ them with an UUID field to support replication? 
>
>
> > My understanding is that the UUID field is necessary because a csv 
> > import will assign different row ids to the new entries in the target db 
> > than the ones they had in the source db (especially if new records have 
> > been added to the target db in the meantime). The UUID is supposed to 
> > overcome this, by allowing the db to recognize that rows are equivalent 
> > even if they have different ids. But in that case, won't reference 
> > fields in other tables often be pointing to the wrong ID number in the 
> > target db? (i.e., they'll keep the row ID of the db version in which 
> > they were created, and if this ID changes in the target db they will 
> > then be referencing a different record.) 
> > 
>
> It's the mention of CSV imports that I'm stuck on - is the intention to 
> use this as your replication mechanism, or are you saying that you are 
> importing data into each instance of the db, and need to preserve 
> imported IDs? 
>
> I may be misreading you, but I would very strongly recommend the use of 
> the db's existing native replication mechanism if at all possible. You 
> don't specify your back-end database, but we've had good results from 
> Postgres replication, FWIW. 
>
>
> > Sorry if this explanation is overly complicated. I'm just trying to get 

[web2py] Re: How to migrate to UUID references in db without messing up reference fields

2014-05-24 Thread Ian W. Scott
Thanks Massimo. I explained my problem a bit better (I hope) in my reply to 
Philip below. There are a couple of reasons why the approach you suggest 
isn't ideal, from my point of view:

   1. I'm working with existing database instances (sqlite). So if I change 
   all of the reference fields to use uuid connections as you suggest, I will 
   have to perform a large-scale migration with a custom script. I'm nervous 
   about the potential for error here.
   2. This approach would prevent my use of some great web2py dal features 
   (reference fields, list-reference fields, recursive selects, cascading 
   deletes, etc.) I'd really rather not have to sacrifice so much web2py 
   functionality just to synchronize two db instances.

I wonder whether this doesn't point to a potential area for improvement in 
web2py. It seems like a framework like this would benefit from having an 
easier, built-in solution for synchronizing db instances without breaking 
dal features. So if you can think of a way to facilitate synchronization 
that's more elegant, I'd be happy to contribute back any code I write to 
implement it.
Thanks again,

Ian
On Saturday, May 24, 2014 3:08:58 AM UTC-4, Massimo Di Pierro wrote:
>
> Hello Ian, Sorry we overlooked your email.
>
> You can easily add a UUID field
>
> from gluon.util import web2py_uuid
>
> db.define_table('person',Field('name'),Field('uuid',compute=lambda:web2py_uuid()))
>
> You can also create table that reference that field:
>
>
> db.define_table('thing',Field('name'),Field('owner',requires=IS_IN_DB(db,'person.uuid','name'))
>
> Except the reference will not be enforced at the DB level, only at the 
> web2py level.
>
> Massimo
>
>
>
> On Friday, 23 May 2014 23:04:10 UTC-5, Ian W. Scott wrote:
>>
>> After 10 days I've received no help on this. Is there something about the 
>> question that is inappropriate? Is my question unclear?
>>
>> On Wednesday, May 14, 2014 11:44:43 AM UTC-4, Ian W. Scott wrote:
>>>
>>> I need to take an existing db and implement a UUID referencing system so 
>>> that I can sync local db's with a central remote version. But I'm concerned 
>>> that this will break reference fields that refer to the newly synced rows.
>>>
>>> My understanding is that the UUID field is necessary because a csv 
>>> import will assign different row ids to the new entries in the target db 
>>> than the ones they had in the source db (especially if new records have 
>>> been added to the target db in the meantime). The UUID is supposed to 
>>> overcome this, by allowing the db to recognize that rows are equivalent 
>>> even if they have different ids. But in that case, won't reference fields 
>>> in other tables often be pointing to the wrong ID number in the target db? 
>>> (i.e., they'll keep the row ID of the db version in which they were 
>>> created, and if this ID changes in the target db they will then be 
>>> referencing a different record.)
>>>
>>> Sorry if this explanation is overly complicated. I'm just trying to get 
>>> things clear in my own mind.
>>>
>>> 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 migrate to UUID references in db without messing up reference fields

2014-06-03 Thread Ian W. Scott
Thanks very much Massimo and Philip. I had missed the fact that the id_map 
parameter triggered smart updating of the reference fields. That's great 
and for the moment is solves my problem.

I'll keep thinking about a longer-term solution for syncing. Here's what 
I'm thinking would be desirable:


   1. 2-way intelligent sync (look at whatever update-time info is 
   available in the table), maybe using websockets
   2. automated backup of the original data for rollback if necessary
   3. can be performed on one table
   4. reference field ids are updated on both ends as necessary
   5. no extra fields need be added to db model
   6. can easily be scheduled or triggered by user activity on one end

In the long run this is something I'll need, so if I make any progress I'll 
let you know.

Ian

On Monday, May 26, 2014 11:49:20 AM UTC-4, Massimo Di Pierro wrote:
>
> I now understand your problem better.
>
> Have you looked into?
>
> db.export_to_csv_file(file)
> db.import_from_csv_file(file,id_map={})
>
> https://groups.google.com/forum/#!msg/web2py/P_lBv8JKiiQ/LESBbSGikw8J
> When importing from the file the id_map will recognize records from the 
> uuid (assuming they have it) and "fix" the references accordingly. So the 
> references in the imported records will be different but will point to the 
> right record. This may fail if there are circular references because it 
> would be unable to built the references. Moreover it requires comparing the 
> entire db and cannot be used on one single table.
>
> I agree a better solution would be desirable.
>
> Massimo 
>
>
>
>
> On Saturday, 24 May 2014 10:58:39 UTC-5, Ian W. Scott wrote:
>>
>> Thanks Massimo. I explained my problem a bit better (I hope) in my reply 
>> to Philip below. There are a couple of reasons why the approach you suggest 
>> isn't ideal, from my point of view:
>>
>>1. I'm working with existing database instances (sqlite). So if I 
>>change all of the reference fields to use uuid connections as you 
>> suggest, 
>>I will have to perform a large-scale migration with a custom script. I'm 
>>nervous about the potential for error here.
>>2. This approach would prevent my use of some great web2py dal 
>>features (reference fields, list-reference fields, recursive selects, 
>>cascading deletes, etc.) I'd really rather not have to sacrifice so much 
>>web2py functionality just to synchronize two db instances.
>>
>> I wonder whether this doesn't point to a potential area for improvement 
>> in web2py. It seems like a framework like this would benefit from having an 
>> easier, built-in solution for synchronizing db instances without breaking 
>> dal features. So if you can think of a way to facilitate synchronization 
>> that's more elegant, I'd be happy to contribute back any code I write to 
>> implement it.
>> Thanks again,
>>
>> Ian
>> On Saturday, May 24, 2014 3:08:58 AM UTC-4, Massimo Di Pierro wrote:
>>>
>>> Hello Ian, Sorry we overlooked your email.
>>>
>>> You can easily add a UUID field
>>>
>>> from gluon.util import web2py_uuid
>>>
>>> db.define_table('person',Field('name'),Field('uuid',compute=lambda:web2py_uuid()))
>>>
>>> You can also create table that reference that field:
>>>
>>>
>>> db.define_table('thing',Field('name'),Field('owner',requires=IS_IN_DB(db,'person.uuid','name'))
>>>
>>> Except the reference will not be enforced at the DB level, only at the 
>>> web2py level.
>>>
>>> Massimo
>>>
>>>
>>>
>>> On Friday, 23 May 2014 23:04:10 UTC-5, Ian W. Scott wrote:
>>>>
>>>> After 10 days I've received no help on this. Is there something about 
>>>> the question that is inappropriate? Is my question unclear?
>>>>
>>>> On Wednesday, May 14, 2014 11:44:43 AM UTC-4, Ian W. Scott wrote:
>>>>>
>>>>> I need to take an existing db and implement a UUID referencing system 
>>>>> so that I can sync local db's with a central remote version. But I'm 
>>>>> concerned that this will break reference fields that refer to the newly 
>>>>> synced rows.
>>>>>
>>>>> My understanding is that the UUID field is necessary because a csv 
>>>>> import will assign different row ids to the new entries in the target db 
>>>>> than the ones they had in th

[web2py] Keep values with a list:string field?

2014-06-25 Thread Ian W. Scott
I've got a SQLFORM.factory form set to keep values after processing with 
process(keepvalues=True). But it doesn't work on a list:string field. The 
(otherwise very nice) widget loses all but the first value when the form is 
submitted (i.e., all but the first text inputs for the field disappear). Is 
there any way to carry those other text inputs and their values over?


-- 
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 making a field unique based on another field's value

2014-06-25 Thread Ian W. Scott
I believe you just set this through the "requires" property of the field:

db.table2.table1_name.requires(IS_IN_DB(db, 'table1.name',
db.table1._format))

That prevents entering any values in table1_name that aren't in 
table1.name. I believe you can also set unique=True on table2.table1_name 
(just as you have on table1.name). Then the values will be unique within 
table2.table1_name and will also be drawn from table1.name.

On Wednesday, June 25, 2014 11:17:17 AM UTC-4, KRG KCIHTRAK wrote:
>
> I have two tables like below.
> Table1 (Field(name), unique = True)
> Table2 (Field(table1_name, 'reference Table1',
>Field(name))
>
> I want to make the Table2's name field as unique based on the value in 
> table1_name.
>
> how can I do it with 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] Broken ajax links giving "unrecognized expression" error

2014-07-09 Thread Ian W. Scott
Some ajax links that used to work have just broken and I'm not sure where 
to start in debugging. The links target a load component on the page (using 
cid) and they have started throwing this error:

Syntax error, unrecognized expression: 
> /paideia/plugin_listandedit/edit.load/word_forms/546?orderby=id&tablename=word_forms


The "unrecognized expression" is simply the url from the link. I've tried 
re-downloading the web2py source and updating web2py.js but neither seems 
to help. The only thing I've done that could have broken it is update to 
bootstrap3 using the package put together by Paolo Caruccio. But I don't 
know enough about web2py.js to guess where a conflict might lie. 

Any suggestions? 

-- 
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] Broken ajax links in component

2014-07-09 Thread Ian W. Scott
I'm in the process of upgrading a site from bs2 to bs3 and I've run into an 
unexpected (and possibly unrelated?) error. On one page I have links in one 
component that are supposed to update another component. The links are now 
broken and raise an error:

Syntax error, unrecognized expression: 
> /paideia/plugin_listandedit/edit.load/plugin_slider_decks/74?orderby=id&tablename=plugin_slider_decks
>

The "unrecognized expression" is simply the url that is supposed to be 
loaded in the other component. The link that triggers this error looks like 
this:

 data-w2p_disable_with="default" data-w2p_method="GET" 
> data-w2p_target="viewpane" 
> href="/paideia/plugin_listandedit/edit.load/plugin_slider_decks/76?orderby=id&tablename=plugin_slider_decks">Asking
>  
> 'When' Questions 
>

So far I've tried updating the web2py.js file to the latest github version, 
but that didn't change anything. I'm really mystified! 

-- 
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: Broken ajax links giving "unrecognized expression" error

2014-07-10 Thread Ian W. Scott
Yes, it's in the browser's console, and it's targeting jquery.js line 3.

On Thursday, July 10, 2014 6:02:18 AM UTC-4, Niphlod wrote:
>
> do this come up in the browser's console ? if yes, what line do they 
> target of what js file ?
>
> On Wednesday, July 9, 2014 11:57:39 PM UTC+2, Ian W. Scott wrote:
>>
>> Some ajax links that used to work have just broken and I'm not sure where 
>> to start in debugging. The links target a load component on the page (using 
>> cid) and they have started throwing this error:
>>
>> Syntax error, unrecognized expression: 
>>> /paideia/plugin_listandedit/edit.load/word_forms/546?orderby=id&tablename=word_forms
>>
>>
>> The "unrecognized expression" is simply the url from the link. I've tried 
>> re-downloading the web2py source and updating web2py.js but neither seems 
>> to help. The only thing I've done that could have broken it is update to 
>> bootstrap3 using the package put together by Paolo Caruccio. But I don't 
>> know enough about web2py.js to guess where a conflict might lie. 
>>
>> Any suggestions? 
>>
>

-- 
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: Broken ajax links in component

2014-07-10 Thread Ian W. Scott
Sorry for the double post of this question. My original post took several 
hours to appear, so I thought it hadn't gone through.

On Wednesday, July 9, 2014 3:31:33 PM UTC-4, Ian W. Scott wrote:
>
> I'm in the process of upgrading a site from bs2 to bs3 and I've run into 
> an unexpected (and possibly unrelated?) error. On one page I have links in 
> one component that are supposed to update another component. The links are 
> now broken and raise an error:
>
> Syntax error, unrecognized expression: 
>> /paideia/plugin_listandedit/edit.load/plugin_slider_decks/74?orderby=id&tablename=plugin_slider_decks
>>
>
> The "unrecognized expression" is simply the url that is supposed to be 
> loaded in the other component. The link that triggers this error looks like 
> this:
>
> > data-w2p_disable_with="default" data-w2p_method="GET" 
>> data-w2p_target="viewpane" 
>> href="/paideia/plugin_listandedit/edit.load/plugin_slider_decks/76?orderby=id&tablename=plugin_slider_decks">Asking
>>  
>> 'When' Questions 
>>
>
> So far I've tried updating the web2py.js file to the latest github 
> version, but that didn't change anything. I'm really mystified! 
>

-- 
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: Broken ajax links in component

2014-07-10 Thread Ian W. Scott
I'm not running jquery 1.9. It's version 1.10.2. But I can try 1.11 and see 
what happens.

On Thursday, July 10, 2014 6:32:27 AM UTC-4, Leonel Câmara wrote:
>
> Have you tried updating jquery to 1.11 this seems like a known jquery 1.9 
> bug.
>

-- 
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: Broken ajax links giving "unrecognized expression" error

2014-07-10 Thread Ian W. Scott
It'll take a bit of time, but I'll see what I can do.

On Thursday, July 10, 2014 8:37:31 AM UTC-4, Niphlod wrote:
>
> can you pack a minimal app to reproduce the issue ?
>
> On Thursday, July 10, 2014 12:54:03 PM UTC+2, Ian W. Scott wrote:
>>
>> Yes, it's in the browser's console, and it's targeting jquery.js line 3.
>>
>> On Thursday, July 10, 2014 6:02:18 AM UTC-4, Niphlod wrote:
>>>
>>> do this come up in the browser's console ? if yes, what line do they 
>>> target of what js file ?
>>>
>>> On Wednesday, July 9, 2014 11:57:39 PM UTC+2, Ian W. Scott wrote:
>>>>
>>>> Some ajax links that used to work have just broken and I'm not sure 
>>>> where to start in debugging. The links target a load component on the page 
>>>> (using cid) and they have started throwing this error:
>>>>
>>>> Syntax error, unrecognized expression: 
>>>>> /paideia/plugin_listandedit/edit.load/word_forms/546?orderby=id&tablename=word_forms
>>>>
>>>>
>>>> The "unrecognized expression" is simply the url from the link. I've 
>>>> tried re-downloading the web2py source and updating web2py.js but neither 
>>>> seems to help. The only thing I've done that could have broken it is 
>>>> update 
>>>> to bootstrap3 using the package put together by Paolo Caruccio. But I 
>>>> don't 
>>>> know enough about web2py.js to guess where a conflict might lie. 
>>>>
>>>> Any suggestions? 
>>>>
>>>

-- 
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: Broken ajax links giving "unrecognized expression" error

2014-07-10 Thread Ian W. Scott
I found the culprit! The links were in a list with the bootstrap classes 
"nav nav-tabs". Because of that the bootstrap js was trying to use the link 
url to show a tab, but it was the wrong format. The implementation of 
bootstrap tabs must have changed between versions 2 and 3 enough that my 
ajax links could work before but now choked the bootstrap js.

Maybe this is something we should keep in mind as people migrate from 
bootstrap 2 to 3.

Anyway, thanks for your willingness to help Niphlod.


On Wednesday, July 9, 2014 5:57:39 PM UTC-4, Ian W. Scott wrote:
>
> Some ajax links that used to work have just broken and I'm not sure where 
> to start in debugging. The links target a load component on the page (using 
> cid) and they have started throwing this error:
>
> Syntax error, unrecognized expression: 
>> /paideia/plugin_listandedit/edit.load/word_forms/546?orderby=id&tablename=word_forms
>
>
> The "unrecognized expression" is simply the url from the link. I've tried 
> re-downloading the web2py source and updating web2py.js but neither seems 
> to help. The only thing I've done that could have broken it is update to 
> bootstrap3 using the package put together by Paolo Caruccio. But I don't 
> know enough about web2py.js to guess where a conflict might lie. 
>
> Any suggestions? 
>

-- 
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: Broken ajax links in component

2014-07-10 Thread Ian W. Scott
I found the culprit. The ajax links were in a list with the bootstrap 
classes "nav nav-tabs". In bootstrap 3 the tabs js was choking on the url 
when an item was clicked.

On Thursday, July 10, 2014 6:57:51 AM UTC-4, Ian W. Scott wrote:
>
> I'm not running jquery 1.9. It's version 1.10.2. But I can try 1.11 and 
> see what happens.
>
> On Thursday, July 10, 2014 6:32:27 AM UTC-4, Leonel Câmara wrote:
>>
>> Have you tried updating jquery to 1.11 this seems like a known jquery 1.9 
>> bug.
>>
>

-- 
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] Migrating field from string to integer type

2014-01-17 Thread Ian W. Scott
Hi folks,

I'm wondering whether it's safe to just change the data type of a field 
from 'string' to 'integer' if all of the field values are integer strings 
(i.e., strings that could be converted properly with python's int(string)). 
Will the data be safe in such a conversion or do I need to use an 
intermediate temporary field to hold the data, then perform the migration, 
and then move the data back.

Thanks,

Ian

-- 
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/groups/opt_out.


[web2py] Re: app not working after install 2.8.2 is_mobile error

2014-01-31 Thread Ian W. Scott
I just ran into this same error using the auto-update to come up to 2.8.2. 
I was able to find this solution, but it did cost me about 1.5 hours of 
figuring out what was wrong. Not so bad in the grand scheme of things, but 
maybe the auto-update interface in the admin app could include some way of 
presenting a list of changes and/or known issues. It could just be a link 
to a pdf version or something, downloaded on-demand from the repo. But 
having that link there (maybe with a warning to read it) will likely help 
folks like me to avoid a headache. It's not so much that I can't do the 
search on the list here before upgrading. It's that I didn't know there 
would be a reason to search for such discussions. Having that prominent 
placement of the changes/issues will also (I suspect) save you time helping 
people with questions like this one. But thanks for the time you do spend 
helping on this list. Your answer here saved me many more hours of 
frustration :)

Cheers,

Ian

On Friday, December 6, 2013 9:38:25 PM UTC-5, Massimo Di Pierro wrote:
>
> You missed a few threads discussing this. ;-)
> You need to clear/remove the sessions. The format of the session storage 
> has changed.
>
> On Friday, 6 December 2013 17:55:52 UTC-6, Ivo wrote:
>>
>> I tried upgrading the web2py to 2.8.2 that was a bad idea...
>> it totally killed the web2py app.
>> I redownloaded a clean version and copied over my app now it throws the 
>> weirdest error:
>> 'dict' object has no attribute 'is_mobile'
>> it traces to user.html, but in reality it's caused by layout.htm
>> the welcome app is working so I had a look inside the layout.html basicly 
>> the same except for a few mods I made that are unrelated.
>>
>> what am I missing? 
>>
>

-- 
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/groups/opt_out.


[web2py] Standard way to access a referenced table?

2014-02-12 Thread Ian W. Scott
I've been working for a while on a very flexible (and so increasingly 
complex) multiple-select widget that can be re-populated from the db via 
ajax (without submitting the form). One think I had to do was figure out 
how to get the name of the table referenced by the field using my widget. 
With some help from the folks here I found this solution:

referencetable = myfield.requires[0].ktable

I'm starting to realize, though, that this is fragile. I know it's doing an 
end-run around the DAL api (accessing implementation details instead of the 
stable api). I also found recently that this was broken by the IS_EMPTY_OR 
validator. For the moment I'm hacking a  solution by doing this:

try:
referencetable = myfield.requires[0].ktable
except AttributeError:  
# because IS_EMPTY_OR doesn't have a property .ktable, 
# it's on the second, wrapped validator
referencetable = myfield.requires[0].other.ktable

But I'm digging myself a deeper hole. Now I'm using a second implementation 
detail (the "other" instance variable of IS_EMPTY_OR) and my widget is that 
much more prone to being broken by future releases.

So I'm wondering whether 

(a) there's a way to access this data via the api that I'm just missing; or 
(b) this is reason to add access to the referenced table to the api.

This could be as simple as adding a get_reference_table() method to the 
validators that (for the time being) draws on the instance variables I've 
been using. 

# in IS_EMPTY_OR
def get_reference_table(self):
return self.other.ktable

# in IS_IN_DB
def get_reference_table(self):
return self.ktable

I'm not sure, though, whether the validator is the best place for that 
method. Should it be a method of Field instead? (That is, if others see a 
need for this at all.)

Cheers,

Ian

-- 
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/groups/opt_out.


[web2py] Re: Standard way to access a referenced table?

2014-02-12 Thread Ian W. Scott
Fantastic! Thanks. When I asked a couple of years ago that wasn't pointed 
out, so I assumed that there wasn't a standard way. This is perfect.

Ian

On Wednesday, February 12, 2014 5:43:40 PM UTC-5, Anthony wrote:
>
> To get the actual ID field of the referenced table, you can also do:
>
> db.mytable.myfield.referent
>
> and to get the table:
>
> db.mytable.myfield.referent.table
>
> and to get the table name:
>
> db.mytable.myfield.referent.tablename
>
> Anthony
>
> On Wednesday, February 12, 2014 5:40:00 PM UTC-5, Anthony wrote:
>>
>> A reference field has type "reference tablename", so you can do:
>>
>> db.mytable.myfield.type.split(' ')[-1]
>>
>> Anthony
>>
>> On Wednesday, February 12, 2014 3:58:58 PM UTC-5, Ian W. Scott wrote:
>>>
>>> I've been working for a while on a very flexible (and so increasingly 
>>> complex) multiple-select widget that can be re-populated from the db via 
>>> ajax (without submitting the form). One think I had to do was figure out 
>>> how to get the name of the table referenced by the field using my widget. 
>>> With some help from the folks here I found this solution:
>>>
>>> referencetable = myfield.requires[0].ktable
>>>
>>> I'm starting to realize, though, that this is fragile. I know it's doing 
>>> an end-run around the DAL api (accessing implementation details instead of 
>>> the stable api). I also found recently that this was broken by the 
>>> IS_EMPTY_OR validator. For the moment I'm hacking a  solution by doing this:
>>>
>>> try:
>>> referencetable = myfield.requires[0].ktable
>>> except AttributeError:  
>>> # because IS_EMPTY_OR doesn't have a property .ktable, 
>>> # it's on the second, wrapped validator
>>> referencetable = myfield.requires[0].other.ktable
>>>
>>> But I'm digging myself a deeper hole. Now I'm using a second 
>>> implementation detail (the "other" instance variable of IS_EMPTY_OR) and my 
>>> widget is that much more prone to being broken by future releases.
>>>
>>> So I'm wondering whether 
>>>
>>> (a) there's a way to access this data via the api that I'm just missing; 
>>> or 
>>> (b) this is reason to add access to the referenced table to the api.
>>>
>>> This could be as simple as adding a get_reference_table() method to the 
>>> validators that (for the time being) draws on the instance variables I've 
>>> been using. 
>>>
>>> # in IS_EMPTY_OR
>>> def get_reference_table(self):
>>> return self.other.ktable
>>>
>>> # in IS_IN_DB
>>> def get_reference_table(self):
>>> return self.ktable
>>>
>>> I'm not sure, though, whether the validator is the best place for that 
>>> method. Should it be a method of Field instead? (That is, if others see a 
>>> need for this at all.)
>>>
>>> Cheers,
>>>
>>> Ian
>>>
>>

-- 
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/groups/opt_out.


[web2py] Migrate integer field to string type

2016-10-24 Thread Ian W. Scott
I'm using Postgresql and I need to migrate the data type of a field from 
"integer" to "string". Will it work to just change the field type in the 
model table definition? What will happen to the existing "integer" data? 
Any problems foreseen?

Thanks,

Ian

-- 
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] Migrate integer field to string type

2016-10-25 Thread Ian W. Scott
Okay, that's what I was afraid of. Thanks.

Ian

On Tuesday, October 25, 2016 at 10:06:19 AM UTC-4, Richard wrote:
>
> You can't just change the field type, you have to create another column of 
> string type then insert your data from a select of the other column into it 
> then delete the old useless column... You need to transform the integer 
> into text at the insert step...
>
> Richard
>
> On Mon, Oct 24, 2016 at 3:32 PM, Ian W. Scott  > wrote:
>
>> I'm using Postgresql and I need to migrate the data type of a field from 
>> "integer" to "string". Will it work to just change the field type in the 
>> model table definition? What will happen to the existing "integer" data? 
>> Any problems foreseen?
>>
>> Thanks,
>>
>> Ian
>>
>> -- 
>> 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+un...@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] Changing admin password

2017-02-16 Thread Ian W. Scott
I seem to have forgotten the admin password for my web2py installation, so 
I need to change it. Looking at posts here, the recommendation was:

1 - stop apache server
2 - restart web2py
3 - enter new password 
4 - restart apache server

I'm getting stuck at 2. The only way I know how to "restart" web2py is to 
run web2py.py from the base web2py directory. But when I do that I get 
web2py running on the rocket server. I can change the admin password for 
the rocket server session, but when I stop the rocket server and restart 
apache the new password I entered doesn't work.

The other command someone recommended here to "restart web2py" was 'python 
web2py'. But when I just run that command from my home directory I get this 
error:

/usr/bin/python: can't find '__main__' module in 'web2py'

I'm really confused.

-- 
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] Changing admin password

2017-02-16 Thread Ian W. Scott
Alright, thanks Richard. I'm still fuzzy about the last part where you say 
I should "restart the web2py instance." I thought that apache simply 
provided access to web2py. I've never had to do anything to start a "web2py 
instance." So what is the "web2py instance" and how do I restart it?

Thanks,

Ian

On Thursday, February 16, 2017 at 11:46:44 AM UTC-5, Richard wrote:
>
> Hello Ian,
>
> Not sure I understand your exact problem, but you can reset admin password 
> like this :
>
> sudo -u www-data python -c "from gluon.main import save_password; 
> save_password('123456',443)"
>
> Where 123456 is you pass phrase.
>
> 443 is the port for which the password apply
>
> This will create parameters_443.py file that you drop/replace in the 
> web2py/ folder and then restart web2py instance and the new generated 
> password should work.
>
> Richard
>
> On Thu, Feb 16, 2017 at 11:29 AM, Ian W. Scott  > wrote:
>
>> I seem to have forgotten the admin password for my web2py installation, 
>> so I need to change it. Looking at posts here, the recommendation was:
>>
>> 1 - stop apache server
>> 2 - restart web2py
>> 3 - enter new password 
>> 4 - restart apache server
>>
>> I'm getting stuck at 2. The only way I know how to "restart" web2py is to 
>> run web2py.py from the base web2py directory. But when I do that I get 
>> web2py running on the rocket server. I can change the admin password for 
>> the rocket server session, but when I stop the rocket server and restart 
>> apache the new password I entered doesn't work.
>>
>> The other command someone recommended here to "restart web2py" was 
>> 'python web2py'. But when I just run that command from my home directory I 
>> get this error:
>>
>> /usr/bin/python: can't find '__main__' module in 'web2py'
>>
>> I'm really confused.
>>
>> -- 
>> 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+un...@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] Changing admin password

2017-02-16 Thread Ian W. Scott
Also, in the command you give above, what is the "www-data" argument? Is 
that the path to the directory set up in apache to hold web content?

I appreciate your help with these very basic questions. As you can tell, 
I'm stuck trying to run a server without any experience or training. So 
when things go properly I'm okay, but I don't understand anything under the 
hood.

Ian

On Thursday, February 16, 2017 at 11:46:44 AM UTC-5, Richard wrote:
>
> Hello Ian,
>
> Not sure I understand your exact problem, but you can reset admin password 
> like this :
>
> sudo -u www-data python -c "from gluon.main import save_password; 
> save_password('123456',443)"
>
> Where 123456 is you pass phrase.
>
> 443 is the port for which the password apply
>
> This will create parameters_443.py file that you drop/replace in the 
> web2py/ folder and then restart web2py instance and the new generated 
> password should work.
>
> Richard
>
> On Thu, Feb 16, 2017 at 11:29 AM, Ian W. Scott  > wrote:
>
>> I seem to have forgotten the admin password for my web2py installation, 
>> so I need to change it. Looking at posts here, the recommendation was:
>>
>> 1 - stop apache server
>> 2 - restart web2py
>> 3 - enter new password 
>> 4 - restart apache server
>>
>> I'm getting stuck at 2. The only way I know how to "restart" web2py is to 
>> run web2py.py from the base web2py directory. But when I do that I get 
>> web2py running on the rocket server. I can change the admin password for 
>> the rocket server session, but when I stop the rocket server and restart 
>> apache the new password I entered doesn't work.
>>
>> The other command someone recommended here to "restart web2py" was 
>> 'python web2py'. But when I just run that command from my home directory I 
>> get this error:
>>
>> /usr/bin/python: can't find '__main__' module in 'web2py'
>>
>> I'm really confused.
>>
>> -- 
>> 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+un...@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] Changing admin password

2017-02-16 Thread Ian W. Scott
Never mind. I figured it out. "www-data" is the user name for the home/ 
directory holding my web2py data. I'm still not sure about "restarting a 
web2py instance" but I restarted apache and the new password worked.

Thanks a lot for your help!

Ian

On Thursday, February 16, 2017 at 11:46:44 AM UTC-5, Richard wrote:
>
> Hello Ian,
>
> Not sure I understand your exact problem, but you can reset admin password 
> like this :
>
> sudo -u www-data python -c "from gluon.main import save_password; 
> save_password('123456',443)"
>
> Where 123456 is you pass phrase.
>
> 443 is the port for which the password apply
>
> This will create parameters_443.py file that you drop/replace in the 
> web2py/ folder and then restart web2py instance and the new generated 
> password should work.
>
> Richard
>
> On Thu, Feb 16, 2017 at 11:29 AM, Ian W. Scott  > wrote:
>
>> I seem to have forgotten the admin password for my web2py installation, 
>> so I need to change it. Looking at posts here, the recommendation was:
>>
>> 1 - stop apache server
>> 2 - restart web2py
>> 3 - enter new password 
>> 4 - restart apache server
>>
>> I'm getting stuck at 2. The only way I know how to "restart" web2py is to 
>> run web2py.py from the base web2py directory. But when I do that I get 
>> web2py running on the rocket server. I can change the admin password for 
>> the rocket server session, but when I stop the rocket server and restart 
>> apache the new password I entered doesn't work.
>>
>> The other command someone recommended here to "restart web2py" was 
>> 'python web2py'. But when I just run that command from my home directory I 
>> get this error:
>>
>> /usr/bin/python: can't find '__main__' module in 'web2py'
>>
>> I'm really confused.
>>
>> -- 
>> 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+un...@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] Routes.py to filter out file version numbers

2017-11-17 Thread Ian W. Scott
Hi there. I'm dynamically adding version numbers to the filenames for 
static assets like css, js, and image files. (These version numbers aren't 
actually in the filenames. They're just added to the url in the  and 

[web2py] Re: Routes.py to filter out file version numbers

2017-11-17 Thread Ian W. Scott
I should add that one reason I'm having trouble debugging is because I'm 
not sure how to test the output of the rewrite. Is there any way to see 
exactly what the rule is going to output, given a particular filename?

On Friday, November 17, 2017 at 10:12:58 AM UTC-5, Ian W. Scott wrote:
>
> Hi there. I'm dynamically adding version numbers to the filenames for 
> static assets like css, js, and image files. (These version numbers aren't 
> actually in the filenames. They're just added to the url in the  and 
> 

[web2py] Re: Routes.py to filter out file version numbers

2017-11-20 Thread Ian W. Scott
I'm still wondering if anyone can help with this. I found a minor error in 
the second member of the routes_in tuple (the period shouldn't be escaped). 
But it's still not working for me. I used re.sub to confirm that the second 
member *should be* outputting the right string. So far I'm just testing 
this on the bundled rocket server, so I don't think there's any issue with 
server settings.

Any help would be much appreciated.

On Friday, November 17, 2017 at 10:12:58 AM UTC-5, Ian W. Scott wrote:
>
> Hi there. I'm dynamically adding version numbers to the filenames for 
> static assets like css, js, and image files. (These version numbers aren't 
> actually in the filenames. They're just added to the url in the  and 
> 

[web2py] Re: Routes.py to filter out file version numbers

2017-11-20 Thread Ian W. Scott
Yes, that's right. I'm getting a 404 on each file with the added version 
string, which must mean that the routes.py isn't pointing the browser 
successfully to the real file (without the version string in the name.

For clarity's sake, here's the contents of my routes.py with the one syntax 
error fixed:

routes_in = ((r
'.*/static/(?P(css|images|audio|js))/(?P.*)\.[\d]{10}\.(?P(css|js|ico|png|svg|jpe?g))'
,
  r'/static/\g/\g.\g'),
 )
routes_out = [(x, y) for (y, x) in routes_in]

I fixed the syntax error, but I'm still getting 404 errors.

On Monday, November 20, 2017 at 8:38:17 PM UTC-5, Dave S wrote:
>
>
>
> On Monday, November 20, 2017 at 9:04:27 AM UTC-8, Ian W. Scott wrote:
>>
>> I'm still wondering if anyone can help with this. I found a minor error 
>> in the second member of the routes_in tuple (the period shouldn't be 
>> escaped). But it's still not working for me. I used re.sub to confirm that 
>> the second member *should be* outputting the right string. So far I'm 
>> just testing this on the bundled rocket server, so I don't think there's 
>> any issue with server settings.
>>
>> Any help would be much appreciated.
>>
>
> I tried to run the doctests on rewrite.py, but didn't do it right to get 
> the gluon imports working.  The module doesn't seem 
>
> Is the error that you're not getting the files you expect?  Are you 
> getting a 404 as a result?
>
> /dps
>
>  
>
>>
>> On Friday, November 17, 2017 at 10:12:58 AM UTC-5, Ian W. Scott wrote:
>>>
>>> Hi there. I'm dynamically adding version numbers to the filenames for 
>>> static assets like css, js, and image files. (These version numbers aren't 
>>> actually in the filenames. They're just added to the url in the  and 
>>> 

[web2py] Re: Routes.py to filter out file version numbers

2017-11-20 Thread Ian W. Scott
I'm not getting web2py's 404 page because it's not the controller's page 
that isn't found. It's the stylesheet. So when I view all of the file 
requests in Chrome's dev tools (network tab) I see that the request for the 
stylesheet has returned 404. The requested URL was:

http://127.0.0.1:8000/paideia/static/css/theme.1511232931.css  (Paideia is 
the name of the app).

Is that the problem? Does web2py's rewrite system only work for the 
controller functions, but not for static files?

On Monday, November 20, 2017 at 9:55:09 PM UTC-5, Dave S wrote:
>
>
>
> On Monday, November 20, 2017 at 6:02:38 PM UTC-8, Ian W. Scott wrote:
>>
>> Yes, that's right. I'm getting a 404 on each file with the added version 
>> string, which must mean that the routes.py isn't pointing the browser 
>> successfully to the real file (without the version string in the name.
>>
>> For clarity's sake, here's the contents of my routes.py with the one 
>> syntax error fixed:
>>
>> routes_in = ((r
>> '.*/static/(?P(css|images|audio|js))/(?P.*)\.[\d]{10}\.(?P(css|js|ico|png|svg|jpe?g))'
>> ,
>>   r'/static/\g/\g.\g'),
>>  )
>> routes_out = [(x, y) for (y, x) in routes_in]
>>
>> I fixed the syntax error, but I'm still getting 404 errors.
>>
>
>
> Does your 404 page show the URL?  The default web2py 404 will show either 
> invalid controller or invalid function, but not invalid application.
>
> /dps
>
>
>> On Monday, November 20, 2017 at 8:38:17 PM UTC-5, Dave S wrote:
>>>
>>>
>>>
>>> On Monday, November 20, 2017 at 9:04:27 AM UTC-8, Ian W. Scott wrote:
>>>>
>>>> I'm still wondering if anyone can help with this. I found a minor error 
>>>> in the second member of the routes_in tuple (the period shouldn't be 
>>>> escaped). But it's still not working for me. I used re.sub to confirm that 
>>>> the second member *should be* outputting the right string. So far I'm 
>>>> just testing this on the bundled rocket server, so I don't think there's 
>>>> any issue with server settings.
>>>>
>>>> Any help would be much appreciated.
>>>>
>>>
>>> I tried to run the doctests on rewrite.py, but didn't do it right to get 
>>> the gluon imports working.  The module doesn't seem 
>>>
>>> Is the error that you're not getting the files you expect?  Are you 
>>> getting a 404 as a result?
>>>
>>> /dps
>>>
>>>  
>>>
>>>>
>>>> On Friday, November 17, 2017 at 10:12:58 AM UTC-5, Ian W. Scott wrote:
>>>>>
>>>>> Hi there. I'm dynamically adding version numbers to the filenames for 
>>>>> static assets like css, js, and image files. (These version numbers 
>>>>> aren't 
>>>>> actually in the filenames. They're just added to the url in the  
>>>>> and 
>>>>> 

[web2py] Re: Routes.py to filter out file version numbers

2017-11-20 Thread Ian W. Scott
I saw it the other day, so I can find it again. I just didn't want to be 
bothered manually updating version numbers all the time. So I was looking 
to build something more automatic. Oh well. Thanks for your help, anyway.

Ian

On Monday, November 20, 2017 at 11:02:56 PM UTC-5, Dave S wrote:
>
>
>
> On Monday, November 20, 2017 at 7:04:00 PM UTC-8, Ian W. Scott wrote:
>>
>> I'm not getting web2py's 404 page because it's not the controller's page 
>> that isn't found. It's the stylesheet. 
>>
>
> Yeah, I just was about to admit I didn't try messing with anything from 
> static.
>  
>
>> So when I view all of the file requests in Chrome's dev tools (network 
>> tab) I see that the request for the stylesheet has returned 404. The 
>> requested URL was:
>>
>> http://127.0.0.1:8000/paideia/static/css/theme.1511232931.css  (Paideia 
>> is the name of the app).
>>
>> Is that the problem? Does web2py's rewrite system only work for the 
>> controller functions, but not for static files?
>>
>>
> Well, the default "static file versioning" works for static files, but 
> I've forgotten where that is handled.
>
> /dps
>  
>
>> On Monday, November 20, 2017 at 9:55:09 PM UTC-5, Dave S wrote:
>>>
>>>
>>>
>>> On Monday, November 20, 2017 at 6:02:38 PM UTC-8, Ian W. Scott wrote:
>>>>
>>>> Yes, that's right. I'm getting a 404 on each file with the added 
>>>> version string, which must mean that the routes.py isn't pointing the 
>>>> browser successfully to the real file (without the version string in the 
>>>> name.
>>>>
>>>> For clarity's sake, here's the contents of my routes.py with the one 
>>>> syntax error fixed:
>>>>
>>>> routes_in = ((r
>>>> '.*/static/(?P(css|images|audio|js))/(?P.*)\.[\d]{10}\.(?P(css|js|ico|png|svg|jpe?g))'
>>>> ,
>>>>   r'/static/\g/\g.\g'),
>>>>      )
>>>> routes_out = [(x, y) for (y, x) in routes_in]
>>>>
>>>> I fixed the syntax error, but I'm still getting 404 errors.
>>>>
>>>
>>>
>>> Does your 404 page show the URL?  The default web2py 404 will show 
>>> either invalid controller or invalid function, but not invalid application.
>>>
>>> /dps
>>>
>>>
>>>> On Monday, November 20, 2017 at 8:38:17 PM UTC-5, Dave S wrote:
>>>>>
>>>>>
>>>>>
>>>>> On Monday, November 20, 2017 at 9:04:27 AM UTC-8, Ian W. Scott wrote:
>>>>>>
>>>>>> I'm still wondering if anyone can help with this. I found a minor 
>>>>>> error in the second member of the routes_in tuple (the period shouldn't 
>>>>>> be 
>>>>>> escaped). But it's still not working for me. I used re.sub to confirm 
>>>>>> that 
>>>>>> the second member *should be* outputting the right string. So far 
>>>>>> I'm just testing this on the bundled rocket server, so I don't think 
>>>>>> there's any issue with server settings.
>>>>>>
>>>>>> Any help would be much appreciated.
>>>>>>
>>>>>
>>>>> I tried to run the doctests on rewrite.py, but didn't do it right to 
>>>>> get the gluon imports working.  The module doesn't seem 
>>>>>
>>>>> Is the error that you're not getting the files you expect?  Are you 
>>>>> getting a 404 as a result?
>>>>>
>>>>> /dps
>>>>>
>>>>>  
>>>>>
>>>>>>
>>>>>> On Friday, November 17, 2017 at 10:12:58 AM UTC-5, Ian W. Scott wrote:
>>>>>>>
>>>>>>> Hi there. I'm dynamically adding version numbers to the filenames 
>>>>>>> for static assets like css, js, and image files. (These version numbers 
>>>>>>> aren't actually in the filenames. They're just added to the url in the 
>>>>>>>  and 

[web2py] "Invalid email" when requesting password reset

2017-11-30 Thread Ian W. Scott
I have one user (and only one) whose email has suddenly started to be 
rejected by the auth login system. With the correct email address and 
password (I've double-checked) he gets "Invalid login." Then when he tries 
to use the password reset form he gets an "Invalid email" notice, as if the 
field validator is rejecting it. The email address is in the format 
my.n...@tyndale.ca. So it shouldn't be rejected by the field validator. Can 
anyone suggest what might be causing a problem like this, or at least how I 
could debug it? There are no error messages being produced. 

Thanks,

Ian

-- 
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: "Invalid email" when requesting password reset

2017-11-30 Thread Ian W. Scott
I think you're right. It looks like the execution hangs up in 
Auth.request_reset_password at the point where the system is checking a 
setting for password case sensitivity:

if not self.settings.email_case_sensitive:
table_user.email.requires.insert(0, IS_LOWER())

I did a search in the current web2py book for "email_case_sensitive" and 
came up empty. Is this something we're supposed to be aware of and set in 
db.py? 

More importantly, if email_case_sensitive is False, the behaviour seems 
wrong. What should happen is that a stored email with some uppercase 
matches a submitted email regardless of the case. Instead, it's assuming 
all stored email addresses are lowercase. I think what happened is that 
this behaviour changed (was introduced?) in a recent update. So my old 
stored email addresses were stored with some uppercase. But when I updated 
to the newest version of web2py this new behaviour broke login and auth for 
anyone with uppercase in their email. Or am I missing something? Setting 
Auth.email_case_sensitive = True does seem to have fixed the issue. 

On Thursday, November 30, 2017 at 4:06:13 PM UTC-5, Leonel Câmara wrote:
>
> Looks like a bug due to case sensitivity, either in web2py or in the dal

-- 
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] Where is password reset link handled?

2018-01-16 Thread Ian W. Scott
I'm trying to debug an "invalid reset password" message when a user tries 
to reset their password via an emailed link. I'm confused, though, about 
where the emailed link is handled. I understand that it goes to 
default/user/reset_password, but where in gluon (tools.py?) is that 
response actually handled?

As an aside, I find the behaviour of the default/user controller function 
kind of opaque generally. Does anyone know of a good explanation anywhere 
of how its various uses draw on gluon? The book explains well how to use 
the function, but it's hard to connect its various functions to the 
underlying business logic.

Thanks,

Ian

-- 
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] Problem migrating field type from 'string' to 'text' (postgresql)

2015-01-07 Thread Ian W. Scott
I need to migrate an existing database field from (the implicit default) 
'string' to 'text'. Since all of the existing data will satisfy the new 
field contstraints (no 'string' will be ruled out as 'text') I just changed 
the field type in the model field definition. 

Old:
Field('response1'),
New:
Field('response1', 'text'),

Everything seemed to go fine until I tried creating a new record with a 
long string in that field. I got the following error: 

(value too long for type character varying(512) 
). 

It looks to me like my postgresql database hasn't actually changed the data 
type for that column. I thought this would be taken care of by the DAL 
migration. So how can I change the actual postgre column data type? Or did 
I do something wrong in the migration?

-- 
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: Problem migrating field type from 'string' to 'text' (postgresql)

2015-01-07 Thread Ian W. Scott
2.8.2-stable+timestamp.2013.11.28.13.54.07
(Running on Apache/2.2.17 (Unix) mod_wsgi/3.3 Python/2.7.8)

On Wednesday, January 7, 2015 2:22:57 PM UTC-5, Massimo Di Pierro wrote:
>
> which web2py version/date?
>
> On Wednesday, 7 January 2015 12:49:29 UTC-6, Ian W. Scott wrote:
>>
>> I need to migrate an existing database field from (the implicit default) 
>> 'string' to 'text'. Since all of the existing data will satisfy the new 
>> field contstraints (no 'string' will be ruled out as 'text') I just changed 
>> the field type in the model field definition. 
>>
>> Old:
>> Field('response1'),
>> New:
>> Field('response1', 'text'),
>>
>> Everything seemed to go fine until I tried creating a new record with a 
>> long string in that field. I got the following error: 
>>
>> (value too long for type character 
>> varying(512) ). 
>>
>> It looks to me like my postgresql database hasn't actually changed the 
>> data type for that column. I thought this would be taken care of by the DAL 
>> migration. So how can I change the actual postgre column data type? Or did 
>> I do something wrong in the migration?
>>
>

-- 
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: Problem migrating field type from 'string' to 'text' (postgresql)

2015-01-09 Thread Ian W. Scott
OK, I'm upgrading. Ran into a snag with my passwords file and finding the 
right port number, but when it's upgraded I'll see whether it does the 
migration correctly.

Thanks

On Thursday, January 8, 2015 at 11:47:54 PM UTC-5, Massimo Di Pierro wrote:
>
> Please upgrade. This should have worked with that version but this is so 
> old. Hard to day what the problem is.
>
> On Wednesday, 7 January 2015 13:42:52 UTC-6, Ian W. Scott wrote:
>>
>> 2.8.2-stable+timestamp.2013.11.28.13.54.07
>> (Running on Apache/2.2.17 (Unix) mod_wsgi/3.3 Python/2.7.8)
>>
>> On Wednesday, January 7, 2015 2:22:57 PM UTC-5, Massimo Di Pierro wrote:
>>>
>>> which web2py version/date?
>>>
>>> On Wednesday, 7 January 2015 12:49:29 UTC-6, Ian W. Scott wrote:
>>>>
>>>> I need to migrate an existing database field from (the implicit 
>>>> default) 'string' to 'text'. Since all of the existing data will satisfy 
>>>> the new field contstraints (no 'string' will be ruled out as 'text') I 
>>>> just 
>>>> changed the field type in the model field definition. 
>>>>
>>>> Old:
>>>> Field('response1'),
>>>> New:
>>>> Field('response1', 'text'),
>>>>
>>>> Everything seemed to go fine until I tried creating a new record with 
>>>> a long string in that field. I got the following error: 
>>>>
>>>> (value too long for type character 
>>>> varying(512) ). 
>>>>
>>>> It looks to me like my postgresql database hasn't actually changed the 
>>>> data type for that column. I thought this would be taken care of by the 
>>>> DAL 
>>>> migration. So how can I change the actual postgre column data type? Or did 
>>>> I do something wrong in the migration?
>>>>
>>>

-- 
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: Problem migrating field type from 'string' to 'text' (postgresql)

2015-01-12 Thread Ian W. Scott
Thanks Paolo. That was it. I forgot that I had set migrate to False. I 
really feel foolish, but thanks for pointing me in the right direction.

Ian

On Friday, January 9, 2015 at 4:23:27 PM UTC-5, Paolo Valleri wrote:
>
> Hi,
> I've checked and web2py trunk works as expected (both directions namely 
> string to text and viceversa)
> @scott, have you enabled migration? ( DAL(db_uri, migrate=True))
>
> Paolo
>
> On Friday, January 9, 2015 at 7:38:08 PM UTC+1, Ian W. Scott wrote:
>>
>> OK, I'm upgrading. Ran into a snag with my passwords file and finding the 
>> right port number, but when it's upgraded I'll see whether it does the 
>> migration correctly.
>>
>> Thanks
>>
>> On Thursday, January 8, 2015 at 11:47:54 PM UTC-5, Massimo Di Pierro 
>> wrote:
>>>
>>> Please upgrade. This should have worked with that version but this is so 
>>> old. Hard to day what the problem is.
>>>
>>> On Wednesday, 7 January 2015 13:42:52 UTC-6, Ian W. Scott wrote:
>>>>
>>>> 2.8.2-stable+timestamp.2013.11.28.13.54.07
>>>> (Running on Apache/2.2.17 (Unix) mod_wsgi/3.3 Python/2.7.8)
>>>>
>>>> On Wednesday, January 7, 2015 2:22:57 PM UTC-5, Massimo Di Pierro wrote:
>>>>>
>>>>> which web2py version/date?
>>>>>
>>>>> On Wednesday, 7 January 2015 12:49:29 UTC-6, Ian W. Scott wrote:
>>>>>>
>>>>>> I need to migrate an existing database field from (the implicit 
>>>>>> default) 'string' to 'text'. Since all of the existing data will satisfy 
>>>>>> the new field contstraints (no 'string' will be ruled out as 'text') I 
>>>>>> just 
>>>>>> changed the field type in the model field definition. 
>>>>>>
>>>>>> Old:
>>>>>> Field('response1'),
>>>>>> New:
>>>>>> Field('response1', 'text'),
>>>>>>
>>>>>> Everything seemed to go fine until I tried creating a new record 
>>>>>> with a long string in that field. I got the following error: 
>>>>>>
>>>>>> (value too long for type character 
>>>>>> varying(512) ). 
>>>>>>
>>>>>> It looks to me like my postgresql database hasn't actually changed 
>>>>>> the data type for that column. I thought this would be taken care of by 
>>>>>> the 
>>>>>> DAL migration. So how can I change the actual postgre column data type? 
>>>>>> Or 
>>>>>> did I do something wrong in the migration?
>>>>>>
>>>>>

-- 
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] request_reset_password not returning a form

2015-01-26 Thread Ian W. Scott
When I click on "Lost Password" in the user menu I just get a page with a 
blank body. The url to which I'm forwarded seems right 
(http://ianwscott.webfactional.com/paideia/default/user/request_reset_password?_next=/paideia/default/index)
 
but there's no form on the page. It's as if the page controller is 
returning an empty dict. But I'm not getting any error message either.

I've looked through the page source and it's not that the form is 
hidden. It's just not being included in the page response. Other 
default/user forms are produced just fine: login, change_password, etc. So 
I can't figure out why request_reset_password returns nothing.

Since there's no error ticket it's very difficult for me to debug. Any 
suggestions?

Here is my setup for mail and the relevant auth settings (from 
controllers/db.py):

mail = Mail()
mail.settings.server = keydata['email_sender']  # 'logging' # SMTP server
mail.settings.sender = keydata['email_address']  # email
mail.settings.login = keydata['email_pass']  # credentials or None
current.mail = mail


auth.settings.mailer = mail# for user email verification
auth.settings.registration_requires_verification = False
auth.settings.registration_requires_approval = False
auth.messages.verify_email = 'Click on the link http://' \
+ request.env.http_host + URL('default', 'user', args=['verify_email']) 
\
+ '/%(key)s to verify your email'
auth.settings.reset_password_requires_verification = True
auth.messages.reset_password = 'Click on the link http://' \
+ request.env.http_host + URL('default', 'user', args=['reset_password'
])\
+ '/%(key)s to reset your password'



-- 
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: request_reset_password not returning a form

2015-01-27 Thread Ian W. Scott
Thanks Cynthia. But I do have the right format in the keydata file. I'm 
also not sure that a problem in my email verification would produce my 
issue. It doesn't get as far as trying to send an email in my case, since 
no form is created.

Cheers,

Ian

On Monday, January 26, 2015 at 6:04:28 PM UTC-5, Cynthia Butler wrote:
>
> It looks like your 
> mail.settings.login = keydata['email_pass'] 
> may be just a password.
> I'm guessing, it depends on what the value of 'email_pass' is.
>
> It needs to be the full user@domain:password, like this:
> name@maildomain:password 
>
> On Monday, January 26, 2015 at 1:04:05 PM UTC-7, Ian W. Scott wrote:
>>
>> When I click on "Lost Password" in the user menu I just get a page with a 
>> blank body. The url to which I'm forwarded seems right (
>> http://ianwscott.webfactional.com/paideia/default/user/request_reset_password?_next=/paideia/default/index)
>>  
>> but there's no form on the page. It's as if the page controller is 
>> returning an empty dict. But I'm not getting any error message either.
>>
>> I've looked through the page source and it's not that the form is 
>> hidden. It's just not being included in the page response. Other 
>> default/user forms are produced just fine: login, change_password, etc. So 
>> I can't figure out why request_reset_password returns nothing.
>>
>> Since there's no error ticket it's very difficult for me to debug. Any 
>> suggestions?
>>
>> Here is my setup for mail and the relevant auth settings (from 
>> controllers/db.py):
>>
>> mail = Mail()
>> mail.settings.server = keydata['email_sender']  # 'logging' # SMTP server
>> mail.settings.sender = keydata['email_address']  # email
>> mail.settings.login = keydata['email_pass']  # credentials or None
>> current.mail = mail
>>
>>
>> auth.settings.mailer = mail# for user email 
>> verification
>> auth.settings.registration_requires_verification = False
>> auth.settings.registration_requires_approval = False
>> auth.messages.verify_email = 'Click on the link http://' \
>> + request.env.http_host + URL('default', 'user', args=['verify_email'
>> ]) \
>> + '/%(key)s to verify your email'
>> auth.settings.reset_password_requires_verification = True
>> auth.messages.reset_password = 'Click on the link http://' \
>> + request.env.http_host + URL('default', 'user', args=[
>> 'reset_password'])\
>> + '/%(key)s to reset your password'
>>
>>
>>
>>

-- 
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: request_reset_password not returning a form

2015-01-28 Thread Ian W. Scott
Finally figured out the issue. I just didn't have a condition for 
"request_reset_password" in the view for default/user. Added that condition 
and it works like a charm.

Ian

On Tuesday, January 27, 2015 at 3:02:34 PM UTC-5, Ian W. Scott wrote:
>
> Thanks Cynthia. But I do have the right format in the keydata file. I'm 
> also not sure that a problem in my email verification would produce my 
> issue. It doesn't get as far as trying to send an email in my case, since 
> no form is created.
>
> Cheers,
>
> Ian
>
> On Monday, January 26, 2015 at 6:04:28 PM UTC-5, Cynthia Butler wrote:
>>
>> It looks like your 
>> mail.settings.login = keydata['email_pass'] 
>> may be just a password.
>> I'm guessing, it depends on what the value of 'email_pass' is.
>>
>> It needs to be the full user@domain:password, like this:
>> name@maildomain:password 
>>
>> On Monday, January 26, 2015 at 1:04:05 PM UTC-7, Ian W. Scott wrote:
>>>
>>> When I click on "Lost Password" in the user menu I just get a page with 
>>> a blank body. The url to which I'm forwarded seems right (
>>> http://ianwscott.webfactional.com/paideia/default/user/request_reset_password?_next=/paideia/default/index)
>>>  
>>> but there's no form on the page. It's as if the page controller is 
>>> returning an empty dict. But I'm not getting any error message either.
>>>
>>> I've looked through the page source and it's not that the form is 
>>> hidden. It's just not being included in the page response. Other 
>>> default/user forms are produced just fine: login, change_password, etc. So 
>>> I can't figure out why request_reset_password returns nothing.
>>>
>>> Since there's no error ticket it's very difficult for me to debug. Any 
>>> suggestions?
>>>
>>> Here is my setup for mail and the relevant auth settings (from 
>>> controllers/db.py):
>>>
>>> mail = Mail()
>>> mail.settings.server = keydata['email_sender']  # 'logging' # SMTP 
>>> server
>>> mail.settings.sender = keydata['email_address']  # email
>>> mail.settings.login = keydata['email_pass']  # credentials or None
>>> current.mail = mail
>>>
>>>
>>> auth.settings.mailer = mail# for user email 
>>> verification
>>> auth.settings.registration_requires_verification = False
>>> auth.settings.registration_requires_approval = False
>>> auth.messages.verify_email = 'Click on the link http://' \
>>> + request.env.http_host + URL('default', 'user', args=[
>>> 'verify_email']) \
>>> + '/%(key)s to verify your email'
>>> auth.settings.reset_password_requires_verification = True
>>> auth.messages.reset_password = 'Click on the link http://' \
>>> + request.env.http_host + URL('default', 'user', args=[
>>> 'reset_password'])\
>>> + '/%(key)s to reset your password'
>>>
>>>
>>>
>>>

-- 
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] SQLFORM hanging on insert

2015-01-29 Thread Ian W. Scott
I have a create form (SQLFORM) that works (a new record is actually 
created) but immediately after inserting the new record the web2py process 
hangs. The form remains greyed out and no other functions will work (e.g., 
can't refresh the page or navigate away). But there's no error raised. Can 
anyone help me figure out what is causing the hang?

I've pinpointed the point where the hang occurs: the call to 
gluon.DAL.Table.insert in gluon.SQLFORM.accepts (around line 1671 in the 
current stable version). What's strange is that the Table.insert method 
does finish without any errors. But when it returns to SQLFORM.accepts the 
execution hangs. A print statement immediately following the call to 
Table.insert is not executed.

If it helps to know, I'm using postgresql running on apache.

Here is an example of the data being sent by SQLFORM.accepts to 
Table.insert:

{'hints': [],
 'instructions': [13L, 14L],
 'lemmas': [],
 'locations': [11L],
 'modified_on': datetime.datetime(2014, 12, 19, 18, 15, 32),
 'npcs': [32L],
 'outcome1': '1.0',
 'outcome2': '',
 'outcome3': '',
 'prompt': 'Repetition can serve to emphasize certain words in the 
sentence, especially when the repeated words are close together. Which 
words are emphasized in this way in \xce\x9a\xce\xb1\xcf\x84\xce\xb1 
\xe1\xbc\xb8\xcf\x89\xce\xb1\xce\xbd\xce\xbd\xce\xb7\xcf\x82 
1:4?\r\n\r\n"\xe1\xbc\x98\xce\xbd \xce\xb1\xe1\xbd\x90\xcf\x84\xe1\xbf\xb3 
\xce\xb6\xcf\x89\xce\xb7 \xe1\xbc\xa0\xce\xbd, \xce\xba\xce\xb1\xce\xb9 
\xe1\xbc\xa1 \xce\xb6\xcf\x89\xce\xb7 \xe1\xbc\xa0\xce\xbd \xcf\x84\xce\xbf 
\xcf\x86\xcf\x89\xcf\x82 \xcf\x84\xcf\x89\xce\xbd 
\xe1\xbc\x80\xce\xbd\xce\xb8\xcf\x81\xcf\x89\xcf\x80\xcf\x89\xce\xbd."',
 'prompt_audio': 1,
 'readable_response': '\xce\xb6\xcf\x89\xce\xb7 \xe1\xbc\xa0\xce\xbd',
 'response1': '^(\xe1\xbc\xa1 )?\xce\xb6\xcf\x89\xce\xb7( 
\xe1\xbc\xa0\xce\xbd)?$',
 'response2': '',
 'response3': '',
 'status': 1,
 'step_options': [],
 'tags': [202L],
 'tags_ahead': [],
 'tags_secondary': [],
 'uuid': '51a9c0c0-18e5-4a9b-9b89-85eee6668170',
 'widget_image': 9,
 'widget_type': 1}

 Again, the db record is actually created. The operation just stops any 
further execution.

-- 
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 hanging on insert

2015-01-29 Thread Ian W. Scott
Oh, and I'm running version 2.9.11-stable.

On Thursday, January 29, 2015 at 4:00:54 PM UTC-5, Ian W. Scott wrote:
>
> I have a create form (SQLFORM) that works (a new record is actually 
> created) but immediately after inserting the new record the web2py process 
> hangs. The form remains greyed out and no other functions will work (e.g., 
> can't refresh the page or navigate away). But there's no error raised. Can 
> anyone help me figure out what is causing the hang?
>
> I've pinpointed the point where the hang occurs: the call to 
> gluon.DAL.Table.insert in gluon.SQLFORM.accepts (around line 1671 in the 
> current stable version). What's strange is that the Table.insert method 
> does finish without any errors. But when it returns to SQLFORM.accepts the 
> execution hangs. A print statement immediately following the call to 
> Table.insert is not executed.
>
> If it helps to know, I'm using postgresql running on apache.
>
> Here is an example of the data being sent by SQLFORM.accepts to 
> Table.insert:
>
> {'hints': [],
>  'instructions': [13L, 14L],
>  'lemmas': [],
>  'locations': [11L],
>  'modified_on': datetime.datetime(2014, 12, 19, 18, 15, 32),
>  'npcs': [32L],
>  'outcome1': '1.0',
>  'outcome2': '',
>  'outcome3': '',
>  'prompt': 'Repetition can serve to emphasize certain words in the 
> sentence, especially when the repeated words are close together. Which 
> words are emphasized in this way in \xce\x9a\xce\xb1\xcf\x84\xce\xb1 
> \xe1\xbc\xb8\xcf\x89\xce\xb1\xce\xbd\xce\xbd\xce\xb7\xcf\x82 
> 1:4?\r\n\r\n"\xe1\xbc\x98\xce\xbd \xce\xb1\xe1\xbd\x90\xcf\x84\xe1\xbf\xb3 
> \xce\xb6\xcf\x89\xce\xb7 \xe1\xbc\xa0\xce\xbd, \xce\xba\xce\xb1\xce\xb9 
> \xe1\xbc\xa1 \xce\xb6\xcf\x89\xce\xb7 \xe1\xbc\xa0\xce\xbd \xcf\x84\xce\xbf 
> \xcf\x86\xcf\x89\xcf\x82 \xcf\x84\xcf\x89\xce\xbd 
> \xe1\xbc\x80\xce\xbd\xce\xb8\xcf\x81\xcf\x89\xcf\x80\xcf\x89\xce\xbd."',
>  'prompt_audio': 1,
>  'readable_response': '\xce\xb6\xcf\x89\xce\xb7 \xe1\xbc\xa0\xce\xbd',
>  'response1': '^(\xe1\xbc\xa1 )?\xce\xb6\xcf\x89\xce\xb7( 
> \xe1\xbc\xa0\xce\xbd)?$',
>  'response2': '',
>  'response3': '',
>  'status': 1,
>  'step_options': [],
>  'tags': [202L],
>  'tags_ahead': [],
>  'tags_secondary': [],
>  'uuid': '51a9c0c0-18e5-4a9b-9b89-85eee6668170',
>  'widget_image': 9,
>  'widget_type': 1}
>
>  Again, the db record is actually created. The operation just stops any 
> further execution.
>

-- 
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 hanging on insert

2015-01-30 Thread Ian W. Scott
Thanks for the suggestion Niphlod. I'm just not sure what you mean by 
"start a shell". Can you explain?

Ian

On Thursday, January 29, 2015 at 4:28:15 PM UTC-5, Niphlod wrote:
>
> what about if you start a shell and issue the insert statement with a 
> db.commit() ? does it hang also there ?
>
> On Thursday, January 29, 2015 at 10:05:30 PM UTC+1, Ian W. Scott wrote:
>>
>> Oh, and I'm running version 2.9.11-stable.
>>
>> On Thursday, January 29, 2015 at 4:00:54 PM UTC-5, Ian W. Scott wrote:
>>>
>>> I have a create form (SQLFORM) that works (a new record is actually 
>>> created) but immediately after inserting the new record the web2py process 
>>> hangs. The form remains greyed out and no other functions will work (e.g., 
>>> can't refresh the page or navigate away). But there's no error raised. Can 
>>> anyone help me figure out what is causing the hang?
>>>
>>> I've pinpointed the point where the hang occurs: the call to 
>>> gluon.DAL.Table.insert in gluon.SQLFORM.accepts (around line 1671 in the 
>>> current stable version). What's strange is that the Table.insert method 
>>> does finish without any errors. But when it returns to SQLFORM.accepts the 
>>> execution hangs. A print statement immediately following the call to 
>>> Table.insert is not executed.
>>>
>>> If it helps to know, I'm using postgresql running on apache.
>>>
>>> Here is an example of the data being sent by SQLFORM.accepts to 
>>> Table.insert:
>>>
>>> {'hints': [],
>>>  'instructions': [13L, 14L],
>>>  'lemmas': [],
>>>  'locations': [11L],
>>>  'modified_on': datetime.datetime(2014, 12, 19, 18, 15, 32),
>>>  'npcs': [32L],
>>>  'outcome1': '1.0',
>>>  'outcome2': '',
>>>  'outcome3': '',
>>>  'prompt': 'Repetition can serve to emphasize certain words in the 
>>> sentence, especially when the repeated words are close together. Which 
>>> words are emphasized in this way in \xce\x9a\xce\xb1\xcf\x84\xce\xb1 
>>> \xe1\xbc\xb8\xcf\x89\xce\xb1\xce\xbd\xce\xbd\xce\xb7\xcf\x82 
>>> 1:4?\r\n\r\n"\xe1\xbc\x98\xce\xbd \xce\xb1\xe1\xbd\x90\xcf\x84\xe1\xbf\xb3 
>>> \xce\xb6\xcf\x89\xce\xb7 \xe1\xbc\xa0\xce\xbd, \xce\xba\xce\xb1\xce\xb9 
>>> \xe1\xbc\xa1 \xce\xb6\xcf\x89\xce\xb7 \xe1\xbc\xa0\xce\xbd \xcf\x84\xce\xbf 
>>> \xcf\x86\xcf\x89\xcf\x82 \xcf\x84\xcf\x89\xce\xbd 
>>> \xe1\xbc\x80\xce\xbd\xce\xb8\xcf\x81\xcf\x89\xcf\x80\xcf\x89\xce\xbd."',
>>>  'prompt_audio': 1,
>>>  'readable_response': '\xce\xb6\xcf\x89\xce\xb7 \xe1\xbc\xa0\xce\xbd',
>>>  'response1': '^(\xe1\xbc\xa1 )?\xce\xb6\xcf\x89\xce\xb7( 
>>> \xe1\xbc\xa0\xce\xbd)?$',
>>>  'response2': '',
>>>  'response3': '',
>>>  'status': 1,
>>>  'step_options': [],
>>>  'tags': [202L],
>>>  'tags_ahead': [],
>>>  'tags_secondary': [],
>>>  'uuid': '51a9c0c0-18e5-4a9b-9b89-85eee6668170',
>>>  'widget_image': 9,
>>>  'widget_type': 1}
>>>
>>>  Again, the db record is actually created. The operation just stops any 
>>> further execution.
>>>
>>

-- 
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 hanging on insert

2015-01-30 Thread Ian W. Scott
If it helps at all, here's the controller function that creates and 
processes the form:

def dupAndEdit():
"""Create and process a form to insert a new record, pre-populated
with field values copied from an existing record."""
tablename = request.args[0]
rowid = request.args[1]
orderby = request.vars['orderby'] or 'id'
restrictor = request.vars['restrictor'] or None
formname = '%s/%s/dup' % (tablename, rowid)


src = db(db[tablename].id == rowid).select().first()
form = SQLFORM(db[tablename], separator='', showid=True, formstyle='ul')


for v in db[tablename].fields:
# on opening populate duplicate values
form.vars[v] = src[v] if v != 'id' and v in src else None
# FIXME: ajaxselect field values have to be added manually
if db[tablename].fields[1] in request.vars.keys():  # on submit add 
ajaxselect values
extras = [f for f in db[tablename].fields
  if f not in form.vars.keys()]
for e in extras:
form.vars[e] = request.vars[e] if e in request.vars.keys() \
else ''
del form.vars['id']
print 'form vars ='
pprint(form.vars)


if form.process(formname=formname).accepted:
db.commit()
print 'accepted form ='
the_url = makeurl(tablename, orderby, restrictor)
response.js = "web2py_component('%s', " \
  "'listpane');" % the_url
response.flash = 'New record successfully created.'
elif form.errors:
print 'listandedit form errors:', [e for e in form.errors]
print 'listandedit form vars:', form.vars
response.flash = 'Sorry, there was an error processing '\
 'the form. The new record has not been created.'
else:
pass


return dict(form=form)




On Thursday, January 29, 2015 at 4:28:15 PM UTC-5, Niphlod wrote:
>
> what about if you start a shell and issue the insert statement with a 
> db.commit() ? does it hang also there ?
>
> On Thursday, January 29, 2015 at 10:05:30 PM UTC+1, Ian W. Scott wrote:
>>
>> Oh, and I'm running version 2.9.11-stable.
>>
>> On Thursday, January 29, 2015 at 4:00:54 PM UTC-5, Ian W. Scott wrote:
>>>
>>> I have a create form (SQLFORM) that works (a new record is actually 
>>> created) but immediately after inserting the new record the web2py process 
>>> hangs. The form remains greyed out and no other functions will work (e.g., 
>>> can't refresh the page or navigate away). But there's no error raised. Can 
>>> anyone help me figure out what is causing the hang?
>>>
>>> I've pinpointed the point where the hang occurs: the call to 
>>> gluon.DAL.Table.insert in gluon.SQLFORM.accepts (around line 1671 in the 
>>> current stable version). What's strange is that the Table.insert method 
>>> does finish without any errors. But when it returns to SQLFORM.accepts the 
>>> execution hangs. A print statement immediately following the call to 
>>> Table.insert is not executed.
>>>
>>> If it helps to know, I'm using postgresql running on apache.
>>>
>>> Here is an example of the data being sent by SQLFORM.accepts to 
>>> Table.insert:
>>>
>>> {'hints': [],
>>>  'instructions': [13L, 14L],
>>>  'lemmas': [],
>>>  'locations': [11L],
>>>  'modified_on': datetime.datetime(2014, 12, 19, 18, 15, 32),
>>>  'npcs': [32L],
>>>  'outcome1': '1.0',
>>>  'outcome2': '',
>>>  'outcome3': '',
>>>  'prompt': 'Repetition can serve to emphasize certain words in the 
>>> sentence, especially when the repeated words are close together. Which 
>>> words are emphasized in this way in \xce\x9a\xce\xb1\xcf\x84\xce\xb1 
>>> \xe1\xbc\xb8\xcf\x89\xce\xb1\xce\xbd\xce\xbd\xce\xb7\xcf\x82 
>>> 1:4?\r\n\r\n"\xe1\xbc\x98\xce\xbd \xce\xb1\xe1\xbd\x90\xcf\x84\xe1\xbf\xb3 
>>> \xce\xb6\xcf\x89\xce\xb7 \xe1\xbc\xa0\xce\xbd, \xce\xba\xce\xb1\xce\xb9 
>>> \xe1\xbc\xa1 \xce\xb6\xcf\x89\xce\xb7 \xe1\xbc\xa0\xce\xbd \xcf\x84\xce\xbf 
>>> \xcf\x86\xcf\x89\xcf\x82 \xcf\x84\xcf\x89\xce\xbd 
>>> \xe1\xbc\x80\xce\xbd\xce\xb8\xcf\x81\xcf\x89\xcf\x80\xcf\x89\xce\xbd."',
>>>  'prompt_audio': 

[web2py] Re: SQLFORM hanging on insert

2015-01-30 Thread Ian W. Scott
Thanks, Michelle, for spelling out what Niphlod meant about the shell. 
Ignore the db.commit() in the controller code. That was something I threw 
in briefly to see what would happen. I forgot to remove it.

When I do db.commit() from the interactive prompt it doesn't hang or stall. 

I'm using postgresql for my db. 

I'd be tempted to say that it seems like the db connection isn't being 
closed after the insert. But my database-fu is very weak, so that may be a 
red herring. It's just so strange that the execution stops where it does: 
between the end of Table.insert and returning control to SQLFORM.accepts.

So I'm still scratching my head here.

On Friday, January 30, 2015 at 1:21:53 PM UTC-5, Michele Comitini wrote:
>
> Why do you commit?  not needed and even dangerous in that position.
> What db are you using?
> Do as niphlod suggests:
>
> python web2py.py -M -S 
>
>
>
> At the prompt issue:
>
> [1] db.commit()
>
>
> does it stall?
>
>
>
> Il giorno venerdì 30 gennaio 2015 18:10:23 UTC+1, Ian W. Scott ha scritto:
>>
>> If it helps at all, here's the controller function that creates and 
>> processes the form:
>>  
>>if form.process(formname=formname).accepted:
>> db.commit() ### DON'T DO IT!
>>  
>>
>>
>>
>>
>>
>> On Thursday, January 29, 2015 at 4:28:15 PM UTC-5, Niphlod wrote:
>>>
>>> what about if you start a shell and issue the insert statement with a 
>>> db.commit() ? does it hang also there ?
>>>
>>> On Thursday, January 29, 2015 at 10:05:30 PM UTC+1, Ian W. Scott wrote:
>>>>
>>>> Oh, and I'm running version 2.9.11-stable.
>>>>
>>>> On Thursday, January 29, 2015 at 4:00:54 PM UTC-5, Ian W. Scott wrote:
>>>>>
>>>>> I have a create form (SQLFORM) that works (a new record is actually 
>>>>> created) but immediately after inserting the new record the web2py 
>>>>> process 
>>>>> hangs. The form remains greyed out and no other functions will work 
>>>>> (e.g., 
>>>>> can't refresh the page or navigate away). But there's no error raised. 
>>>>> Can 
>>>>> anyone help me figure out what is causing the hang?
>>>>>
>>>>> I've pinpointed the point where the hang occurs: the call to 
>>>>> gluon.DAL.Table.insert in gluon.SQLFORM.accepts (around line 1671 in the 
>>>>> current stable version). What's strange is that the Table.insert method 
>>>>> does finish without any errors. But when it returns to SQLFORM.accepts 
>>>>> the 
>>>>> execution hangs. A print statement immediately following the call to 
>>>>> Table.insert is not executed.
>>>>>
>>>>> If it helps to know, I'm using postgresql running on apache.
>>>>>
>>>>> Here is an example of the data being sent by SQLFORM.accepts to 
>>>>> Table.insert:
>>>>>
>>>>> {'hints': [],
>>>>>  'instructions': [13L, 14L],
>>>>>  'lemmas': [],
>>>>>  'locations': [11L],
>>>>>  'modified_on': datetime.datetime(2014, 12, 19, 18, 15, 32),
>>>>>  'npcs': [32L],
>>>>>  'outcome1': '1.0',
>>>>>  'outcome2': '',
>>>>>  'outcome3': '',
>>>>>  'prompt': 'Repetition can serve to emphasize certain words in the 
>>>>> sentence, especially when the repeated words are close together. Which 
>>>>> words are emphasized in this way in \xce\x9a\xce\xb1\xcf\x84\xce\xb1 
>>>>> \xe1\xbc\xb8\xcf\x89\xce\xb1\xce\xbd\xce\xbd\xce\xb7\xcf\x82 
>>>>> 1:4?\r\n\r\n"\xe1\xbc\x98\xce\xbd 
>>>>> \xce\xb1\xe1\xbd\x90\xcf\x84\xe1\xbf\xb3 
>>>>> \xce\xb6\xcf\x89\xce\xb7 \xe1\xbc\xa0\xce\xbd, \xce\xba\xce\xb1\xce\xb9 
>>>>> \xe1\xbc\xa1 \xce\xb6\xcf\x89\xce\xb7 \xe1\xbc\xa0\xce\xbd 
>>>>> \xcf\x84\xce\xbf 
>>>>> \xcf\x86\xcf\x89\xcf\x82 \xcf\x84\xcf\x89\xce\xbd 
>>>>> \xe1\xbc\x80\xce\xbd\xce\xb8\xcf\x81\xcf\x89\xcf\x80\xcf\x89\xce\xbd."',
>>>>>  'prompt_audio': 1,
>>>>>  'readable_response': '\xce\xb6\xcf\x89\xce\xb7 \xe1\xbc\xa0\xce\xbd',
>>>>>  'response1': '^(\xe1\xbc\xa1 )?\xce\xb6\xcf\x89\xce\xb7( 
>>>>> \xe1\xbc\xa0\xce\xbd)?$',
>>>>>  'response2': '',
>>>>>  'response3': '',
>>>>>  'status': 1,
>>>>>  'step_options': [],
>>>>>  'tags': [202L],
>>>>>  'tags_ahead': [],
>>>>>  'tags_secondary': [],
>>>>>  'uuid': '51a9c0c0-18e5-4a9b-9b89-85eee6668170',
>>>>>  'widget_image': 9,
>>>>>  'widget_type': 1}
>>>>>
>>>>>  Again, the db record is actually created. The operation just stops 
>>>>> any further execution.
>>>>>
>>>>

-- 
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 hanging on insert

2015-02-05 Thread Ian W. Scott
Hi folks. I still don't really know how to debug this problem beyond what 
I've done (identify the point in the gluon code where the hang happens). 
Can anyone at least suggest another strategy for debugging it?

Thanks again,

Ian

On Thursday, January 29, 2015 at 4:00:54 PM UTC-5, Ian W. Scott wrote:
>
> I have a create form (SQLFORM) that works (a new record is actually 
> created) but immediately after inserting the new record the web2py process 
> hangs. The form remains greyed out and no other functions will work (e.g., 
> can't refresh the page or navigate away). But there's no error raised. Can 
> anyone help me figure out what is causing the hang?
>
> I've pinpointed the point where the hang occurs: the call to 
> gluon.DAL.Table.insert in gluon.SQLFORM.accepts (around line 1671 in the 
> current stable version). What's strange is that the Table.insert method 
> does finish without any errors. But when it returns to SQLFORM.accepts the 
> execution hangs. A print statement immediately following the call to 
> Table.insert is not executed.
>
> If it helps to know, I'm using postgresql running on apache.
>
> Here is an example of the data being sent by SQLFORM.accepts to 
> Table.insert:
>
> {'hints': [],
>  'instructions': [13L, 14L],
>  'lemmas': [],
>  'locations': [11L],
>  'modified_on': datetime.datetime(2014, 12, 19, 18, 15, 32),
>  'npcs': [32L],
>  'outcome1': '1.0',
>  'outcome2': '',
>  'outcome3': '',
>  'prompt': 'Repetition can serve to emphasize certain words in the 
> sentence, especially when the repeated words are close together. Which 
> words are emphasized in this way in \xce\x9a\xce\xb1\xcf\x84\xce\xb1 
> \xe1\xbc\xb8\xcf\x89\xce\xb1\xce\xbd\xce\xbd\xce\xb7\xcf\x82 
> 1:4?\r\n\r\n"\xe1\xbc\x98\xce\xbd \xce\xb1\xe1\xbd\x90\xcf\x84\xe1\xbf\xb3 
> \xce\xb6\xcf\x89\xce\xb7 \xe1\xbc\xa0\xce\xbd, \xce\xba\xce\xb1\xce\xb9 
> \xe1\xbc\xa1 \xce\xb6\xcf\x89\xce\xb7 \xe1\xbc\xa0\xce\xbd \xcf\x84\xce\xbf 
> \xcf\x86\xcf\x89\xcf\x82 \xcf\x84\xcf\x89\xce\xbd 
> \xe1\xbc\x80\xce\xbd\xce\xb8\xcf\x81\xcf\x89\xcf\x80\xcf\x89\xce\xbd."',
>  'prompt_audio': 1,
>  'readable_response': '\xce\xb6\xcf\x89\xce\xb7 \xe1\xbc\xa0\xce\xbd',
>  'response1': '^(\xe1\xbc\xa1 )?\xce\xb6\xcf\x89\xce\xb7( 
> \xe1\xbc\xa0\xce\xbd)?$',
>  'response2': '',
>  'response3': '',
>  'status': 1,
>  'step_options': [],
>  'tags': [202L],
>  'tags_ahead': [],
>  'tags_secondary': [],
>  'uuid': '51a9c0c0-18e5-4a9b-9b89-85eee6668170',
>  'widget_image': 9,
>  'widget_type': 1}
>
>  Again, the db record is actually created. The operation just stops any 
> further execution.
>

-- 
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 hanging on insert

2015-02-06 Thread Ian W. Scott
Thanks for your response Massimo. I'll try to put together a minimal 
version today and post it.

Ian

On Thursday, February 5, 2015 at 4:46:46 PM UTC-5, Massimo Di Pierro wrote:
>
> Does it hang if you use sqlite? Can you provide a minimalist app that we 
> can try. There is nothing wrong with your code except you do not need 
> db.commit() but it should not hurt.
>
> On Thursday, 5 February 2015 14:46:58 UTC-6, Ian W. Scott wrote:
>>
>> Hi folks. I still don't really know how to debug this problem beyond what 
>> I've done (identify the point in the gluon code where the hang happens). 
>> Can anyone at least suggest another strategy for debugging it?
>>
>> Thanks again,
>>
>> Ian
>>
>> On Thursday, January 29, 2015 at 4:00:54 PM UTC-5, Ian W. Scott wrote:
>>>
>>> I have a create form (SQLFORM) that works (a new record is actually 
>>> created) but immediately after inserting the new record the web2py process 
>>> hangs. The form remains greyed out and no other functions will work (e.g., 
>>> can't refresh the page or navigate away). But there's no error raised. Can 
>>> anyone help me figure out what is causing the hang?
>>>
>>> I've pinpointed the point where the hang occurs: the call to 
>>> gluon.DAL.Table.insert in gluon.SQLFORM.accepts (around line 1671 in the 
>>> current stable version). What's strange is that the Table.insert method 
>>> does finish without any errors. But when it returns to SQLFORM.accepts the 
>>> execution hangs. A print statement immediately following the call to 
>>> Table.insert is not executed.
>>>
>>> If it helps to know, I'm using postgresql running on apache.
>>>
>>> Here is an example of the data being sent by SQLFORM.accepts to 
>>> Table.insert:
>>>
>>> {'hints': [],
>>>  'instructions': [13L, 14L],
>>>  'lemmas': [],
>>>  'locations': [11L],
>>>  'modified_on': datetime.datetime(2014, 12, 19, 18, 15, 32),
>>>  'npcs': [32L],
>>>  'outcome1': '1.0',
>>>  'outcome2': '',
>>>  'outcome3': '',
>>>  'prompt': 'Repetition can serve to emphasize certain words in the 
>>> sentence, especially when the repeated words are close together. Which 
>>> words are emphasized in this way in \xce\x9a\xce\xb1\xcf\x84\xce\xb1 
>>> \xe1\xbc\xb8\xcf\x89\xce\xb1\xce\xbd\xce\xbd\xce\xb7\xcf\x82 
>>> 1:4?\r\n\r\n"\xe1\xbc\x98\xce\xbd \xce\xb1\xe1\xbd\x90\xcf\x84\xe1\xbf\xb3 
>>> \xce\xb6\xcf\x89\xce\xb7 \xe1\xbc\xa0\xce\xbd, \xce\xba\xce\xb1\xce\xb9 
>>> \xe1\xbc\xa1 \xce\xb6\xcf\x89\xce\xb7 \xe1\xbc\xa0\xce\xbd \xcf\x84\xce\xbf 
>>> \xcf\x86\xcf\x89\xcf\x82 \xcf\x84\xcf\x89\xce\xbd 
>>> \xe1\xbc\x80\xce\xbd\xce\xb8\xcf\x81\xcf\x89\xcf\x80\xcf\x89\xce\xbd."',
>>>  'prompt_audio': 1,
>>>  'readable_response': '\xce\xb6\xcf\x89\xce\xb7 \xe1\xbc\xa0\xce\xbd',
>>>  'response1': '^(\xe1\xbc\xa1 )?\xce\xb6\xcf\x89\xce\xb7( 
>>> \xe1\xbc\xa0\xce\xbd)?$',
>>>  'response2': '',
>>>  'response3': '',
>>>  'status': 1,
>>>  'step_options': [],
>>>  'tags': [202L],
>>>  'tags_ahead': [],
>>>  'tags_secondary': [],
>>>  'uuid': '51a9c0c0-18e5-4a9b-9b89-85eee6668170',
>>>  'widget_image': 9,
>>>  'widget_type': 1}
>>>
>>>  Again, the db record is actually created. The operation just stops any 
>>> further execution.
>>>
>>

-- 
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] ProgrammingError "violates unique constraint" when inserting into a postgresql table

2015-03-25 Thread Ian W. Scott
In a test function I set up some testing data in a postgresql database by 
first deleting my test user's data and then inserting from a dictionary:

db(db.tag_records.name == user_login['id']).delete()
db.commit()
for tr in trecs:

db.tag_records.insert(**tr)

When this hits the insert I consistently get the following error: 

ProgrammingError: ('ERROR', '23505', 'duplicate key value violates 
unique constraint "idx_name_tag"')

I've reindexed the whole database but that doesn't seem to help. Strangely, 
it seems like this error comes up on the *second* run of the code. In other 
words, the first run through the test the rows are deleted and new rows 
inserted just fine. It's when the test function runs a second time (there 
are several sets of test data) that this error appears.

I've never run into a problem like this before, and I'm not very good with 
the internals of postgresql yet. So any help is greatly appreciated. 

The table definition looks like this:

db.define_table('tag_records',
Field('name', db.auth_user, default=auth.user_id),
Field('tag', db.tags),
Field('times_right', 'double'),
Field('times_wrong', 'double'),
Field('tlast_wrong', 'datetime', default=dtnow),
Field('tlast_right', 'datetime', default=dtnow),
Field('in_path', db.paths),  # was path (reserved term)
Field('step', db.steps),
Field('secondary_right', 'list:string'),
Field('uuid', length=64, default=lambda:str(uuid.uuid4())),
Field('modified_on', 'datetime', default=request.now),
)
db.tag_records.name.requires = IS_IN_DB(db, 'auth_user.id',
db.auth_user._format)
db.tag_records.tag.requires = IS_IN_DB(db, 'tags.id', db.tags._format)
db.tag_records.step.requires = IS_IN_DB(db, 'steps.id', db.steps._format)
db.tag_records.in_path.requires = IS_IN_DB(db, 'paths.id', db.paths._format)



-- 
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: ProgrammingError "violates unique constraint" when inserting into a postgresql table

2015-03-26 Thread Ian W. Scott
Thanks Niphlod. I hired someone to migrate the db from sqlite to postgre 
and there seem to be some bugs in the migration. I hadn't noticed the lack 
of reference fields because they were originally there. I think the guy I 
hired must have removed them (?!). I'll try repairing the table definition 
first.

The unique constraint, though, is on the db index not on the table fields, 
right? 

On Wednesday, March 25, 2015 at 6:42:10 PM UTC-4, Niphlod wrote:
>
> apart from the repetitive table definition (why reinstating IS_IN_DB when 
> you can do it simply using 'reference table' instead of db.table ?)
>
> did you try creating the same table from scratch ? i.e. a tag_records2 
> table, which you can try your things on.
>
> It seems that there is a unique constraint on the table, but your model 
> isn't reflecting that enforcement. Maybe you had some migration issues.
>
>
>

-- 
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: ProgrammingError "violates unique constraint" when inserting into a postgresql table

2015-03-26 Thread Ian W. Scott
Repairing the table definition didn't help. I'm now going to try the 
operations on a fresh table.

On Thursday, March 26, 2015 at 10:42:33 AM UTC-4, Ian W. Scott wrote:
>
> Thanks Niphlod. I hired someone to migrate the db from sqlite to postgre 
> and there seem to be some bugs in the migration. I hadn't noticed the lack 
> of reference fields because they were originally there. I think the guy I 
> hired must have removed them (?!). I'll try repairing the table definition 
> first.
>
> The unique constraint, though, is on the db index not on the table fields, 
> right? 
>
> On Wednesday, March 25, 2015 at 6:42:10 PM UTC-4, Niphlod wrote:
>>
>> apart from the repetitive table definition (why reinstating IS_IN_DB when 
>> you can do it simply using 'reference table' instead of db.table ?)
>>
>> did you try creating the same table from scratch ? i.e. a tag_records2 
>> table, which you can try your things on.
>>
>> It seems that there is a unique constraint on the table, but your model 
>> isn't reflecting that enforcement. Maybe you had some migration issues.
>>
>>
>>

-- 
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: ProgrammingError "violates unique constraint" when inserting into a postgresql table

2015-03-26 Thread Ian W. Scott
OK, I ran the test code doing the inserts into a new (empty) table. The 
error didn't happen. So there must be some problem with the data in the 
existing table and/or index. (From my Googling around it looks like a 
matter of the table and index being out of sync? But I'm not sure what that 
means.) I've reindexed the table, but I'm not sure how else to go about 
fixing it.

I had no idea when I migrated to postgre that I would need to work with the 
db directly this much. The app ran fine with sqlite so I just assumed 
(naively) that web2py would handle the migration and I could continue to 
work through web2py's dal. So I realize that the issue now is partly my 
lack of understanding of postgre. But any help is much appreciated.

Ian

On Thursday, March 26, 2015 at 1:32:37 PM UTC-4, Ian W. Scott wrote:
>
> Repairing the table definition didn't help. I'm now going to try the 
> operations on a fresh table.
>
> On Thursday, March 26, 2015 at 10:42:33 AM UTC-4, Ian W. Scott wrote:
>>
>> Thanks Niphlod. I hired someone to migrate the db from sqlite to postgre 
>> and there seem to be some bugs in the migration. I hadn't noticed the lack 
>> of reference fields because they were originally there. I think the guy I 
>> hired must have removed them (?!). I'll try repairing the table definition 
>> first.
>>
>> The unique constraint, though, is on the db index not on the table 
>> fields, right? 
>>
>> On Wednesday, March 25, 2015 at 6:42:10 PM UTC-4, Niphlod wrote:
>>>
>>> apart from the repetitive table definition (why reinstating IS_IN_DB 
>>> when you can do it simply using 'reference table' instead of db.table ?)
>>>
>>> did you try creating the same table from scratch ? i.e. a tag_records2 
>>> table, which you can try your things on.
>>>
>>> It seems that there is a unique constraint on the table, but your model 
>>> isn't reflecting that enforcement. Maybe you had some migration issues.
>>>
>>>
>>>

-- 
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: ProgrammingError "violates unique constraint" when inserting into a postgresql table

2015-03-26 Thread Ian W. Scott
Found the problem. There were two rows with the same combination of 'name' 
and 'tag' values. That didn't violate any constraints on the table 
definition, so normally there was no difficulty. But it violated the 
"unique" constraint on the postgre index that indexed the 'name' and 'tag' 
columns together.

In case it helps anyone else, I stumbled across the bad data by dropping 
the index from the table (directly using postgresql, not via the dal) and 
then trying to re-create the index. Since I was using pgAdmin to do this, 
it gave me an error message identifying the offending combination of values.

Ian

On Wednesday, March 25, 2015 at 6:12:18 PM UTC-4, Ian W. Scott wrote:
>
> In a test function I set up some testing data in a postgresql database by 
> first deleting my test user's data and then inserting from a dictionary:
>
> db(db.tag_records.name == user_login['id']).delete()
> db.commit()
> for tr in trecs:
>
> db.tag_records.insert(**tr)
>
> When this hits the insert I consistently get the following error: 
>
> ProgrammingError: ('ERROR', '23505', 'duplicate key value violates 
> unique constraint "idx_name_tag"')
>
> I've reindexed the whole database but that doesn't seem to help. 
> Strangely, it seems like this error comes up on the *second* run of the 
> code. In other words, the first run through the test the rows are deleted 
> and new rows inserted just fine. It's when the test function runs a second 
> time (there are several sets of test data) that this error appears.
>
> I've never run into a problem like this before, and I'm not very good with 
> the internals of postgresql yet. So any help is greatly appreciated. 
>
> The table definition looks like this:
>
> db.define_table('tag_records',
> Field('name', db.auth_user, default=auth.user_id),
> Field('tag', db.tags),
> Field('times_right', 'double'),
> Field('times_wrong', 'double'),
> Field('tlast_wrong', 'datetime', default=dtnow),
> Field('tlast_right', 'datetime', default=dtnow),
> Field('in_path', db.paths),  # was path (reserved term)
> Field('step', db.steps),
> Field('secondary_right', 'list:string'),
> Field('uuid', length=64, default=lambda:str(uuid.uuid4
> ())),
> Field('modified_on', 'datetime', default=request.now),
> )
> db.tag_records.name.requires = IS_IN_DB(db, 'auth_user.id',
> db.auth_user._format)
> db.tag_records.tag.requires = IS_IN_DB(db, 'tags.id', db.tags._format)
> db.tag_records.step.requires = IS_IN_DB(db, 'steps.id', db.steps._format)
> db.tag_records.in_path.requires = IS_IN_DB(db, 'paths.id', db.paths.
> _format)
>
>
>
>

-- 
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] Using Travis CI to test a web2py app on Github

2015-04-08 Thread Ian W. Scott
I've set up a travis-ci.org job to run my test suite (using pytest) 
whenever I push my app to its github repository. I'm running into the basic 
problem that pytest can't find the gluon libraries, since there's nothing 
in my repo "above" the level of my app directory. Does anyone know of a 
simple way to import or install the web2py code (gluon plus contrib 
libraries) from the travis-ci process? Or am I trying to do the impossible?

Here's my .travis.yml file:

language: python
python:
  - "2.7"
# Handle git submodules yourself
git:
submodules: false
# Use sed to replace the SSH URL with the public URL, then initialize 
submodules
before_install:
- sed -i 's/g...@github.com:/https:\/\/github.com\//' .gitmodules
- git submodule update --init --recursive
# command to install dependencies, e.g. pip install -r requirements.txt 
--use-mirrors
install: "pip install pytest"
# command to run tests, e.g. python setup.py test
script: py.test applications/paideia/tests/modules/test_paideia.py 

And here's the error traceback from the travis-ci job:

Traceback (most recent call last):

  File 
"/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/_pytest/config.py",
 line 543, in importconftest

mod = conftestpath.pyimport()

  File 
"/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/py/_path/local.py",
 line 641, in pyimport

__import__(modname)

  File "/home/travis/build/monotasker/paideia/tests/conftest.py", line 87, in 


from gluon.shell import env

ImportError: No module named gluon.shell

ERROR: could not load /home/travis/build/monotasker/paideia/tests/conftest.py




Thanks,

Ian

-- 
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] unicode error with postgre on 2.10.3 (with sample app)

2015-04-11 Thread Ian W. Scott
Thanks Richard. My production server is working fine with 2.9.11. I'll open 
an issue on the web2py github repo, since it sounds like that's the better 
forum for this.

Ian


On Friday, April 10, 2015 at 3:40:16 PM UTC-4, Richard wrote:
>
> Ok, ok, I guess there is an issue with web2py or pyDAL... Can you test 
> this with an earlier version of web2py? If it works consider open an issue 
> in web2py on github with condition to reproduce the error and if it coming 
> form pyDAL the issue will be migrate to pyDAL repo once the origin of the 
> issue is found.
>
> Richard
>
> On Fri, Apr 10, 2015 at 3:24 PM, Ian W. Scott  > wrote:
>
>> Also, as I pointed out in my question I can insert the same string (with 
>> the same encoding) directly into the postgre database using the raw SQL 
>> code that is being sent by pydal to the postgre adapter. I inserted a print 
>> statement into adapters/base.py to give me the exact SQL command, copied 
>> that SQL command (data and all), then ran it in pgAdmin with no problem. So 
>> it can't be a problem with the encoding of the string being received by the 
>> pydal.
>>
>> Ian
>>
>> On Friday, April 10, 2015 at 2:05:25 PM UTC-4, Richard wrote:
>>>
>>> Can you please show the code that lead to this error?
>>>
>>> If you hard code this you can't use a regular string (str()) which is 
>>> ascii characters only you have to pass by unicode something like this :
>>>
>>> string = u'ἀγοραζε'.decode(utf-8)
>>>
>>> http://stackoverflow.com/questions/6289474/working-
>>> with-utf-8-encoding-in-python-source
>>>
>>> If the greek character come form user input web2py deal with this to my 
>>> knowledge... So I am pretty sure you hard code greek character in your 
>>> code... So you need to read about encoding in python...
>>>
>>> Richard
>>>
>>>
>>>
>>> On Fri, Apr 10, 2015 at 1:29 PM, Ian W. Scott  wrote:
>>>
>>>> Hi folks,
>>>>
>>>> I'm running into an error with 2.10.3 when I try to write unicode text 
>>>> (outside the Latin ranges) to a regular string field in a postgre 
>>>> database. 
>>>> Since my app is a greek language-learning application this error breaks 
>>>> things completely for me.
>>>>
>>>> When I try, for example, to insert the string 'ἀγοραζε' I get the 
>>>> following error:
>>>>
>>>> Traceback (most recent call last):
>>>>
>>>>   File "applications/paideia/modules/paideia.py", line 168, in start
>>>> pre_bug_step_id=pre_bug_step_id)
>>>>   File "applications/paideia/modules/paideia.py", line 384, in reply
>>>> response_string)
>>>>   File "applications/paideia/modules/paideia.py", line 655, in 
>>>> _record_step
>>>> log_record_id = db.attempt_log.insert(**log_args)
>>>>   File "/home/ian/web/web2py/gluon/packages/dal/pydal/objects.py", 
>>>> line 745, in insert
>>>> ret =  self._db._adapter.insert(self, self._listify(fields))
>>>>   File "/home/ian/web/web2py/gluon/packages/dal/pydal/adapters/base.py"
>>>> , line 729, in insert
>>>> raise e
>>>> UnicodeDecodeError: 'ascii' codec can't decode byte 0xe1 in position 
>>>> 105: ordinal not in range(128)
>>>>
>>>>
>>>> The SQL being sent to the postgre adapter in this case was this:
>>>>
>>>> INSERT INTO attempt_log(name,user_response,step,score,modified_on,dt_
>>>> attempted,in_path,uuid) VALUES (19,'ἀγοραζε',773,1.0,'2015-04-10 
>>>> 12:33:25','2015-04-10 16:33:26',657,'5918a65a-6d6f-
>>>> 42c6-9af2-f5d0e313701e') RETURNING id;
>>>>
>>>> When I execute that SQL command directly on the postgre database it 
>>>> doesn't raise any errors and the new row is created fine.
>>>>
>>>> I've created a simple app that duplicates the error and attached the 
>>>> packed app here. Since the error doesn't happen with sqlite, I've set up 
>>>> the app db for a postgre database with the following connection details:
>>>>
>>>> username = 'postgres'
>>>> postgre host = 'localhost'
>>>> postgre db_name = 'unicode_bug_test'
>>>>
>>>> I've 

[web2py] Re: Using Travis CI to test a web2py app on Github

2015-04-11 Thread Ian W. Scott
I take it from the lack of response here that what I want to is just 
impossible?

On Wednesday, April 8, 2015 at 10:57:15 AM UTC-4, Ian W. Scott wrote:
>
> I've set up a travis-ci.org job to run my test suite (using pytest) 
> whenever I push my app to its github repository. I'm running into the basic 
> problem that pytest can't find the gluon libraries, since there's nothing 
> in my repo "above" the level of my app directory. Does anyone know of a 
> simple way to import or install the web2py code (gluon plus contrib 
> libraries) from the travis-ci process? Or am I trying to do the impossible?
>
> Here's my .travis.yml file:
>
> language: python
> python:
>   - "2.7"
> # Handle git submodules yourself
> git:
> submodules: false
> # Use sed to replace the SSH URL with the public URL, then initialize 
> submodules
> before_install:
> - sed -i 's/g...@github.com:/https:\/\/github.com\//' .gitmodules
> - git submodule update --init --recursive
> # command to install dependencies, e.g. pip install -r 
> requirements.txt --use-mirrors
> install: "pip install pytest"
> # command to run tests, e.g. python setup.py test
> script: py.test applications/paideia/tests/modules/test_paideia.py 
>
> And here's the error traceback from the travis-ci job:
>
> Traceback (most recent call last):
>
>   File 
> "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/_pytest/config.py",
>  line 543, in importconftest
>
> mod = conftestpath.pyimport()
>
>   File 
> "/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages/py/_path/local.py",
>  line 641, in pyimport
>
> __import__(modname)
>
>   File "/home/travis/build/monotasker/paideia/tests/conftest.py", line 87, in 
> 
>
> from gluon.shell import env
>
> ImportError: No module named gluon.shell
>
> ERROR: could not load /home/travis/build/monotasker/paideia/tests/conftest.py
>
>
>
>
> Thanks,
>
> Ian
>

-- 
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 hanging on insert

2015-04-11 Thread Ian W. Scott
Update: When I put together a minimal app I couldn't reproduce the problem. 
I've had to set aside working on the issue, but it does seem to be limited 
to working with one specific table in my app's db. When I get back to 
debugging this I'll post any solutions for the sake of posterity.

On Friday, February 6, 2015 at 12:10:58 PM UTC-5, Ian W. Scott wrote:
>
> Thanks for your response Massimo. I'll try to put together a minimal 
> version today and post it.
>
> Ian
>
> On Thursday, February 5, 2015 at 4:46:46 PM UTC-5, Massimo Di Pierro wrote:
>>
>> Does it hang if you use sqlite? Can you provide a minimalist app that we 
>> can try. There is nothing wrong with your code except you do not need 
>> db.commit() but it should not hurt.
>>
>> On Thursday, 5 February 2015 14:46:58 UTC-6, Ian W. Scott wrote:
>>>
>>> Hi folks. I still don't really know how to debug this problem beyond 
>>> what I've done (identify the point in the gluon code where the hang 
>>> happens). Can anyone at least suggest another strategy for debugging it?
>>>
>>> Thanks again,
>>>
>>> Ian
>>>
>>> On Thursday, January 29, 2015 at 4:00:54 PM UTC-5, Ian W. Scott wrote:
>>>>
>>>> I have a create form (SQLFORM) that works (a new record is actually 
>>>> created) but immediately after inserting the new record the web2py process 
>>>> hangs. The form remains greyed out and no other functions will work (e.g., 
>>>> can't refresh the page or navigate away). But there's no error raised. Can 
>>>> anyone help me figure out what is causing the hang?
>>>>
>>>> I've pinpointed the point where the hang occurs: the call to 
>>>> gluon.DAL.Table.insert in gluon.SQLFORM.accepts (around line 1671 in the 
>>>> current stable version). What's strange is that the Table.insert method 
>>>> does finish without any errors. But when it returns to SQLFORM.accepts the 
>>>> execution hangs. A print statement immediately following the call to 
>>>> Table.insert is not executed.
>>>>
>>>> If it helps to know, I'm using postgresql running on apache.
>>>>
>>>> Here is an example of the data being sent by SQLFORM.accepts to 
>>>> Table.insert:
>>>>
>>>> {'hints': [],
>>>>  'instructions': [13L, 14L],
>>>>  'lemmas': [],
>>>>  'locations': [11L],
>>>>  'modified_on': datetime.datetime(2014, 12, 19, 18, 15, 32),
>>>>  'npcs': [32L],
>>>>  'outcome1': '1.0',
>>>>  'outcome2': '',
>>>>  'outcome3': '',
>>>>  'prompt': 'Repetition can serve to emphasize certain words in the 
>>>> sentence, especially when the repeated words are close together. Which 
>>>> words are emphasized in this way in \xce\x9a\xce\xb1\xcf\x84\xce\xb1 
>>>> \xe1\xbc\xb8\xcf\x89\xce\xb1\xce\xbd\xce\xbd\xce\xb7\xcf\x82 
>>>> 1:4?\r\n\r\n"\xe1\xbc\x98\xce\xbd \xce\xb1\xe1\xbd\x90\xcf\x84\xe1\xbf\xb3 
>>>> \xce\xb6\xcf\x89\xce\xb7 \xe1\xbc\xa0\xce\xbd, \xce\xba\xce\xb1\xce\xb9 
>>>> \xe1\xbc\xa1 \xce\xb6\xcf\x89\xce\xb7 \xe1\xbc\xa0\xce\xbd 
>>>> \xcf\x84\xce\xbf 
>>>> \xcf\x86\xcf\x89\xcf\x82 \xcf\x84\xcf\x89\xce\xbd 
>>>> \xe1\xbc\x80\xce\xbd\xce\xb8\xcf\x81\xcf\x89\xcf\x80\xcf\x89\xce\xbd."',
>>>>  'prompt_audio': 1,
>>>>  'readable_response': '\xce\xb6\xcf\x89\xce\xb7 \xe1\xbc\xa0\xce\xbd',
>>>>  'response1': '^(\xe1\xbc\xa1 )?\xce\xb6\xcf\x89\xce\xb7( 
>>>> \xe1\xbc\xa0\xce\xbd)?$',
>>>>  'response2': '',
>>>>  'response3': '',
>>>>  'status': 1,
>>>>  'step_options': [],
>>>>  'tags': [202L],
>>>>  'tags_ahead': [],
>>>>  'tags_secondary': [],
>>>>  'uuid': '51a9c0c0-18e5-4a9b-9b89-85eee6668170',
>>>>  'widget_image': 9,
>>>>  'widget_type': 1}
>>>>
>>>>  Again, the db record is actually created. The operation just stops any 
>>>> further execution.
>>>>
>>>

-- 
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] Custom comparison function with orderby in select()

2015-04-30 Thread Ian W. Scott
I want to sort the results of a select() based on a string field. Normally 
I can just use select(orderby=db.mytable.myfield), but the strings are not 
in Latin characters, so the default string sorting produces unacceptable 
results. 

I've figured out how to create a comparison function using the PyICU 
bindings to the ICU library. In a regular list sort this allows me to do 
something like this:

from icu import Locale, Collator
myloc = Locale('el')
col = Collator.createInstance(myloc) 
words = ['ἀγ', 'βλα', 'ὁμηρ']
sorted_words = sorted(words, cmp=col.compare) 

Is there any way to pass this kind of custom collating function to the 
select()?   

-- 
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: Custom comparison function with orderby in select()

2015-05-05 Thread Ian W. Scott
A belated thanks, Anthony. I had forgotten about the rows.sort() method.

On Thursday, April 30, 2015 at 5:13:23 PM UTC-4, Anthony wrote:
>
> The sorting via orderby is handled by the database, so you can't use 
> Python code for that, as it must be executed by the database. However, the 
> Rows object has a .sort() method, which does the sorting in Python after 
> the records are returned by the database. See 
> http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#find--exclude--sort
> .
>
> Note, depending on the size of the dataset, sorting in Python might be 
> slower than having the database handle it.
>
> Anthony
>
> On Thursday, April 30, 2015 at 3:42:06 PM UTC-4, Ian W. Scott wrote:
>>
>> I want to sort the results of a select() based on a string field. 
>> Normally I can just use select(orderby=db.mytable.myfield), but the strings 
>> are not in Latin characters, so the default string sorting produces 
>> unacceptable results. 
>>
>> I've figured out how to create a comparison function using the PyICU 
>> bindings to the ICU library. In a regular list sort this allows me to do 
>> something like this:
>>
>> from icu import Locale, Collator
>> myloc = Locale('el')
>> col = Collator.createInstance(myloc) 
>> words = ['ἀγ', 'βλα', 'ὁμηρ']
>> sorted_words = sorted(words, cmp=col.compare) 
>>
>> Is there any way to pass this kind of custom collating function to the 
>> select()?   
>>
>

-- 
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: Using Travis CI to test a web2py app on Github

2015-05-05 Thread Ian W. Scott
I was distracted from this thread, but a belated thanks for your response, 
Niphlod. To clarify, the error I posted was from Travis CI's remote 
process. I have no problem running my tests locally, but in that case I can 
start a web2py instance normally as part of the testing process. The 
problem on Travis is precisely how to get web2py's libraries in the path. I 
can't see a way, but I'm not experienced with Travis so I was wondering 
whether someone else might have more experience. 

By the way, Richard, I think this *is* a relevant (web2py) question for the 
forum because the question is whether web2py's specific architecture is 
compatible with a particular (common) testing tool. The answer may be 'no', 
but I don't think the question is off-topic.



On Monday, April 13, 2015 at 3:18:56 PM UTC-4, Niphlod wrote:
>
> take from the lack of response that if it doesn't run on your machine, 
> it's not going to run on travis-ci 
> For starters, it seems that gluon is not importable
> how do you fetch web2py's libraries and put them into the path ?
>
>

-- 
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] After changing db adapter "relation 'auth_user' already exists"

2015-05-06 Thread Ian W. Scott
To work around my earlier unicode problem (I submitted an issue on Github) 
I switched from the pg8000 adapter to the psycopg2 adapter for my postgre 
database. Everything works fine as long as I have migrate set to False. But 
if I set migrate=True I get this error:

(relation "auth_user" already exists 
)

This is strange because the dal shouldn't be trying to perform any 
migrations. Nothing in the model definitions or the db structure was 
changed. The only change was the db adapter. Thinking my .table files might 
have been corrupted, I tried doing a fake migrate by setting migrate=False 
and fake_migrate_all=True, then switching both values again. But nothing 
has changed. I'm still getting the same error as long as migrations are 
turned on.

Here's the full traceback:

Traceback (most recent call last):
 File "/home/ian/web/web2py-dev/gluon/restricted.py", line 227, in restricted
 exec ccode in environment
 File "/home/ian/web/web2py-dev/applications/paideia/models/db.py" 
, line 192, in 

 auth.define_tables() # creates all needed tables
 File "/home/ian/web/web2py-dev/gluon/tools.py", line 1893, in define_tables
 format='%(first_name)s %(last_name)s (%(id)s)'))
 File "/home/ian/web/web2py-dev/gluon/packages/dal/pydal/base.py", line 817, in 
define_table
 table = self.lazy_define_table(tablename,*fields,**args)
 File "/home/ian/web/web2py-dev/gluon/packages/dal/pydal/base.py", line 856, in 
lazy_define_table
 polymodel=polymodel)
 File "/home/ian/web/web2py-dev/gluon/packages/dal/pydal/adapters/base.py", 
line 463, in create_table
 self.create_sequence_and_triggers(query,table)
 File "/home/ian/web/web2py-dev/gluon/packages/dal/pydal/adapters/postgres.py", 
line 86, in create_sequence_and_triggers
 self.execute(query)
 File "/home/ian/web/web2py-dev/gluon/packages/dal/pydal/adapters/base.py", 
line 1326, in execute
 return self.log_execute(*a, **b)
 File "/home/ian/web/web2py-dev/gluon/packages/dal/pydal/adapters/base.py", 
line 1320, in log_execute
 ret = self.cursor.execute(command, *a[1:], **b)
ProgrammingError: relation "auth_user" already exists

-- 
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] New import problem when testing web2py app with pytest

2015-05-15 Thread Ian W. Scott
I've been successfully using pytest for quite a while now to do unit 
testing for my web2py apps. Today, after upgrading to the latest web2py 
version (Version 2.10.4-stable+timestamp.2015.04.26.15.11.54) my tests 
won't run. When I try to run the tests in a test file (in the tests/ 
directory) web2py tries to import that test file as a module and raises an 
ImportError.

For example, I have a test file at 
myapp/tests/modules/test_greek_parser.py. I try to run it like this:

python2.7 -m pytest -xvs applications/paideia/tests/modules/
test_greek_parser.py

The error looks like this:

= test session starts 
=
platform linux2 -- Python 2.7.9 -- py-1.4.20 -- pytest-2.5.2 -- /usr/bin/python 
  
collected 0 items / 1 errors   
   

  
=== ERRORS 

__ ERROR collecting applications/paideia/tests/modules/
test_greek_parser.py ___
/usr/local/lib/python2.7/dist-packages/py/_path/local.py:620: in pyimport   
   
>   __import__(modname) 
   
gluon/custom_import.py:89: in custom_importer   
   
>   raise ImportError, 'Cannot import module %s' 
% str(e)   
E   ImportError: Cannot import module 
'applications.paideia.modules.test_greek_parser'
=== 1 error in 0.01 seconds 
===


It's not surprising that custom_importer can't find the module, since it 
doesn't exist! It's looking for a file with my test file name, but looking 
in the myapp/modules/ directory. I'm not even sure why gluon is trying to 
import something with that file name at all.

Now, if this isn't strange enough already, this import error only happens 
with some of my test files. Others (in the same tests/modules/ directory) 
run without a hitch. But I can't for the life of me find any significant 
difference between the two.

I'm attaching a couple of files here in case they help shed any light:

1. my conftest.py which is read by pytest before running the tests (this 
seems to be fine; it sits in the parent 'tests' directory)
2. test_paideia_utils.py (which runs without any problem)
3. test_greek_parser.py (which raises the import error)

I realize that this may appear to be a pytest problem rather than a web2py 
problem. But the error is happening because custom_importer is being called 
somewhere, so at the least it looks like some recent update has introduced 
an incompatibility with pytest. Again, these tests were all running fine 
(with the same conftest.py)

Thanks again for any help. I'm really at a loss with this one!

-- 
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.
#!/usr/bin/env python

'''
py.test configuration and fixtures file.

This file is lightly adapted from the one by viniciusban;
Part of the web2py.test model app (https://github.com/viniciusban/web2py.test)

This file
- Tells application it's running in a test environment.
- Creates a complete web2py environment, similar to web2py shell.
- Creates a WebClient instance to browse your application, similar to a real
web browser.
- Propagates some application data to test cases via fixtures, like baseurl
and automatic appname discovery.

To write to db in test:

web2py.db.table.insert(**data)
web2py.db.commit()

To run tests:

cd web2py (you must be in web2py root directory to run tests)
python web2py.py -a my_password --nogui &
py.test -x [-l] [-q|-v] -s applications/my_app_name/tests

'''

import os
import pytest
import sys
from pprint import pprint
sys.path.insert(0, '')

# allow imports from modules and site-packages
dirs = os.path.split(__file__)[0]
appname = dirs.split(os.path.sep)[-2]
modules_path = os.path.join('applications', appname, 'modules')
if modules_path not in sys.path:
sys.path.append(modules_path)  # imports from app modules folder
if 'site-packages' not in sys.path:
sys.path.append('site-packages')  # imports from site-packages

from gluon.shell import en

[web2py] Re: New import problem when testing web2py app with pytest

2015-05-15 Thread Ian W. Scott
Never mind! I discovered the problem in my conftest.py file. Thanks anyway!

On Friday, May 15, 2015 at 3:57:47 PM UTC-4, Ian W. Scott wrote:
>
> I've been successfully using pytest for quite a while now to do unit 
> testing for my web2py apps. Today, after upgrading to the latest web2py 
> version (Version 2.10.4-stable+timestamp.2015.04.26.15.11.54) my tests 
> won't run. When I try to run the tests in a test file (in the tests/ 
> directory) web2py tries to import that test file as a module and raises an 
> ImportError.
>
> For example, I have a test file at 
> myapp/tests/modules/test_greek_parser.py. I try to run it like this:
>
> python2.7 -m pytest -xvs applications/paideia/tests/modules/
> test_greek_parser.py
>
> The error looks like this:
>
> = test session starts 
> =
> platform linux2 -- Python 2.7.9 -- py-1.4.20 -- pytest-2.5.2 -- 
> /usr/bin/python 
>   
> collected 0 items / 1 errors 
>  
>   
> 
> === ERRORS 
> 
> __ ERROR collecting applications/paideia/tests/modules
> /test_greek_parser.py ___
> /usr/local/lib/python2.7/dist-packages/py/_path/local.py:620: in pyimport 
>  
> >   __import__(modname)   
>  
> gluon/custom_import.py:89: in custom_importer 
>  
> >   raise ImportError, 'Cannot import module 
> %s' % str(e)   
> E   ImportError: Cannot import module 
> 'applications.paideia.modules.test_greek_parser'
> === 1 error in 0.01 seconds 
> ===
>
>
> It's not surprising that custom_importer can't find the module, since it 
> doesn't exist! It's looking for a file with my test file name, but looking 
> in the myapp/modules/ directory. I'm not even sure why gluon is trying to 
> import something with that file name at all.
>
> Now, if this isn't strange enough already, this import error only happens 
> with some of my test files. Others (in the same tests/modules/ directory) 
> run without a hitch. But I can't for the life of me find any significant 
> difference between the two.
>
> I'm attaching a couple of files here in case they help shed any light:
>
> 1. my conftest.py which is read by pytest before running the tests (this 
> seems to be fine; it sits in the parent 'tests' directory)
> 2. test_paideia_utils.py (which runs without any problem)
> 3. test_greek_parser.py (which raises the import error)
>
> I realize that this may appear to be a pytest problem rather than a web2py 
> problem. But the error is happening because custom_importer is being called 
> somewhere, so at the least it looks like some recent update has introduced 
> an incompatibility with pytest. Again, these tests were all running fine 
> (with the same conftest.py)
>
> Thanks again for any help. I'm really at a loss with this one!
>

-- 
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: Keep values with a list:string field?

2015-08-12 Thread Ian W. Scott
I never got any suggestions on this, even though it seems like a 
significant limitation of the widget. Has anyone come up with a solution 
for keeping all the values in a list:string field after form submission?

Thanks.

On Wednesday, June 25, 2014 at 11:33:26 AM UTC-4, Ian W. Scott wrote:
>
> I've got a SQLFORM.factory form set to keep values after processing with 
> process(keepvalues=True). But it doesn't work on a list:string field. The 
> (otherwise very nice) widget loses all but the first value when the form is 
> submitted (i.e., all but the first text inputs for the field disappear). Is 
> there any way to carry those other text inputs and their values over?
>
>
>

-- 
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: Keep values with a list:string field?

2015-08-12 Thread Ian W. Scott
se:
wordlists = [vv['words'].split('|')]
paths = self.make_path(wordlists,
   label_template=vv.label_template,
   stepsdata=stepsdata,
   testing=vv.testing,
   avoid=vv.avoid,
           aligned=vv.aligned
   )
message, output = self.make_output(paths)


elif form.errors:
message = BEAUTIFY(form.errors)








On Wednesday, August 12, 2015 at 11:04:46 AM UTC-4, Richard wrote:
>
> Could you show your model and controller...
>
> This make no sens...
>
> Richard
>
> On Wed, Aug 12, 2015 at 10:45 AM, Ian W. Scott  > wrote:
>
>> I never got any suggestions on this, even though it seems like a 
>> significant limitation of the widget. Has anyone come up with a solution 
>> for keeping all the values in a list:string field after form submission?
>>
>> Thanks.
>>
>>
>> On Wednesday, June 25, 2014 at 11:33:26 AM UTC-4, Ian W. Scott wrote:
>>>
>>> I've got a SQLFORM.factory form set to keep values after processing with 
>>> process(keepvalues=True). But it doesn't work on a list:string field. The 
>>> (otherwise very nice) widget loses all but the first value when the form is 
>>> submitted (i.e., all but the first text inputs for the field disappear). Is 
>>> there any way to carry those other text inputs and their values over?
>>>
>>>
>>> -- 
>> 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+un...@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: Keep values with a list:string field?

2015-08-12 Thread Ian W. Scott
No, they're not submitted if I re-submit the form with the preserved 
values. 

Ian

On Wednesday, August 12, 2015 at 1:25:01 PM UTC-4, Richard wrote:
>
> Is the form widget only display the last input but insert the other 
> values? I mean, it may be possible that values are there but not correctly 
> display by the widget...
>
> Richard
>
> On Wed, Aug 12, 2015 at 1:21 PM, Ian W. Scott  > wrote:
>
>> Sorry if I'm not explaining this well. The default widget for a 
>> list:string field is a vertically stacked list of inputs, one per value. 
>> There is a little + at right that allows me to add more inputs to the list 
>> dynamically. 
>>
>> In a SQLFORM, when I set keepvalues=True the values are preserved in the 
>> form fields after form submission. But only one of the inputs from the 
>> list:string widget is left, holding just the last string value submitted 
>> for that field. In other words, the form doesn't remember the additional 
>> inputs I added to the widget (by clicking +) before submission, and it 
>> forgets the submitted values from those additional inputs as well.
>>
>> I've experienced this on many forms, so I don't think it's my code. In 
>> the case that brought this up for me again, I'm creating a SQLFORM.factory 
>> with the fields defined in the controller. (You can see that I've got some 
>> for loops to simplify the creation and processing of a large number of 
>> fields, but otherwise it's straightforward.) The problem appears with the 
>> widgets for any of the list:string fields:
>>
>> 
>> message = ''
>> output = ''
>>
>> flds = [Field('label_template', 'string'),
>> Field('words', 'list:string'),
>> Field('aligned', 'boolean'),
>> Field('avoid', 'list:string'),
>> Field('testing', 'boolean')]
>>
>>
>> for n in ['one', 'two', 'three', 'four', 'five']:
>> fbs = [Field('{}_prompt_template'.format(n), 'list:string'),
>>Field('{}_response_template'.format(n), 'list:string'
>> ),
>>Field('{}_readable_template'.format(n), 'list:string'
>> ),
>>Field('{}_tags'.format(n), 'list:reference tags',
>>  requires=IS_IN_DB(db, 'tags.id', '%(tag)s',
>>multiple=True)),
>>Field('{}_tags_secondary'.format(n), 'list:reference 
>> tags',
>>  requires=IS_IN_DB(db, 'tags.id', '%(tag)s',
>>multiple=True)),
>>Field('{}_tags_ahead'.format(n), 'list:reference tags'
>> ,
>>  requires=IS_IN_DB(db, 'tags.id', '%(tag)s',
>>multiple=True)),
>>Field('{}_npcs'.format(n), 'list:reference npcs',
>>  requires=IS_IN_DB(db, 'npcs.id', '%(name)s',
>>multiple=True)),
>>Field('{}_locations'.format(n), 'list:reference 
>> locations',
>>  requires=IS_IN_DB(db, 'locations.id',
>>'%(map_location)s',
>>multiple=True)),
>>Field('{}_instructions'.format(n),
>>  'list:reference step_instructions',
>>  requires=IS_IN_DB(db, 'step_instructions.id',
>>'%(instruction_label)s',
>>multiple=True)),
>>Field('{}_hints'.format(n), 'list:reference 
>> step_hints',
>>  requires=IS_IN_DB(db, 'step_hints.id',
>>'%(hint_label)s',
>>multiple=True)),
>>Field('{}_step_type'.format(n), 'list:reference 
>> step_types',

Re: [web2py] Re: Keep values with a list:string field?

2015-08-12 Thread Ian W. Scott
Sure, I'll post a dummy app here. It'll probably be later tonight or 
tomorrow.

Ian

On Wednesday, August 12, 2015 at 2:04:28 PM UTC-4, Richard wrote:
>
> Hi Ian,
>
> Can you pack a dummy app with a list:string field an single field form 
> with SQLFORM.factory so I can try it here and confirm your issue...
>
> Also, can you tell us which web2py version you use.
>
> Thanks
>
> Richard
>
> PS.: Once I confirm I have the issue we should open a ticket on github...
>
> #
>
> On Wed, Aug 12, 2015 at 1:41 PM, Ian W. Scott  > wrote:
>
>> No, they're not submitted if I re-submit the form with the preserved 
>> values. 
>>
>> Ian
>>
>> On Wednesday, August 12, 2015 at 1:25:01 PM UTC-4, Richard wrote:
>>>
>>> Is the form widget only display the last input but insert the other 
>>> values? I mean, it may be possible that values are there but not correctly 
>>> display by the widget...
>>>
>>> Richard
>>>
>>> On Wed, Aug 12, 2015 at 1:21 PM, Ian W. Scott  wrote:
>>>
>>>> Sorry if I'm not explaining this well. The default widget for a 
>>>> list:string field is a vertically stacked list of inputs, one per value. 
>>>> There is a little + at right that allows me to add more inputs to the list 
>>>> dynamically. 
>>>>
>>>> In a SQLFORM, when I set keepvalues=True the values are preserved in 
>>>> the form fields after form submission. But only one of the inputs from the 
>>>> list:string widget is left, holding just the last string value submitted 
>>>> for that field. In other words, the form doesn't remember the additional 
>>>> inputs I added to the widget (by clicking +) before submission, and it 
>>>> forgets the submitted values from those additional inputs as well.
>>>>
>>>> I've experienced this on many forms, so I don't think it's my code. In 
>>>> the case that brought this up for me again, I'm creating a SQLFORM.factory 
>>>> with the fields defined in the controller. (You can see that I've got some 
>>>> for loops to simplify the creation and processing of a large number of 
>>>> fields, but otherwise it's straightforward.) The problem appears with the 
>>>> widgets for any of the list:string fields:
>>>>
>>>> 
>>>> message = ''
>>>> output = ''
>>>>
>>>> flds = [Field('label_template', 'string'),
>>>> Field('words', 'list:string'),
>>>> Field('aligned', 'boolean'),
>>>> Field('avoid', 'list:string'),
>>>> Field('testing', 'boolean')]
>>>>
>>>>
>>>> for n in ['one', 'two', 'three', 'four', 'five']:
>>>> fbs = [Field('{}_prompt_template'.format(n), 'list:string'
>>>> ),
>>>>Field('{}_response_template'.format(n), 
>>>> 'list:string'),
>>>>Field('{}_readable_template'.format(n), 
>>>> 'list:string'),
>>>>Field('{}_tags'.format(n), 'list:reference tags',
>>>>  requires=IS_IN_DB(db, 'tags.id', '%(tag)s',
>>>>multiple=True)),
>>>>Field('{}_tags_secondary'.format(n), 'list:reference 
>>>> tags',
>>>>  requires=IS_IN_DB(db, 'tags.id', '%(tag)s',
>>>>multiple=True)),
>>>>Field('{}_tags_ahead'.format(n), 'list:reference 
>>>> tags',
>>>>  requires=IS_IN_DB(db, 'tags.id', '%(tag)s',
>>>>multiple=True)),
>>>>Field('{}_npcs'.format(n), 'list:reference npcs',
>>>>  requires=IS_IN_DB(db, 'npcs.id', '%(name)s',
>>>>multiple=True)),
>>>>Field('{}_locations'.format(n), &#

Re: [web2py] Re: Keep values with a list:string field?

2015-08-14 Thread Ian W. Scott
I agree with Richard that the issue (or my issue at least) has to do with 
the widget, not with the internals of the field type or its validators.

There are, I think, valid use cases in which you want to use a list-string 
field but can't know ahead-of-time what the possible values will be. In one 
of my forms I'm (using SQLFORM.factory) using a list:string field to enter 
a series of word sets that will be used to build a subsequent collection of 
quiz questions automatically. I don't want to have to define ahead of time 
all the word-sets I might choose! But I'm also not concerned about 
duplication because the entered word-sets are just being used temporarily 
for the quiz-question generation. This may seem like an edge case, but I've 
got several forms with similar legitimate uses of list:string without a 
pre-defined set of values.

In fact, the widget I'm having trouble with (text input with links to add 
more inputs below) only appears with list:string fields that *don't* have 
IS_IN_SET or IS_IN_DB. So this kind of use -- entry of and arbitrary number 
of arbitrary strings -- seems to be exactly what the web2py widget was 
designed to handle.

As such, I think this *is* a shortcoming of the widget that should be 
fixed. The widget is being used for its intended purpose, but it's not 
following the "keepvalues" behaviour set for the SQLFORM. I'll submit a 
ticket on github.

Val K's suggestion isn't complete, partly because it's now bypassing the 
SQLFORM's own keepvalues setting entirely. But thanks for the suggestion 
and I'll think more about it.

Ian

On Friday, August 14, 2015 at 9:24:29 AM UTC-4, Richard wrote:
>
> You need to use form.vars at first... At the begining your form is emptyl, 
> so you need to get the inputed value from the form not from request.vars... 
> You take them form request.vars for field default but when you redirect you 
> need to pass the form.vars to url...
>
> But even then, I am not sure it will works... The problem seems more about 
> the list:string type field which doesn't know how to handel available 
> values except if you use IS_IN_SET()...
>
> Richard
>
> On Thu, Aug 13, 2015 at 4:53 PM, Val K > 
> wrote:
>
>> Hello!
>> Looks some terrible, but does what you want!
>> Just paste in any controller and go to   .../list_fld_keep_values_tst
>> or you can preset list-values by URL('your_controller', '
>> list_fld_keep_values_tst', vars=dict(defs=['val_1','val_2','val_3']))
>>
>> def list_fld_keep_values_tst():
>> 
>> frm=SQLFORM.factory(  Field('fld_lst', 'list:srting', default = 
>> request.vars.defs)  )
>> if frm.process().accepted:
>> 
>> #place your code here,  before redirect!
>> 
>> session.flash='Well are you happy now? Let me know in any case!'
>> redirect(URL('list_fld_keep_values_tst', vars=dict(defs=request.
>> vars.fld_lst) ))
>> elif  frm.errors:
>> #do any 
>> response.flash='there are errors!' 
>> return dict(frm=frm)
>>
>>
>>
>>
>> On Wednesday, June 25, 2014 at 6:33:26 PM UTC+3, Ian W. Scott wrote:
>>>
>>> I've got a SQLFORM.factory form set to keep values after processing with 
>>> process(keepvalues=True). But it doesn't work on a list:string field. The 
>>> (otherwise very nice) widget loses all but the first value when the form is 
>>> submitted (i.e., all but the first text inputs for the field disappear). Is 
>>> there any way to carry those other text inputs and their values over?
>>>
>>>
>>> -- 
>> 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+un...@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: Keep values with a list:string field?

2015-08-14 Thread Ian W. Scott
Thanks Richard. I will if I have time. I find these small fixes have a way 
of becoming bigger projects than I expect :)

Ian

On Friday, August 14, 2015 at 10:27:53 AM UTC-4, Richard wrote:
>
> Ian, you may also just write your own widget for list:string that way it 
> should behave correctly...
>
>
> http://web2py.com/books/default/chapter/29/07/forms-and-validators?search=widget#Widgets
>
> def my_string_widget(field, value):
> return INPUT(_name=field.name,
>  _id="%s_%s" % (field._tablename, field.name),
>  _class=field.type,
>  _value=value,
>  requires=field.requires)
>
> Field('comment', 'string', widget=my_string_widget)
>
>
> On Fri, Aug 14, 2015 at 9:50 AM, Ian W. Scott  > wrote:
>
>> I agree with Richard that the issue (or my issue at least) has to do with 
>> the widget, not with the internals of the field type or its validators.
>>
>> There are, I think, valid use cases in which you want to use a 
>> list-string field but can't know ahead-of-time what the possible values 
>> will be. In one of my forms I'm (using SQLFORM.factory) using a list:string 
>> field to enter a series of word sets that will be used to build a 
>> subsequent collection of quiz questions automatically. I don't want to have 
>> to define ahead of time all the word-sets I might choose! But I'm also not 
>> concerned about duplication because the entered word-sets are just being 
>> used temporarily for the quiz-question generation. This may seem like an 
>> edge case, but I've got several forms with similar legitimate uses of 
>> list:string without a pre-defined set of values.
>>
>> In fact, the widget I'm having trouble with (text input with links to add 
>> more inputs below) only appears with list:string fields that *don't* have 
>> IS_IN_SET or IS_IN_DB. So this kind of use -- entry of and arbitrary number 
>> of arbitrary strings -- seems to be exactly what the web2py widget was 
>> designed to handle.
>>
>> As such, I think this *is* a shortcoming of the widget that should be 
>> fixed. The widget is being used for its intended purpose, but it's not 
>> following the "keepvalues" behaviour set for the SQLFORM. I'll submit a 
>> ticket on github.
>>
>> Val K's suggestion isn't complete, partly because it's now bypassing the 
>> SQLFORM's own keepvalues setting entirely. But thanks for the suggestion 
>> and I'll think more about it.
>>
>> Ian
>>
>> On Friday, August 14, 2015 at 9:24:29 AM UTC-4, Richard wrote:
>>>
>>> You need to use form.vars at first... At the begining your form is 
>>> emptyl, so you need to get the inputed value from the form not from 
>>> request.vars... You take them form request.vars for field default but when 
>>> you redirect you need to pass the form.vars to url...
>>>
>>> But even then, I am not sure it will works... The problem seems more 
>>> about the list:string type field which doesn't know how to handel available 
>>> values except if you use IS_IN_SET()...
>>>
>>> Richard
>>>
>>> On Thu, Aug 13, 2015 at 4:53 PM, Val K  wrote:
>>>
>>>> Hello!
>>>> Looks some terrible, but does what you want!
>>>> Just paste in any controller and go to   .../list_fld_keep_values_tst
>>>> or you can preset list-values by URL('your_controller', '
>>>> list_fld_keep_values_tst', vars=dict(defs=['val_1','val_2','val_3']))
>>>>
>>>> def list_fld_keep_values_tst():
>>>> 
>>>> frm=SQLFORM.factory(  Field('fld_lst', 'list:srting', default = 
>>>> request.vars.defs)  )
>>>> if frm.process().accepted:
>>>> 
>>>> #place your code here,  before redirect!
>>>> 
>>>> session.flash='Well are you happy now? Let me know in any 
>>>> case!'
>>>> redirect(URL('list_fld_keep_values_tst', vars=dict(defs=request
>>>> .vars.fld_lst) ))
>>>> elif  frm.errors:
>>>> #do any 
>>>> response.flash='there are errors!' 
>>>> return dict(frm=frm)
>>>>
>>>>
>>>>
>>>>
>>>> On Wednesday, June 25, 2014 at 6:33:26 PM UTC+3, Ian W. Scott wrote:
>>>>>
>>>>>

[web2py] How to store etree object that can't be pickled

2015-08-28 Thread Ian W. Scott
I have a parsed lxml.etree object that I need to persist from one request 
to the next so that users can interact with it. The problem is that etree 
objects can't be pickled, so when I try to store it in session I get a 
PicklingError. I just tried using memcache instead, but it seems to use 
pickling as well and raises the same PicklingError.

Is there any way to store an un-picklable object (maybe in memory somehow?) 
so that it's accessible to web2py on subsequent requests?

Thanks,

Ian

-- 
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 store etree object that can't be pickled

2015-08-29 Thread Ian W. Scott


On Saturday, August 29, 2015 at 10:03:42 PM UTC-4, Leonel Câmara wrote:
>
> Well you can use etree.tostring and save that. Another alternative is to 
> put it in cache ram which does not pickle.
>

I'd like to avoid serializing out to a string because I'd then have to do 
the parsing over again on the next request. How would I go about putting it 
in a ram cache? (I looked at memcache, but it looks like the Python wrapper 
uses pickling). If you can just point me to the relevant package(s) for 
this kind of caching I can read the docs. But I've found my google searches 
to be less than helpful on this.

Thanks,

Ian 

-- 
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] Error 'module' object has no attribute 'Reference_unpickler'

2015-09-15 Thread Ian W. Scott
Hi. I just tried to access the admin/errors/appname page and I got the 
following error:

 'module' object has no attribute 
'Reference_unpickler'


Traceback (most recent call last):
 File "/home/ianwscott/webapps/web2py/web2py/gluon/restricted.py", line 227, 
in restricted
 exec ccode in environment
 File 
"/home/ianwscott/webapps/web2py/web2py/applications/admin/controllers/default.py"
 

, line 1969, in 
 File "/home/ianwscott/webapps/web2py/web2py/gluon/globals.py", line 412, in 

 self._caller = lambda f: f()
 File 
"/home/ianwscott/webapps/web2py/web2py/applications/admin/controllers/default.py"
 

, line 1579, in errors
 error = pickle.load(fullpath_file)
 File "/usr/local/lib/python2.7/pickle.py", line 1378, in load
 return Unpickler(file).load()
 File "/usr/local/lib/python2.7/pickle.py", line 858, in load
 dispatch[key](self)
 File "/usr/local/lib/python2.7/pickle.py", line 1090, in load_global
 klass = self.find_class(module, name)
 File "/usr/local/lib/python2.7/pickle.py", line 1126, in find_class
 klass = getattr(mod, name)
AttributeError: 'module' object has no attribute 'Reference_unpickler'


 Any suggestions as to what is causing this? I'm using the following 
version and config:

2.11.2-stable+timestamp.2015.05.30.16.33.24
(Running on Apache/2.2.17 (Unix) mod_wsgi/3.3 Python/2.7.9, Python 2.7.9) 

-- 
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.


  1   2   >