[web2py] Re: ipython notebook and web2py

2016-01-08 Thread pepper_bg
Sorry to resurrect an older thread, do let me know if I should create a new one. I had this perfectly working as described in this thread. Then I upgraded to Jupyter and things fell apart. The thing just doesn't have profiles, startup folders, none of the way iPython Notebook used to set

[web2py] Re: Bug in request_reset_password

2014-03-04 Thread pepper_bg
Sorry, forgot to specify (but thought it's obvious). The app was configured to use usernames. On Saturday, March 1, 2014 10:51:32 PM UTC-8, Tim Richardson wrote: I assume you see this for a specific app. Is this app configured for login via usernames or via email addresses? --

[web2py] Bug in request_reset_password

2014-03-01 Thread pepper_bg
Not sure how to report this so posting here, please let me know if there is a separate bug tracking system. Just upgraded an existing web2py installation to 2.8.2-stable+timestamp.2013.11.28.13.54.07 using the 'Check for upgrades' button in Admin. Works fine so far except

[web2py] Re: CAS auto login for all apps

2011-11-10 Thread pepper_bg
I still need to click login button right now. Just add @auth.login_required on top of the controller functions you want to auto login from in the consumers and if you are logged in at the CAS provider you will get logged in here as well (I believe this what you are describing you want to do now

[web2py] contains() subtleties on GAE

2011-11-09 Thread pepper_bg
So on GAE this seems to be fine: db(db.my_table.my_set.contains([1], all=False)).select() while this: db(db.my_table.my_set.contains([1,2], all=False)).select() seems to always boil down to an OR somewhere deep bellow: File /base/data/home/apps/s~my_app/1.354557643063785927/gluon/ dal.py, line

[web2py] Re: CAS auto login for all apps

2011-11-09 Thread pepper_bg
I have my CAS working properly. First, what do you mean by that? CAS works out of the box. Here is how to test the scenario *I think* you are describing: 1. From the web interface create three applications app1, app2, app3 (app1 and app2 will be consumers, app3 the CAS provider). 2. In app1

[web2py] Re: CAS auto login for all apps

2011-11-09 Thread pepper_bg
Yes, the fact that your applications are sharing a DB connection already means that you don't need CAS. Can you describe what you are trying to do?

[web2py] Re: CAS auto login for all apps

2011-11-09 Thread pepper_bg
One login, one username for all. What approach should I do then? You seem to be already on the right track: 1. Make your applications share a DB. You are already doing this auth.define_tables(migrate=False). Debug that error you are getting or post here the complete trace. 2. Make them share

[web2py] Conditional presence of a variable in view

2011-11-08 Thread pepper_bg
I have a controller/view like these: def control(): if some_condition(): return dict(form=form) else: return dict(form=form, table=get_table()) {{extend 'layout.html'}} {{=form}} {{if table:}}{{=table}}{{pass}} i.e. 'form' is always present in the view and 'table'

[web2py] Re: Conditional presence of a variable in view

2011-11-08 Thread pepper_bg
Appreciate it...

[web2py] Re: 1.99 gluon/tools.py replace_id mishandling url [SOLVED]

2011-11-05 Thread pepper_bg
This one has been torturing me for a while. Here is how to replicate it consistently (and possibly fix it): 1. Create a brand new application (in my case named 'ttt') 2. In db.py say auth.settings.expiration=10 (so sessions expire quick) 3. In the default controller create a new function:

[web2py] Re: Reusing a prefilled, readonly SQLFORM.factory form?

2011-11-04 Thread pepper_bg
This got solved by using the fact that Field.default could be manipulated *after* the Field has been created (following the above line of examples): def build_form(readonly=False): #create fields or get from db field1=Field('test') field2=db.my_table.best #set defaults

[web2py] Reusing a prefilled, readonly SQLFORM.factory form?

2011-11-03 Thread pepper_bg
I have some functionality which generates a custom SQLFORM.factory form (reads/writes to different tables, handles uploads, etc.). All works fine but somewhere down the flow I just wanted to display that same form prefilled and readonly. For whatever reason I can't prefill it and make it readonly

[web2py] Re: Reusing a prefilled, readonly SQLFORM.factory form?

2011-11-03 Thread pepper_bg
I think he wants to re-use an existing factory form, so presumably couldn't specify/change the default values after the form has already been created, right? Correct. The code is more like: def frm(): form=build_form(readonly=True) return dict(form=form) build_form is defined

[web2py] Caching a gluon.storage.Storage instance on GAE

2011-10-28 Thread pepper_bg
This one just hit me when I uploaded the app on GAE. No problems whatsoever on the local development environment where I can pickle/ unpickle any Storage instance with Python 2.5. The trace looks like: Traceback (most recent call last): File

[web2py] gluon.storage.Storage interface discrepancy?

2011-10-25 Thread pepper_bg
So gluon.storage.Storage is an amended dict subclass with dot notation indexing added. With the additional twist that when a key is missing s['missing_key'] will still raise the standard dict KeyError, while s.missing_key will return None. All this is fine, only as long as your keys are strings

[web2py] Re: gluon.storage.Storage interface discrepancy?

2011-10-25 Thread pepper_bg
You can do s.get(6,None) Still have to anticipate what my keys are and write different code accordingly. Which is fine in most cases I guess. Or may be I am trying to be too generic here. Thanks for your input...

[web2py] Re: Dealing with arbitary user defined DAL fields

2011-10-24 Thread pepper_bg
Or you can use full blown EAV - http://en.wikipedia.org/wiki/Entity-attribute-value_model. It may be overkill in many cases but is great for large sparse matrices, depends on the details of your project...

[web2py] upload field in a generic form?

2011-10-24 Thread pepper_bg
Have to go to the experts for this. I have a table for storing arbitrary user data: db.define_table('extra_attributes', Field('user', db.auth_user), Field('name'), Field('type', requires = IS_IN_SET(('text','file'))),

[web2py] Re: upload field in a generic form?

2011-10-24 Thread pepper_bg
Great, response.stream did it! The exact code I end up using (in case someone else needs to get around the 'no_table.XXX' file name scenario). Another reason I like this approach (vs http://mysite.com/my_app/my_cont/download/uploads/no_table.document.9b6546236b10.623456345667.png) is the

[web2py] Reusing a view

2011-10-18 Thread pepper_bg
I am curious about the general case of how a view file can be reused but here is my specific example. I need custom user registration and profile pages so my controller (default.py) looks like: def profile(): return dict(form=generate_profile_form()) def register(): return

[web2py] Re: Reusing a view

2011-10-18 Thread pepper_bg
response.view was what I was looking for (remember seeing it somewhere but then lost it), thank you guys... Rather than providing links to /user/register and then redirecting to /register, why not just provide links directly to /register? You don't have to route requests to register or to view

[web2py] using web2py globals in modules

2011-10-13 Thread pepper_bg
Hi, I have some helper code in applications/myapp/modules/site_helpers.py. I've been trying to cache the results of some of the functions there. The current content is: from gluon.shell import exec_environment ee = exec_environment('applications/myapp/models/db.py') cache = ee.cache

[web2py] Re: using web2py globals in modules

2011-10-13 Thread pepper_bg
= current.foo # current already has session, request, response and T http://zerp.ly/rochacbruno Em 13/10/2011 04:38, pepper_bg ilief...@gmail.com escreveu: Hi, I have some helper code in applications/myapp/modules/site_helpers.py. I've been trying to cache the results of some

[web2py] Re: using web2py globals in modules

2011-10-13 Thread pepper_bg
from gluon import * def myfunction():     foo = current.foo Great, good to know... How do I apply this to current.cache though? Sounds to me this automatically means I can't use the @cache(...) decorator outside of a controller (Python just barfs at @current.cache(...)). I guess I could still