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
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?
--
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
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
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
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
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?
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
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'
Appreciate it...
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:
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
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
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
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
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
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...
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...
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'))),
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
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
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
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
= 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
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
25 matches
Mail list logo