[web2py] Re: Possibly a problem with CAS redirection in v2.8.2

2013-12-24 Thread Vinicius Assef
Anyone?

On Fri, Dec 20, 2013 at 6:05 PM, Vinicius Assef  wrote:
> Hi guys,
> I'm playing around with CAS and faced this error:
>  begin here 
> The webpage at 
> http://localhost:8000/cas/default/user/cas/login?service=http://localhost:8000/consumer/default/user/login#
> has resulted in too many redirects. Clearing your cookies for this
> site or allowing third-party cookies may fix the problem. If not, it
> is possibly a server configuration issue and not a problem with your
> computer.
>
> Error code: ERR_TOO_MANY_REDIRECTS
>  end here 
>
> It occurs in v2.8.2, but not in v2.7.4.
>
> My scenario is simple:
> 1- One CAS provider application, called "cas". Actually, a raw copy of
> welcome application. Nothing more, nothing less.
> 2- One CAS consumer, called "consumer". Another copy of welcome
> application with just one single modification in db.py:
> auth = Auth(db, cas_provider="http://localhost:8000/cas/default/user/cas";)
> 3- In consumer application, I have a default.py/protected() function
> with @auth.requires_login() decorator.
>
> The workflow to reproduce the error is:
> 1) Try to go to http://localhost:8000/consumer/protected.
> 2) The login form will show up (from cas application).
> 3) When I fill the form and click submit, the error happens.
>
> Is there anything I must configure in v2.8.2 to allow CAS to work out?

-- 
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: login crash under 2.8.2

2013-12-24 Thread lucas
ok, so centos 6x is the way to go for the most stable, reliable, etc., in 
excellence of computing?  that is what you are saying, because i really 
love centos and have been using it for years.  but i have been doubting my 
httpd.conf setups for a while because all of those settings and then add in 
VirtualHosts and it gets pretty mind boggling.  so i really really 
appreciate a proof of my config files and let me know what could be 
unstable.  so here they are as attachments.

-- 
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: splitting fields from one table across two functions/views

2013-12-24 Thread lucas
ok, so i wrote a new application and did the minimum to strip away the 
other code and things i am doing to prove that this behaviour is quite 
odd.   i wrote this under web2py 2.4.6.

here is the added code for a default *db.py*:
#begin
db = DAL('postgres://postgres:passwd@localhost/test', pool_size=29)

db.define_table('test1',
Field('master_id', 'integer', required=IS_NOT_EMPTY()),
Field('input_date', 'datetime', writable=False, readable=False, 
requires=NE, default=datetime.datetime.today()),
Field('s1', length=16),
Field('i1', 'integer'),
Field('s2', length=16),
Field('i2', 'integer'),
format = '%(id)s, %(master_id)s')
#end
where the table is emulating a detail table of a master and must store the 
master_id reference.

here is the code added to a default *default.py* file:
#begin
def test1a():
try:
tidi = mcp.request_to_int(request.args[0]) #test id
except:
tidi = None
tTest = db.test1
#sTest = db(tTest.id==tidi).select().first()
now = datetime.datetime.utcnow()
sform = SQLFORM(tTest, record=tidi, fields=['id', 'master_id', 's1', 
'i1'])
sform.vars.master_id = 1
sform.vars.input_date = sform.vars.input_date
#return HTML(BODY("tidi: %s" % tidi, BR(), "now: %s" % now, BR(), "%s" 
% sform))
if sform.process(onvalidation=chk_test1a).accepted:
response.flash = "TEST1a Updated"
elif sform.errors:
response.flash = "TEST1a Errors"
slist = db(tTest.id>0).select(orderby=tTest.id)
for i in slist:
i.input_date = A(i.input_date, _href=URL(f="test1a", args=[i.id]))
return dict(slist=slist, sform=sform)

def chk_test1a(f):
v = f.vars
v.s1 = v.s1[:16]
return f

def test1b():
try:
tidi = mcp.request_to_int(request.args[0]) #test id
except:
tidi = None
tTest = db.test1
#sTest = db(tTest.id==tidi).select().first()
now = datetime.datetime.utcnow()
sform = SQLFORM(tTest, record=tidi, fields=['id', 'master_id', 's2', 
'i2'])
sform.vars.master_id = 1
#return HTML(BODY("tidi: %s" % tidi, BR(), "now: %s" % now, BR(), "%s" 
% sform))
if sform.process(onvalidation=chk_test1b).accepted:
response.flash = "TEST1b Updated"
elif sform.errors:
response.flash = "TEST1b Errors"
slist = db(tTest.id>0).select(orderby=tTest.id)
for i in slist:
i.input_date = A(i.input_date, _href=URL(f="test1b", args=[i.id]))
return dict(slist=slist, sform=sform)

def chk_test1b(f):
v = f.vars
v.s2 = v.s2[:16]
return f
#end

and here is the code for the *test1a.html* view file:
#begin
{{left_sidebar_enabled=right_sidebar_enabled=False}}
{{extend 'layout.html'}}

{{=A("Goto test1b", _href=URL(f="test1b"))}}

{{=slist}}
{{=A("Add New Record", _href=URL(f="test1a"))}}
{{=sform.custom.begin}}

{{=sform.custom.widget.id}}
S1:{{=sform.custom.widget.s1}}
I1:{{=sform.custom.widget.i1}}
{{=sform.custom.submit}}

{{if sform.errors:
=sform.errors
pass}}
{{=sform.custom.end}}

{{=sform}}
#end

and similarly here is the code for the *test1b.html* view file:
#begin
{{left_sidebar_enabled=right_sidebar_enabled=False}}
{{response.subsubtitle = "TEST1b"}}
{{extend 'layout.html'}}

{{=A("Goto test1a", _href=URL(f="test1a"))}}

{{=slist}}
{{=A("Add New Record", _href=URL(f="test1b"))}}
{{=sform.custom.begin}}

{{=sform.custom.widget.id}}
S2:{{=sform.custom.widget.s2}}
I2:{{=sform.custom.widget.i2}}
{{=sform.custom.submit}}

{{if sform.errors:
=sform.errors
pass}}
{{=sform.custom.end}}
#end

which is just the opposite of test1a.

try it without the fields option under SQLFORM.  you will see the wiping or 
nulling of the other fields' data.  with the fields options, the master_id 
and input_date don't work right because then those fields are wiped or 
nulled.  i need all of the data to stick and stay no matter which view is 
running.

thanx in advance and hopefully this proves the point.  lucas

-- 
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] building model at run-time?

2013-12-24 Thread Giuseppe D'Amico
Hi I am  a newbie to web2py, I would like to know if there is a way to 
build the model of a database at run-time, for my application I have to 
connect to a legacy database and making queries on it, thus I thought   
that I need to build   the model at run-time, I cane connect to the db with 
dal and query it about its table, can create the tables, but I do not know 
how to add the field to them, somewhere  on internet I found append_field, 
but when used my script return this error: KeyError: 'append_field'

-- 
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: login crash under 2.8.2

2013-12-24 Thread LightDot
Ok, so you're using one mod_wsgi / web2py instance and map virtualhosts 
into specific apps within. Looks like a neat solution, but it seems to be 
problematic in the same way Leonel is describing for the Windows 
environment. Basically, different virtualhosts under the same 
WSGIDaemonProcess have issues with sessions...

We use a separate web2py and a seperate WSGIDaemonProcess for each 
virtualhost, that's why we didn't experience problems...

As for centos - sure, I think it's a great choice. Any good RHEL 
derivative, for that matter. We've been using Scientific Linux 6 and CentOS 
2, 3 and 5 before that. RHEL derivatives do a great job for us. I'm not 
saying other distros aren't suitable, it's just that these tick all the 
boxes for us.

Regards


On Tuesday, December 24, 2013 1:01:45 PM UTC+1, lucas wrote:
>
> ok, so centos 6x is the way to go for the most stable, reliable, etc., in 
> excellence of computing?  that is what you are saying, because i really 
> love centos and have been using it for years.  but i have been doubting my 
> httpd.conf setups for a while because all of those settings and then add in 
> VirtualHosts and it gets pretty mind boggling.  so i really really 
> appreciate a proof of my config files and let me know what could be 
> unstable.  so here they are as attachments.  i primarily tried not the 
> change httpd.conf much at all and put most of it under conf.d, so the other 
> trhee attachments would be under conf.d.  i have multiple files like 
> weinstruct.conf, just changed slightly for that one is my boilerplate for 
> the other domains.
>
> thanx for the help and the advice in advance.  lucas
>

-- 
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] Modifying an uploaded CSV file

2013-12-24 Thread Gael Princivalle
Hi all.

I have to import a lot of CSV files that have fields separated by ";".
In web2py it seems that only "," is accepted.

How can I upload a file and replace all ";" by "," ?

I've tried like that with replace but this attribute is not valid:
form = SQLFORM.factory(
Field('table',requires=IS_IN_SET(db.tables)),
Field('csvfile','upload',uploadfield=False))
form.process()
if form.accepted:
table = form.vars.table
csvfile = request.vars.csvfile.file
csvfile = csvfile.replace(';',',')
db[table].import_from_csv_file(csvfile)

Someone have a suggestion ?

Best regards.


-- 
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: Modifying an uploaded CSV file

2013-12-24 Thread Niphlod
web2py follows standardsa CSV is a Comma Separated Value file, that by 
default are separated by a comma: your's is with semicolons, so I'd advise 
parsing it with csv.reader (fiddling with separator and quotechar) and then 
make your own import algo (once parsed, it's just a loop iterating inserts)
http://docs.python.org/2/library/csv.html

On Tuesday, December 24, 2013 4:20:39 PM UTC+1, Gael Princivalle wrote:
>
> Hi all.
>
> I have to import a lot of CSV files that have fields separated by ";".
> In web2py it seems that only "," is accepted.
>
> How can I upload a file and replace all ";" by "," ?
>
> I've tried like that with replace but this attribute is not valid:
> form = SQLFORM.factory(
> Field('table',requires=IS_IN_SET(db.tables)),
> Field('csvfile','upload',uploadfield=False))
> form.process()
> if form.accepted:
> table = form.vars.table
> csvfile = request.vars.csvfile.file
> csvfile = csvfile.replace(';',',')
> db[table].import_from_csv_file(csvfile)
>
> Someone have a suggestion ?
>
> Best regards.
>
>
>

-- 
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: building model at run-time?

2013-12-24 Thread Niphlod
I'd suggest at least reading the DAL chapter of the book. My advice is that 
if your project needs to query hundreds of legacy tables, DAL won't help 
you. On the other end, if you have 20-30 tables is pretty easy to "learn" 
the syntax and define tables with migrate=False that will avoid creating 
those tables (because they exist already in your backend) and use those 
definitions in DAL.
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer

On Tuesday, December 24, 2013 2:07:44 PM UTC+1, Giuseppe D'Amico wrote:
>
> Hi I am  a newbie to web2py, I would like to know if there is a way to 
> build the model of a database at run-time, for my application I have to 
> connect to a legacy database and making queries on it, thus I thought   
> that I need to build   the model at run-time, I cane connect to the db with 
> dal and query it about its table, can create the tables, but I do not know 
> how to add the field to them, somewhere  on internet I found append_field, 
> but when used my script return this error: KeyError: 'append_field'
>

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


Re: [web2py] Please stop embedding Bootstrap classes in your HTML!

2013-12-24 Thread Sorgfelt
It sounds like a good idea.  So, the first thing I tried was to make one 
class name for a standard data table/grid to use throughout my application, 
like so:

.datagrid {
  .table;
  .table-bordered;
  .table-striped;
  .table-condensed;
}

But I get errors from less that it can't find .table-striped or 
.table-condensed.  I found out that this is because those two classes are 
not defined in bootstrap without reference to table elements underneath the 
table element, such as td or th.  So, although I can specify all of these 
bootstrap class names in the table element, and it all works, when I try to 
use my single custom class name datagrid, instead of all of those table-* 
classes, it does not work.  So, I am forced to use the bootstrap classes, 
anyway.

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


Re: [web2py] Re: OFF TOPIC - Online plotting with https://plot.ly

2013-12-24 Thread Matt Sundquist
Hey all,

Thanks for checking out Plotly! Basic story: Plotly is a graphing and 
analytics platform that lets you code, analyze, and visualize your data 
with others collaboratively. Then, you can share graphs, download them, and 
embed them.

We're big fans of Sage and are eager to be a useful resource for folks 
using Sage. See here for 
the commits we've just made to our Python API, thanks to feedback and a 
pull request from Harald Schilly. 

You can fork the API here . We've set it up like 
GitHub: public sharing is free, and users can get an upgraded membership 
for private files. 

We've just launched our API, and would very much welcome your feedback, 
suggestions, and advice. Expert commentary has gone a long way for us, and 
we'd love to hear your thoughts and appreciate any and all help.

All my best,
Matt

On Wednesday, March 20, 2013 11:08:38 AM UTC-7, Alan Etkin wrote:
>
> Were you taking about http://www.sagemath.org/
>>
>> Site seems to be down...
>>
>
> Yes. It is a heavy, well known, resource for Python math tools. Perhaps 
> there was a server problem when you tried it. It is available now.
>

-- 
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] links in texts stoded in a database

2013-12-24 Thread jonas
Hi

How do you put links to other sites in a text that is stored in a database? 
for example, I have a blogg where all coments, posts etc are stored in a 
database. Everytime I add a post I do it from the admin interface by adding 
new entries in the database. But adding a link in the text is not working 
because it is simple interpretated as plain text. how do I solve this? 

the blogg: http://md1frejo.pythonanywhere.com/kontra

thanks in advance


-- 
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] pre populating a form

2013-12-24 Thread Avi A
Hi,
reading this:
"Pre-populating the form

It is always possible to pre-populate a form using the syntax:

form.vars.name = 'fieldvalue'.."

I'm trying this:

{{=form.custom.begin}}
{{form.vars.f_org_member= auth.user.id}}
{{=form.custom.widget.f_org_rep}}
{{=form.custom.widget.f_org_member}}
{{=form.custom.submit}}
{{=form.custom.end}}

but it's not doing what I thought it should do, replace the list of users 
with just the current one which should pick an organization. ( this field 
should be hidden bty).
Any help?
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/groups/opt_out.


[web2py] Re: login crash under 2.8.2

2013-12-24 Thread lucas
ok LightDot,

just to confirm the tweak i should do for the sake of stability.  you are 
saying that under each VirtualHost i should have a separate 
WSGIDaemonProcess under it.  or, i should remove the WSGIDaemonProcess from 
the wsgi.conf file and place it under each domains VirtualHost section.   
is that correct?  and if so, are there other options i should include in 
that line beside what i already have:

WSGIDaemonProcess web2py user=apache group=apache


  thanx in advance and really thank you for the vote of confidence and 
confirmation on centos.  it is great i have been betting on the right horse.  
lucas


On Tuesday, December 24, 2013 9:47:19 AM UTC-5, LightDot wrote:
>
> Ok, so you're using one mod_wsgi / web2py instance and map virtualhosts 
> into specific apps within. Looks like a neat solution, but it seems to be 
> problematic in the same way Leonel is describing for the Windows 
> environment. Basically, different virtualhosts under the same 
> WSGIDaemonProcess have issues with sessions...
>
> We use a separate web2py and a seperate WSGIDaemonProcess for each 
> virtualhost, that's why we didn't experience problems...
>
> As for centos - sure, I think it's a great choice. Any good RHEL 
> derivative, for that matter. We've been using Scientific Linux 6 and CentOS 
> 2, 3 and 5 before that. RHEL derivatives do a great job for us. I'm not 
> saying other distros aren't suitable, it's just that these tick all the 
> boxes for us.
>
> Regards
>

-- 
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] foreign key mismatch

2013-12-24 Thread Gael Princivalle
Hi all.

I'm going mad on this problem.
Probably my lambda function for the represent products.brand is not correct 
but I don't know where.
Like that ny application works, but I cannot add some products rows, web2py 
says:" foreign key mismatch"
db.define_table('brands',
Field('id_01', 'id'),
Field('name'),
format='%(name)s')
db.define_table('products',
Field('id_01', 'id'),
Field('code'),
Field('material_number'),
Field('description'),
#brand is an integer, the same as brands.id_01
Field('brand', 'reference brands', requires = IS_IN_DB(db,db
.brands.id_01, '%(name)s'),
  represent=lambda id, r: db.brands[id].name),
Field('pdf_path'),
Field('price_list', type='double'),
Field('in_stock', type='integer'),
format='%(code)s - %(price_list).2f')

Function argument list 

(self=, table=, fields=[(<
gluon.dal.Field object>, '6636356'), (, 'ghgh'), (<
gluon.dal.Field object>, 'ghhfh'), (, 782), (, 45.0), (, 0), (, 'r35455')])

Code listing 

1306.
1307.
1308.
1309.
1310.
1311.

1312.
1313.
1314.
1315.

self.execute(query)
except Exception:
e = sys.exc_info()[1]
if hasattr(table,'_on_insert_error'):
return table._on_insert_error(table,fields,e)
raise e

if hasattr(table,'_primarykey'):
return dict([(k[0].name, k[1]) for k in fields \
 if k[0].name in table._primarykey])
id = self.lastrowid(table)



Someone can help me ?

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


Re: [web2py] Please stop embedding Bootstrap classes in your HTML!

2013-12-24 Thread Nikolay Marusov
Have you @import'ed Bootstrap CSS files into .less? Perhaps this will help.

вторник, 24 декабря 2013 г., 1:15:44 UTC+4 пользователь Sorgfelt написал:
>
> It sounds like a good idea.  So, the first thing I tried was to make one 
> class name for a standard data table/grid to use throughout my application, 
> like so:
>
> .datagrid {
>   .table;
>   .table-bordered;
>   .table-striped;
>   .table-condensed;
> }
>
> But I get errors from less that it can't find .table-striped or 
> .table-condensed.  I found out that this is because those two classes are 
> not defined in bootstrap without reference to table elements underneath the 
> table element, such as td or th.  So, although I can specify all of these 
> bootstrap class names in the table element, and it all works, when I try to 
> use my single custom class name datagrid, instead of all of those table-* 
> classes, it does not work.  So, I am forced to use the bootstrap classes, 
> anyway.
>

-- 
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: pre populating a form

2013-12-24 Thread Massimo Di Pierro
form.vars.f_org_member= auth.user.id

should be done before the form is processed or better

db.tablename.f_org_member.default = auth.user.id

before the form is defined.



On Tuesday, 24 December 2013 17:00:21 UTC-6, Avi A wrote:
>
> Hi,
> reading this:
> "Pre-populating the form
>
> It is always possible to pre-populate a form using the syntax:
>
> form.vars.name = 'fieldvalue'.."
>
> I'm trying this:
>
> {{=form.custom.begin}}
> {{form.vars.f_org_member= auth.user.id}}
> {{=form.custom.widget.f_org_rep}}
> {{=form.custom.widget.f_org_member}}
> {{=form.custom.submit}}
> {{=form.custom.end}}
>
> but it's not doing what I thought it should do, replace the list of users 
> with just the current one which should pick an organization. ( this field 
> should be hidden bty).
> Any help?
> 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/groups/opt_out.


[web2py] Re: pre populating a form

2013-12-24 Thread Avi A
The later nicely works. :)
Thanks.


On Wednesday, December 25, 2013 5:41:18 AM UTC+2, Massimo Di Pierro wrote:
>
> form.vars.f_org_member= auth.user.id
>
> should be done before the form is processed or better
>
> db.tablename.f_org_member.default = auth.user.id
>
> before the form is defined.
>
>
>
> On Tuesday, 24 December 2013 17:00:21 UTC-6, Avi A wrote:
>>
>> Hi,
>> reading this:
>> "Pre-populating the form
>>
>> It is always possible to pre-populate a form using the syntax:
>>
>> form.vars.name = 'fieldvalue'.."
>>
>> I'm trying this:
>>
>> {{=form.custom.begin}}
>> {{form.vars.f_org_member= auth.user.id}}
>> {{=form.custom.widget.f_org_rep}}
>> {{=form.custom.widget.f_org_member}}
>> {{=form.custom.submit}}
>> {{=form.custom.end}}
>>
>> but it's not doing what I thought it should do, replace the list of users 
>> with just the current one which should pick an organization. ( this field 
>> should be hidden bty).
>> Any help?
>> 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/groups/opt_out.


[web2py] Re: links in texts stoded in a database

2013-12-24 Thread 黄祥
i think you can achieve it with put the rich text editor in your form input
ref:
https://groups.google.com/forum/#!topic/web2py/OoZ1EI8OOmw

another way is with put the html code in your input text area form or 
either use markmin.
the first is the easiest.

best regards,
stifan

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