[web2py] Re: Issue Tracker and web interface for Mercurial

2011-11-10 Thread Gour
> it is really annoying that the mercurial apis are poorly documented
> and broke already 3 times with mercurial updates.

Have you seen:

http://article.gmane.org/gmane.comp.version-control.mercurial.general/28839


Sincerely,
Gour


-- 
One who restrains his senses, keeping them under full control, 
and fixes his consciousness upon Me, is known as a man of 
steady intelligence.

http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810


signature.asc
Description: PGP signature


Re: [web2py] Id been Shown Instead of Name in dropdown list

2011-11-10 Thread Naleen Yadav
Thanks for your reply Bruno
but still its not working , it is behaving as it was.

Regards,
Naleen Yadav
GENPRO Technologies Pvt Ltd.

On Fri, Nov 11, 2011 at 11:41 AM, Bruno Rocha  wrote:

> I guess you need
>
> db.define_table("tblDriver",
>   Field("DriverName",'string',label='Driver Name'),
>   Field('id_tblVehicle', db.tblVehicle,label='Vehicle Name'))
> db.tblDriver.id_tblVehicle.requires=IS_IN_DB(db, 'tblVehicle.id', '%(
> VehicleName)s')
>
> --
>
> Bruno Rocha
> [http://rochacbruno.com.br]
>
>


Re: [web2py] Re: Detecting if a session has ended

2011-11-10 Thread Bruno Rocha
On Wed, Nov 9, 2011 at 5:14 PM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> auth.settings.logout_onlogout = lambda user: do_something_with(user)


Why dont we clean the specific session file/registry when user logged out?

*auth.settings.logout_onlogout = lambda user: remove_session(user)*

is there a problem on doing that?


-- 

Bruno Rocha
[http://rochacbruno.com.br]


Re: [web2py] Id been Shown Instead of Name in dropdown list

2011-11-10 Thread Bruno Rocha
*or you can try:*

db.define_table("tblVehicle",
  Field("*VehicleName_id*",db.tblVehicleName,label='Vehicle Name'),
  Field("VehicleNo", default=None,label='VehicleNo'),
  format=*lambda row: "%s" % row.**VehicleName_id.VehicleName* )
db.tblVehicle.VehicleName.requires=IS_IN_DB(db,'tblVehicleName.id','%(
VehicleName)s')

* # Creating tblDriver adding Driver name and selecting the name of vehicle
from the dropdown*

db.define_table("tblDriver",
  Field("DriverName",'string',label='Driver Name'),
  Field('id_tblVehicle', db.tblVehicle,label='Vehicle Name'))
db.tblDriver.id_tblVehicle.requires=IS_IN_DB(db, 'tblVehicle.id')

By thw way you have problem with the name you give to the fields, try to
name references with *tablename_id* to avoid confusion.


-- 

Bruno Rocha
[http://rochacbruno.com.br]


Re: [web2py] Id been Shown Instead of Name in dropdown list

2011-11-10 Thread Bruno Rocha
I guess you need

db.define_table("tblDriver",
  Field("DriverName",'string',label='Driver Name'),
  Field('id_tblVehicle', db.tblVehicle,label='Vehicle Name'))
db.tblDriver.id_tblVehicle.requires=IS_IN_DB(db, 'tblVehicle.id', '%(
VehicleName)s')

-- 

Bruno Rocha
[http://rochacbruno.com.br]


Re: [web2py] Re: Detecting if a session has ended

2011-11-10 Thread Sathvik Ponangi
I'm using a Users table & sessions to handle users.

db.define_table('users',
> db.Field('name', 'string'),
> db.Field('password', 'password'),#If local user
> db.Field('active', 'boolean', default=False),
> db.Field('uid', 'string'),
> db.Field('slinked', 'string', default=""),#Redirect to
> a linked account
> db.Field('last_in', 'datetime', default=request.now),
> db.Field('date', 'datetime', default=request.now,
> writable=False)
> )


Is it a good idea to switch-over to auth? If so, how do I do it?


On Thu, Nov 10, 2011 at 3:44 AM, Richard Vézina  wrote:

> Thank you!
>
> Richard
>
>
> On Wed, Nov 9, 2011 at 4:23 PM, Massimo Di Pierro <
> massimo.dipie...@gmail.com> wrote:
>
>> They are usually called
>>
>> auth.settings.login_onaccept = lambda form: ..
>> auth.settings.profile_onaccept = lambda form: ..
>> auth.settings._onaccept = lambda form: ..
>>
>> and they all take the form.
>>
>> the name exception is
>>
>> auth.settings.logout_onlogout - lambda user: ...
>>
>> because there is no form to fill on logout but there is a user.
>>
>> On Nov 9, 1:37 pm, Richard Vézina  wrote:
>> > Nice approach so I could update a custom field in auth_user and put it
>> true
>> > or false at login and logout?
>> >
>> > How I may set my flag to true?
>> >
>> > Is there a auth.settings.login_onlogin ??
>> >
>> > Thanks
>> >
>> > Richard
>> >
>> > On Wed, Nov 9, 2011 at 2:14 PM, Massimo Di Pierro <
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > massimo.dipie...@gmail.com> wrote:
>> > > Sessions never end. Do you want to detect logout?
>> >
>> > > auth.settings.logout_onlogout = lambda user: do_something_with(user)
>> >
>> > > On Nov 9, 11:58 am, Sathvik Ponangi  wrote:
>> > > > Is there someway that I could call a function when the user ends
>> their
>> > > > session?
>>
>
>


-- 
Sathvik Ponangi


[web2py] Re: help on howto redirect user based on their auth_membership

2011-11-10 Thread Massimo Di Pierro
It was a long day. :-)

On Nov 10, 10:59 pm, Anthony  wrote:
> Of course. Don't know what I was thinking.
>
>
>
>
>
>
>
> On Thursday, November 10, 2011 11:46:01 PM UTC-5, Massimo Di Pierro wrote:
>
> > Unfortunately login_nezt is set before the login is accepted and
> > before you know what the use permissions are.
>
> > You must set a conditional rwdirect inside the login_onaccept
> > callback.
>
> > On Nov 10, 9:49 pm, Anthony  wrote:
> > > auth.settings.login_next = URL('special') if
> > > auth.has_membership('supervisor') else URL('regular')
>
> > > Anthony
>
> > > On Thursday, November 10, 2011 10:40:40 PM UTC-5, tomt wrote:
>
> > > > Hi,
>
> > > > Is there a way to redirect a user to a specific controller based on
> > > > their auth_group.role and/or auth_membership?
>
> > > > I would like a view only user to be redirected to one controller after
> > > > login, and a "supervisor" user go to a different controller after
> > > > login.
>
> > > > Any suggestions?
>
> > > > Thanks, - Tom


[web2py] Id been Shown Instead of Name in dropdown list

2011-11-10 Thread Naleen Yadav
Hii all,

for the past few days I was trying my hands on inheritance and i have done
single Inheritance but in case of multiple inheritance i  am facing  a
problem here is my code

 *Model:*

*# Creating a master table for storing vehicle names.*

db.define_table("tblVehicleName",
  Field("VehicleName",  length=45, notnull=True,
default=None,unique=True,label='Vehicle Name'),
  format='%(VehicleName)s'
  )

*# Creating tblVehicle which is getting the data from the master table and
adding a new field say Vehicle no*

db.define_table("tblVehicle",
  Field("VehicleName",db.tblVehicleName,label='Vehicle Name'),
  Field("VehicleNo", default=None,label='VehicleNo'))
db.tblVehicle.VehicleName.requires=IS_IN_DB(db,'tblVehicleName.id','%(VehicleName)s')

* # Creating tblDriver adding Driver name and selecting the name of vehicle
from the dropdown*

db.define_table("tblDriver",
  Field("DriverName",'string',label='Driver Name'),
  Field('id_tblVehicle', db.tblVehicle,label='Vehicle Name'))
db.tblDriver.id_tblVehicle.requires=IS_IN_DB(db, 'tblVehicle.VehicleName')

the problem is that when i am trying to add driver information in the
tblDriver then in the dropdown i am getting vehicle no instead of Vehicle
name .
after this i tried few options but nothing works.
so can any one help me out of this situation.


Thanks

Naleen Yadav
GENPRO Technologies pvt Ltd.


Re: [web2py] Re: excessive memory usage on webfaction

2011-11-10 Thread Vasile Ermicioi
>
> I think this primarily a problem of how web2py is being served rather
> than a web2py problem. Just the welcome app and no traffic takes 70MB
> of memory by default.


the problem is with the architecture of webserver behind web2py
processes vs threaded vs async

ok, most of recommended ways of deployment are threaded vs async

so what are the options:

threaded:
  servers: apache, nginx, cherokee
  mode: fcgi, modwsgi, uwsgi (not async)
  builtin rocket webserver

async:
  any server + uwsgi async
  unicorn + gevent


threaded servers consumes more memory,
but async evented servers can't take advantage of multiple processors,
a good solution is to spawn a few processes (2 or 4) that will work async
like do nginx, unicorn and uwsgi

so for webfaction I recommend *uwsgi *with 2 processes async

I didn't provide some numbers, but I can say for sure that the difference
is very big (a few times less memory)


Re: [web2py] Re: excessive memory usage on webfaction

2011-11-10 Thread Richard Baron Penman
I think this primarily a problem of how web2py is being served rather
than a web2py problem. Just the welcome app and no traffic takes 70MB
of memory by default.


On Fri, Nov 11, 2011 at 11:59 AM, Bruno Rocha  wrote:
> On Fri, Nov 11, 2011 at 12:52 AM, Richard Baron Penman 
> wrote:
>>
>> I was also surprised how much resources the default configuration
>> uses, just for the welcome app. Seems Django has better configuration.
>
> Avoid the use of models, try to use conditional models (subfolders) or
> better, create your datamodels and other instances (Auth, Crud) in /modules
> and load it only when you need it.
> See this presentation from Martin Mulone for better practice on
> this: http://www.slideshare.net/martinpm/web2py-pensando-en-grande-9448110
> --
>
> Bruno Rocha
> [http://rochacbruno.com.br]
>


[web2py] Re: help on howto redirect user based on their auth_membership

2011-11-10 Thread Anthony
Of course. Don't know what I was thinking.

On Thursday, November 10, 2011 11:46:01 PM UTC-5, Massimo Di Pierro wrote:
>
>
> Unfortunately login_nezt is set before the login is accepted and 
> before you know what the use permissions are. 
>
> You must set a conditional rwdirect inside the login_onaccept 
> callback. 
>
>
> On Nov 10, 9:49 pm, Anthony  wrote: 
> > auth.settings.login_next = URL('special') if 
> > auth.has_membership('supervisor') else URL('regular') 
> > 
> > Anthony 
> > 
> > 
> > 
> > On Thursday, November 10, 2011 10:40:40 PM UTC-5, tomt wrote: 
> > 
> > > Hi, 
> > 
> > > Is there a way to redirect a user to a specific controller based on 
> > > their auth_group.role and/or auth_membership? 
> > 
> > > I would like a view only user to be redirected to one controller after 
> > > login, and a "supervisor" user go to a different controller after 
> > > login. 
> > 
> > > Any suggestions? 
> > 
> > > Thanks, - Tom



[web2py] Re: help on howto redirect user based on their auth_membership

2011-11-10 Thread Massimo Di Pierro

Unfortunately login_nezt is set before the login is accepted and
before you know what the use permissions are.

You must set a conditional rwdirect inside the login_onaccept
callback.


On Nov 10, 9:49 pm, Anthony  wrote:
> auth.settings.login_next = URL('special') if
> auth.has_membership('supervisor') else URL('regular')
>
> Anthony
>
>
>
> On Thursday, November 10, 2011 10:40:40 PM UTC-5, tomt wrote:
>
> > Hi,
>
> > Is there a way to redirect a user to a specific controller based on
> > their auth_group.role and/or auth_membership?
>
> > I would like a view only user to be redirected to one controller after
> > login, and a "supervisor" user go to a different controller after
> > login.
>
> > Any suggestions?
>
> > Thanks, - Tom


[web2py] Re: help on howto redirect user based on their auth_membership

2011-11-10 Thread Anthony
auth.settings.login_next = URL('special') if 
auth.has_membership('supervisor') else URL('regular')

Anthony

On Thursday, November 10, 2011 10:40:40 PM UTC-5, tomt wrote:
>
> Hi, 
>
> Is there a way to redirect a user to a specific controller based on 
> their auth_group.role and/or auth_membership? 
>
> I would like a view only user to be redirected to one controller after 
> login, and a "supervisor" user go to a different controller after 
> login. 
>
> Any suggestions? 
>
> Thanks, - Tom



[web2py] help on howto redirect user based on their auth_membership

2011-11-10 Thread tomt
Hi,

Is there a way to redirect a user to a specific controller based on
their auth_group.role and/or auth_membership?

I would like a view only user to be redirected to one controller after
login, and a "supervisor" user go to a different controller after
login.

Any suggestions?

Thanks, - Tom


Re: [web2py] Re: excessive memory usage on webfaction

2011-11-10 Thread Bruno Rocha
On Fri, Nov 11, 2011 at 12:52 AM, Richard Baron Penman
wrote:

> I was also surprised how much resources the default configuration
> uses, just for the welcome app. Seems Django has better configuration.


Avoid the use of models, try to use conditional models (subfolders) or
better, create your datamodels and other instances (Auth, Crud) in /modules
and load it only when you need it.

See this presentation from Martin Mulone for better practice on this:
http://www.slideshare.net/martinpm/web2py-pensando-en-grande-9448110

-- 

Bruno Rocha
[http://rochacbruno.com.br]


Re: [web2py] Re: excessive memory usage on webfaction

2011-11-10 Thread Richard Baron Penman
I was also surprised how much resources the default configuration
uses, just for the welcome app. Seems Django has better configuration.

I tried that static technique but haven't noticed a difference yet. I
only have the default welcome app static files.
Webfaction support recommends reducing the number of Apache worker threads to 2.

I am now trying to get that uwsgi/nginx setup working ...


On Fri, Nov 11, 2011 at 2:13 AM, BrendanC  wrote:
> I had the same  problem with webfaction - be sure to set your static files
> to be delivered by ngenix or apache.
> I followed the info in the link above and it reduced my memory usage However
> I have both a Django and a Web2py instance set up on my account and Web2py
> takes more memory for my a small  test app  (maybe a need a few more tweaks
> as I'd expect Web2py to be smaller).
> One other gotcha to watch out for - on webfaction (and possibly other
> hosting services) your app must be defined at the root of your domain. I
> wasted a day trying to configure my app as a subdomain. (iow -
> myacct.webfaction.com/myweb2pyapp works;
> myacct.webfaction.com/mywepapps/myweb2pyapp *WILL NOT WORK*.
> This is mentioned in the install script that webfaction provides for
> installing web2py, but I missed it. So read it carefully. Webfaction support
> also missed this when I spent a futile day trying to get it to work.
> Hope this helps,
> BrendanC


[web2py] Re: Issue Tracker and web interface for Mercurial

2011-11-10 Thread Massimo Di Pierro
look into admin/controllers/mercurial.py

it is really annoying that the mercurial apis are poorly documented
and broke already 3 times with mercurial updates.

Massimo

On Nov 9, 5:57 am, Phyo Arkar  wrote:
> Hello Web2py.
>
> Recently we had a lot of talk about web2py based Trac-like app for
> Mercurial. Anyone implemented it?
> What is mercurial inside web2py ? admin/views/mercurial
>
> Thanks.
>
> Phyo.


[web2py] Re: Issue Tracker and web interface for Mercurial

2011-11-10 Thread Phyo Arkar
So thats mean Null ? Nothing we have currently ..?

On Wed, Nov 9, 2011 at 6:27 PM, Phyo Arkar  wrote:

> Hello Web2py.
>
> Recently we had a lot of talk about web2py based Trac-like app for
> Mercurial. Anyone implemented it?
> What is mercurial inside web2py ? admin/views/mercurial
>
> Thanks.
>
> Phyo.
>


[web2py] Re: Python 2.7 on GAE (experimental)

2011-11-10 Thread pallav
Thank you. I also appreciate you putting your app.yaml on the code
repository - it helped me get started today (before seeing what you
had done, my own had not been customized for wsgi, just Python 2.7).

I'm definitely interested in learning the relationship between the
DAL, 2.7, and transactions. I would like to help improve GAE support
in the DAL, so if there is anything I can learn from your experiences,
maybe we can use it to improve web2py code. I believe this is the
killer feature of web2py - being able to deploy to GAE easily while
still being quick to start, and portable.

Any interest?


[web2py] Re: new welcome app - need help with css

2011-11-10 Thread Anthony
On Thursday, November 10, 2011 7:30:38 PM UTC-5, Paolo Caruccio wrote:
>
>
> .web2py_console {position: relative;} /* for #w2p_query_panel positioning 
> */
> #web2py_keywords{margin:0 5px;min-width:390px;width:62%;}
> #w2p_query_panel{width:99%;}
> #w2p_query_panel input, #w2p_query_panel select{margin:2px 10px 2px 5px;}
> #w2p_query_panel input[type="text"]{margin:0 5px 0 0;}
> .ie9 #web2py_keywords:focus {border-color:#ccc;} /* fix to prevent border 
> vanishing in ie9 */
>

Haven't tried it, but I like that it uses only web2py-specific selectors.
 

> Moreover I want suggest this change in layout.html:
>
> 
>   lang="{{=T.accepted_language or 'en'}}"> 
>

There used to be an [if IE 9], but I removed it (before seeing the .ie9 
reference) because most problems with IE that require IE-specific CSS are 
with versions prior to 9, so I like to be able to use the .ie selector 
strictly for IE<9. As an alternative, how about:



Notice no "ie" class, so .ie only refers to IE<9, but can still use 
.ie-lte9 to refer to IE<10 (have to add ie-lte9 to the others as well). 
Also, note that lte8 is not appropriate for IE9.

Anthony


[web2py] Re: new welcome app - need help with css

2011-11-10 Thread Paolo Caruccio
Anthony,

I made some tests after your observations. (web2py Version 1.99.3 
(2011-11-08 22:28:53) dev last trunk)

What do you think about the following:

.web2py_console {position: relative;} /* for #w2p_query_panel positioning */
#web2py_keywords{margin:0 5px;min-width:390px;width:62%;}
#w2p_query_panel{width:99%;}
#w2p_query_panel input, #w2p_query_panel select{margin:2px 10px 2px 5px;}
#w2p_query_panel input[type="text"]{margin:0 5px 0 0;}
.ie9 #web2py_keywords:focus {border-color:#ccc;} /* fix to prevent border 
vanishing in ie9 */

Moreover I want suggest this change in layout.html:


  

Paolo



[web2py] Central Authentication Service - CAS authentication - not create new db.auth_user record

2011-11-10 Thread Bruce Young
Is there a way to stop sucessful CAS login to NOT create a user?
I think this normally done by "disable registration"

I want only users with an existing auth_user record to login.
Those users that successfully login through CAS but do not have an
auth_user record should be redirected.

I have CAS working, but these do not work
auth.settings.actions_disabled.append('register')
auth.settings.registration_requires_approval = True

Any advice is appreciated.

Bruce Young


[web2py] .hgignore and updating welcome/admin

2011-11-10 Thread pbreit
My welcome and admin apps never get the updates, possibly because of this 
line in the default .hgignore?

^applications/(?!(admin|examples|welcome|__init__)).*$

How can I make sure admin/welcome are getting updated


[web2py] Re: cool css3 hover effects

2011-11-10 Thread Andrew
I agree, it looks great.
Does the book need to explain a bit more about how to take advantage
of such things with web2py?
I don't mean that the book should be a css or jquery tutorial, but
what I don't quite understand is the what standard html class and id
structure there is in the standard web2py pages, which would allow me
to manipulate it through css and jquery.  Or do I add my own DIVs,
classes and ids and then change the css files?(I think yes)   Chapter
5 (Views) gives a DIV example with _class added, but is this done in
the view or should they be defined in the controller (for changing
forms/grids?) ?

I think the information is there in Chapter 5 - Server side DOM and
Parsing, HTML Helpers, Customising Default Layout, but it would be
helpful to see an example of how the different parts are applied
through the controller and views to achieve a cool effect as above (or
something simpler perhaps).

Not being a very experienced web developer, is this appropriate for
the web2py book ?

Thanks
Andrew




On Nov 11, 8:11 am, Richard Vézina 
wrote:
> Pretty nice... Thanks Richard
>
> On Thu, Nov 10, 2011 at 1:57 PM, Massimo Di Pierro <
>
>
>
> massimo.dipie...@gmail.com> wrote:
> >http://tympanus.net/Tutorials/OriginalHoverEffects/index.html- Hide quoted 
> >text -
>
> - Show quoted text -


Re: [web2py] Re: SQLFORM.grid : formstyle, readable and writable control

2011-11-10 Thread Richard Vézina
Where do you see form[1]?

What do you want to know?

What I am doing in my for loop?

Richard

On Thu, Nov 10, 2011 at 4:27 PM, Cliff  wrote:

> Richard,
>
> If you have time, what happens if you substitute form[1] for
> form.create_form[0] ?
>
> Thanks,
> Cliff Kachinske
>
> On Nov 10, 4:10 pm, Anthony  wrote:
> > My mistake -- looks like it always has a .create_form, but set to None in
> > other cases. But in that case:
> >
> > if form.create_form:
> >
> > should work, though I think you said that didn't work -- what happened
> when
> > you tried that?
> >
> > Anthony
> >
> >
> >
> >
> >
> >
> >
> > On Thursday, November 10, 2011 4:04:00 PM UTC-5, Richard wrote:
> >
> > > Ok but it's not seem to work... I get this error trace back :
> >
> > >  1.
> > > 2.
> > > 3.
> > > 4.
> > > 5.
> > > 6.
> > > 7.
> > > 8.
> > > 9.
> > > 10.
> >
> > > Traceback (most recent call last):
> >
> > >   File "/web2py/gluon/restricted.py", line 194, in restricted
> >
> > > exec ccode in environment
> >
> > >   File "/web2py/applications/sgddms/controllers/test.py", line 4437,
> in 
> >
> > >   File "/web2py/gluon/globals.py", line 149, in 
> >
> > > self._caller = lambda f: f()
> >
> > >   File "/web2py/applications/sgddms/controllers/test.py", line 4396,
> in test_sqlformgrid
> >
> > > for i in range(0,len(form.create_form[0])):
> > > TypeError: 'NoneType' object is unsubscriptable
> >
> > > Any idea?
> >
> > > It really the first time I play with SQLFORM.grid and it not documented
> > > yet so I may ask kind of trivial question... Also I a bit under
> pressure.
> >
> > > I really appreciate your help.
> >
> > > Richard
> >
> > > On Thu, Nov 10, 2011 at 3:57 PM, Anthony  wrote:
> >
> > >> I'd go with the second option -- more fool proof.
> >
> > >> On Thursday, November 10, 2011 3:11:11 PM UTC-5, Richard wrote:
> >
> > >>> Ok so this :
> >
> > >>> "if 'new' in request.args and form.create_form:"
> >
> > >>> or shorter :
> >
> > >>> "if hasattr(form, 'create_form'):"
> >
> > >>> ?
> >
> > >>> Thank you.
> >
> > >>> Richard
> >
> > >>> On Thu, Nov 10, 2011 at 2:58 PM, Anthony  wrote:
> >
> >  If you have "if 'new' in request.args:' you should not also need "if
> >  form.create_form" (even if you did, you could simply put them in
> the same
> >  "if" statement with an "and"). Alternatively, use "if hasattr(form,
> >  'create_form'):" -- all by itself.
> >
> >  Anthony
> >
> >  On Thursday, November 10, 2011 2:48:49 PM UTC-5, Richard wrote:
> >
> > >  Here a working piece of code :
> >
> > > def test_sqlformgrid():
> > > form = SQLFORM.grid(db.TABLE, ui='jquery-ui',
> > > editable=auth.has_membership('reviewer'),
> > > deletable=auth.has_membership('reviewer'), formstyle = 'divs')
> > > if 'new' in request.args:
> > > if form.create_form
> > > for i in range(0,len(form.create_form[**0**])):
> > > if len(form.create_form[0][i][2][0]) > 0:
> > >
> form.create_form[0][i][0].**appe**nd(SPAN((helpicon(),
> > > SPAN(form.create_form[0][i][2][0])),_class='tooltip'))
> > > del(form.create_form[0][i][2])
> > >  return dict(form=form)
> >
> > > Off course the for i in range... Is specific to my need but it the
> way
> > > to manipulate the generated html form before it goes in user
> hand...
> >
> > > :)
> >
> > > Richard
> >
> > > On Thu, Nov 10, 2011 at 2:44 PM, Richard Vézina  >wrote:
> >
> > >>  It was working "if form.create_form:"...
> >
> > >> I thought that grid use form variable doesn't matter if the
> > >> SQLFORM.grid wasn't in a form variable at all...
> >
> > >> And my bad because I show form = crud... But it was not my
> > >> SQLFORM.grid... Arrg.
> >
> > >> Sorry about that...
> >
> > >> Richard
> >
> > >> On Thu, Nov 10, 2011 at 1:26 PM, Anthony 
> wrote:
> >
> > >>> On Thursday, November 10, 2011 12:42:49 PM UTC-5, Richard wrote:
> >
> >  "if 'new' in request.args:" works (allow to load the grid) but
> the
> >  "if form.create_form:" not work alone or in conjunction with
> the former
> >
> > >>> Yeah, looks like it would have to be something like "if
> > >>> hasattr(form, 'create_form'):".
>


[web2py] Re: crud.read vars

2011-11-10 Thread Anthony
No, it returns a SQLFORM with readonly=True, in which case there's nothing 
in form.vars.

On Thursday, November 10, 2011 4:22:43 PM UTC-5, lucas wrote:
>
> yes, but doesn't crud.read just return an SQLFORM, which should have 
> object access to the field values, no?



Re: [web2py] Re: SQLFORM.grid : formstyle, readable and writable control

2011-11-10 Thread Richard Vézina
With just "if form.create_form:"

It works finally... Maybe I was having other typo in my code that raise
error then since I was focusing on the problem I didn't realise that it was
for other reason...

At that I had

table = SQLFORM.grid(...)

and was verifying :

"if form.create_form:"

So for sure it wasn't there it was in table... It should had been

"if table.create_form:"

So if create_form is always there as long as form exist don't need the "if
'new' in request.args:"

Richard

On Thu, Nov 10, 2011 at 4:10 PM, Anthony  wrote:

> My mistake -- looks like it always has a .create_form, but set to None in
> other cases. But in that case:
>
> if form.create_form:
>
> should work, though I think you said that didn't work -- what happened
> when you tried that?
>
> Anthony
>
>
> On Thursday, November 10, 2011 4:04:00 PM UTC-5, Richard wrote:
>
>> Ok but it's not seem to work... I get this error trace back :
>>
>>  1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>> 7.
>> 8.
>> 9.
>> 10.
>>
>> Traceback (most recent call last):
>>
>>   File "/web2py/gluon/restricted.py", line 194, in restricted
>>
>> exec ccode in environment
>>
>>   File "/web2py/applications/sgddms/**controllers/test.py", line 4437, in 
>> 
>>
>>   File "/web2py/gluon/globals.py", line 149, in 
>>
>> self._caller = lambda f: f()
>>
>>   File "/web2py/applications/sgddms/**controllers/test.py", line 4396, in 
>> test_sqlformgrid
>>
>> for i in range(0,len(form.create_form[0**])):
>> TypeError: 'NoneType' object is unsubscriptable
>>
>> Any idea?
>>
>> It really the first time I play with SQLFORM.grid and it not documented
>> yet so I may ask kind of trivial question... Also I a bit under pressure.
>>
>> I really appreciate your help.
>>
>> Richard
>>
>> On Thu, Nov 10, 2011 at 3:57 PM, Anthony  wrote:
>>
>>> I'd go with the second option -- more fool proof.
>>>
>>>
>>> On Thursday, November 10, 2011 3:11:11 PM UTC-5, Richard wrote:
>>>
 Ok so this :

 "if 'new' in request.args and form.create_form:"

 or shorter :

 "if hasattr(form, 'create_form'):"

 ?

 Thank you.

 Richard

 On Thu, Nov 10, 2011 at 2:58 PM, Anthony  wrote:

> If you have "if 'new' in request.args:' you should not also need "if
> form.create_form" (even if you did, you could simply put them in the same
> "if" statement with an "and"). Alternatively, use "if hasattr(form,
> 'create_form'):" -- all by itself.
>
> Anthony
>
>
> On Thursday, November 10, 2011 2:48:49 PM UTC-5, Richard wrote:
>
>>  Here a working piece of code :
>>
>> def test_sqlformgrid():
>> form = SQLFORM.grid(db.TABLE, ui='jquery-ui',
>> editable=auth.has_membership('**reviewer'),
>> deletable=auth.has_membership(**'reviewer'), formstyle = 'divs')
>> if 'new' in request.args:
>> if form.create_form
>> for i in range(0,len(form.create_form[**0])):
>> if len(form.create_form[0][i][2][**0]) > 0:
>> 
>> form.create_form[0][i][0].**append(SPAN((helpicon(),
>> SPAN(form.create_form[0][i][2]**[0])),_class='tooltip'))
>> del(form.create_form[0][i][2])
>>  return dict(form=form)
>>
>> Off course the for i in range... Is specific to my need but it the
>> way to manipulate the generated html form before it goes in user hand...
>>
>> :)
>>
>> Richard
>>
>> On Thu, Nov 10, 2011 at 2:44 PM, Richard Vézina wrote:
>>
>>>  It was working "if form.create_form:"...
>>>
>>> I thought that grid use form variable doesn't matter if the
>>> SQLFORM.grid wasn't in a form variable at all...
>>>
>>> And my bad because I show form = crud... But it was not my
>>> SQLFORM.grid... Arrg.
>>>
>>> Sorry about that...
>>>
>>> Richard
>>>
>>> On Thu, Nov 10, 2011 at 1:26 PM, Anthony  wrote:
>>>
 On Thursday, November 10, 2011 12:42:49 PM UTC-5, Richard wrote:
>
>
> "if 'new' in request.args:" works (allow to load the grid) but the
> "if form.create_form:" not work alone or in conjunction with the 
> former
>

 Yeah, looks like it would have to be something like "if
 hasattr(form, 'create_form'):".

>>>
>>>
>>

>>


Re: [web2py] Re: smartgrid styling

2011-11-10 Thread Jim Steil

Sounds like a good idea.  Let us know if you see differences.

-Jim

On 11/10/2011 3:18 PM, Cliff wrote:

I'm now completely confused.

Just to look at the rendered html I used smartgrid in a different
controller.

The styling looks fine.

I've got a 1.99.2 zipfile.  Maybe I'll unzip it and get the base.css
just to make sure all is in synch.



On Nov 10, 2:27 pm, Jim Steil  wrote:

Have you started a brand new app and used it, or added it to an an older
app?  There were a number of css changes/additions at some point.

  -Jim

On 11/10/2011 12:45 PM, Cliff wrote:








Am I missing something?
Running 1.99.2 smartgrid works but definitely needs styling.  I see
the styling for web2py grid in base css and grid looks fine.
Smartgrid not so much.


[web2py] Re: SQLFORM.grid : formstyle, readable and writable control

2011-11-10 Thread Cliff
Richard,

If you have time, what happens if you substitute form[1] for
form.create_form[0] ?

Thanks,
Cliff Kachinske

On Nov 10, 4:10 pm, Anthony  wrote:
> My mistake -- looks like it always has a .create_form, but set to None in
> other cases. But in that case:
>
> if form.create_form:
>
> should work, though I think you said that didn't work -- what happened when
> you tried that?
>
> Anthony
>
>
>
>
>
>
>
> On Thursday, November 10, 2011 4:04:00 PM UTC-5, Richard wrote:
>
> > Ok but it's not seem to work... I get this error trace back :
>
> >  1.
> > 2.
> > 3.
> > 4.
> > 5.
> > 6.
> > 7.
> > 8.
> > 9.
> > 10.
>
> > Traceback (most recent call last):
>
> >   File "/web2py/gluon/restricted.py", line 194, in restricted
>
> >     exec ccode in environment
>
> >   File "/web2py/applications/sgddms/controllers/test.py", line 4437, in 
> > 
>
> >   File "/web2py/gluon/globals.py", line 149, in 
>
> >     self._caller = lambda f: f()
>
> >   File "/web2py/applications/sgddms/controllers/test.py", line 4396, in 
> > test_sqlformgrid
>
> >     for i in range(0,len(form.create_form[0])):
> > TypeError: 'NoneType' object is unsubscriptable
>
> > Any idea?
>
> > It really the first time I play with SQLFORM.grid and it not documented
> > yet so I may ask kind of trivial question... Also I a bit under pressure.
>
> > I really appreciate your help.
>
> > Richard
>
> > On Thu, Nov 10, 2011 at 3:57 PM, Anthony  wrote:
>
> >> I'd go with the second option -- more fool proof.
>
> >> On Thursday, November 10, 2011 3:11:11 PM UTC-5, Richard wrote:
>
> >>> Ok so this :
>
> >>> "if 'new' in request.args and form.create_form:"
>
> >>> or shorter :
>
> >>> "if hasattr(form, 'create_form'):"
>
> >>> ?
>
> >>> Thank you.
>
> >>> Richard
>
> >>> On Thu, Nov 10, 2011 at 2:58 PM, Anthony  wrote:
>
>  If you have "if 'new' in request.args:' you should not also need "if
>  form.create_form" (even if you did, you could simply put them in the same
>  "if" statement with an "and"). Alternatively, use "if hasattr(form,
>  'create_form'):" -- all by itself.
>
>  Anthony
>
>  On Thursday, November 10, 2011 2:48:49 PM UTC-5, Richard wrote:
>
> >  Here a working piece of code :
>
> > def test_sqlformgrid():
> >     form = SQLFORM.grid(db.TABLE, ui='jquery-ui',
> > editable=auth.has_membership('reviewer'),
> > deletable=auth.has_membership('reviewer'), formstyle = 'divs')
> >     if 'new' in request.args:
> >         if form.create_form
> >             for i in range(0,len(form.create_form[**0**])):
> >                 if len(form.create_form[0][i][2][0]) > 0:
> >                     
> > form.create_form[0][i][0].**appe**nd(SPAN((helpicon(),
> > SPAN(form.create_form[0][i][2][0])),_class='tooltip'))
> >                 del(form.create_form[0][i][2])
> >      return dict(form=form)
>
> > Off course the for i in range... Is specific to my need but it the way
> > to manipulate the generated html form before it goes in user hand...
>
> > :)
>
> > Richard
>
> > On Thu, Nov 10, 2011 at 2:44 PM, Richard Vézina 
> > wrote:
>
> >>  It was working "if form.create_form:"...
>
> >> I thought that grid use form variable doesn't matter if the
> >> SQLFORM.grid wasn't in a form variable at all...
>
> >> And my bad because I show form = crud... But it was not my
> >> SQLFORM.grid... Arrg.
>
> >> Sorry about that...
>
> >> Richard
>
> >> On Thu, Nov 10, 2011 at 1:26 PM, Anthony  wrote:
>
> >>> On Thursday, November 10, 2011 12:42:49 PM UTC-5, Richard wrote:
>
>  "if 'new' in request.args:" works (allow to load the grid) but the
>  "if form.create_form:" not work alone or in conjunction with the 
>  former
>
> >>> Yeah, looks like it would have to be something like "if
> >>> hasattr(form, 'create_form'):".


[web2py] Re: crud.read vars

2011-11-10 Thread lucas
yes, but doesn't crud.read just return an SQLFORM, which should have
object access to the field values, no?


[web2py] Re: smartgrid styling

2011-11-10 Thread Cliff
I'm now completely confused.

Just to look at the rendered html I used smartgrid in a different
controller.

The styling looks fine.

I've got a 1.99.2 zipfile.  Maybe I'll unzip it and get the base.css
just to make sure all is in synch.



On Nov 10, 2:27 pm, Jim Steil  wrote:
> Have you started a brand new app and used it, or added it to an an older
> app?  There were a number of css changes/additions at some point.
>
>      -Jim
>
> On 11/10/2011 12:45 PM, Cliff wrote:
>
>
>
>
>
>
>
> > Am I missing something?
>
> > Running 1.99.2 smartgrid works but definitely needs styling.  I see
> > the styling for web2py grid in base css and grid looks fine.
> > Smartgrid not so much.


Re: [web2py] Re: SQLFORM.grid : formstyle, readable and writable control

2011-11-10 Thread Anthony
My mistake -- looks like it always has a .create_form, but set to None in 
other cases. But in that case:

if form.create_form:

should work, though I think you said that didn't work -- what happened when 
you tried that?

Anthony

On Thursday, November 10, 2011 4:04:00 PM UTC-5, Richard wrote:
>
> Ok but it's not seem to work... I get this error trace back :
>
>  1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
>
> Traceback (most recent call last):
>
>   File "/web2py/gluon/restricted.py", line 194, in restricted
>
> exec ccode in environment
>
>   File "/web2py/applications/sgddms/controllers/test.py", line 4437, in 
> 
>
>   File "/web2py/gluon/globals.py", line 149, in 
>
> self._caller = lambda f: f()
>
>   File "/web2py/applications/sgddms/controllers/test.py", line 4396, in 
> test_sqlformgrid
>
> for i in range(0,len(form.create_form[0])):
> TypeError: 'NoneType' object is unsubscriptable
>
> Any idea?
>
> It really the first time I play with SQLFORM.grid and it not documented 
> yet so I may ask kind of trivial question... Also I a bit under pressure.
>
> I really appreciate your help.
>
> Richard
>
> On Thu, Nov 10, 2011 at 3:57 PM, Anthony  wrote:
>
>> I'd go with the second option -- more fool proof.
>>
>>
>> On Thursday, November 10, 2011 3:11:11 PM UTC-5, Richard wrote:
>>
>>> Ok so this :
>>>
>>> "if 'new' in request.args and form.create_form:"
>>>
>>> or shorter :
>>>
>>> "if hasattr(form, 'create_form'):"
>>>
>>> ?
>>>
>>> Thank you.
>>>
>>> Richard
>>>
>>> On Thu, Nov 10, 2011 at 2:58 PM, Anthony  wrote:
>>>
 If you have "if 'new' in request.args:' you should not also need "if 
 form.create_form" (even if you did, you could simply put them in the same 
 "if" statement with an "and"). Alternatively, use "if hasattr(form, 
 'create_form'):" -- all by itself.

 Anthony


 On Thursday, November 10, 2011 2:48:49 PM UTC-5, Richard wrote:

>  Here a working piece of code :
>
> def test_sqlformgrid():
> form = SQLFORM.grid(db.TABLE, ui='jquery-ui', 
> editable=auth.has_membership('reviewer'), 
> deletable=auth.has_membership('reviewer'), formstyle = 'divs')
> if 'new' in request.args:
> if form.create_form
> for i in range(0,len(form.create_form[**0**])):
> if len(form.create_form[0][i][2][0]) > 0:
> 
> form.create_form[0][i][0].**appe**nd(SPAN((helpicon(), 
> SPAN(form.create_form[0][i][2][0])),_class='tooltip'))
> del(form.create_form[0][i][2])
>  return dict(form=form)
>
> Off course the for i in range... Is specific to my need but it the way 
> to manipulate the generated html form before it goes in user hand...
>
> :)
>
> Richard
>
> On Thu, Nov 10, 2011 at 2:44 PM, Richard Vézina wrote:
>
>>  It was working "if form.create_form:"...
>>
>> I thought that grid use form variable doesn't matter if the 
>> SQLFORM.grid wasn't in a form variable at all...
>>
>> And my bad because I show form = crud... But it was not my 
>> SQLFORM.grid... Arrg.
>>
>> Sorry about that...
>>
>> Richard
>>
>> On Thu, Nov 10, 2011 at 1:26 PM, Anthony  wrote:
>>
>>> On Thursday, November 10, 2011 12:42:49 PM UTC-5, Richard wrote:


 "if 'new' in request.args:" works (allow to load the grid) but the 
 "if form.create_form:" not work alone or in conjunction with the former

>>>
>>> Yeah, looks like it would have to be something like "if 
>>> hasattr(form, 'create_form'):". 
>>>
>>
>>
>
>>>
>

Re: [web2py] Re: SQLFORM.grid : formstyle, readable and writable control

2011-11-10 Thread Richard Vézina
Ok but it's not seem to work... I get this error trace back :

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.

Traceback (most recent call last):
  File "/web2py/gluon/restricted.py", line 194, in restricted
exec ccode in environment
  File "/web2py/applications/sgddms/controllers/test.py", line 4437, in 
  File "/web2py/gluon/globals.py", line 149, in 
self._caller = lambda f: f()
  File "/web2py/applications/sgddms/controllers/test.py", line 4396,
in test_sqlformgrid
for i in range(0,len(form.create_form[0])):
TypeError: 'NoneType' object is unsubscriptable

Any idea?

It really the first time I play with SQLFORM.grid and it not documented yet
so I may ask kind of trivial question... Also I a bit under pressure.

I really appreciate your help.

Richard

On Thu, Nov 10, 2011 at 3:57 PM, Anthony  wrote:

> I'd go with the second option -- more fool proof.
>
>
> On Thursday, November 10, 2011 3:11:11 PM UTC-5, Richard wrote:
>
>> Ok so this :
>>
>> "if 'new' in request.args and form.create_form:"
>>
>> or shorter :
>>
>> "if hasattr(form, 'create_form'):"
>>
>> ?
>>
>> Thank you.
>>
>> Richard
>>
>> On Thu, Nov 10, 2011 at 2:58 PM, Anthony  wrote:
>>
>>> If you have "if 'new' in request.args:' you should not also need "if
>>> form.create_form" (even if you did, you could simply put them in the same
>>> "if" statement with an "and"). Alternatively, use "if hasattr(form,
>>> 'create_form'):" -- all by itself.
>>>
>>> Anthony
>>>
>>>
>>> On Thursday, November 10, 2011 2:48:49 PM UTC-5, Richard wrote:
>>>
 Here a working piece of code :

 def test_sqlformgrid():
 form = SQLFORM.grid(db.TABLE, ui='jquery-ui',
 editable=auth.has_membership('reviewer'),
 deletable=auth.has_membership('reviewer'), formstyle = 'divs')
 if 'new' in request.args:
 if form.create_form
 for i in range(0,len(form.create_form[**0**])):
 if len(form.create_form[0][i][2][0]) > 0:
 form.create_form[0][i][0].**appe**nd(SPAN((helpicon(),
 SPAN(form.create_form[0][i][2][0])),_class='tooltip'))
 del(form.create_form[0][i][2])
 return dict(form=form)

 Off course the for i in range... Is specific to my need but it the way
 to manipulate the generated html form before it goes in user hand...

 :)

 Richard

 On Thu, Nov 10, 2011 at 2:44 PM, Richard Vézina wrote:

>  It was working "if form.create_form:"...
>
> I thought that grid use form variable doesn't matter if the
> SQLFORM.grid wasn't in a form variable at all...
>
> And my bad because I show form = crud... But it was not my
> SQLFORM.grid... Arrg.
>
> Sorry about that...
>
> Richard
>
> On Thu, Nov 10, 2011 at 1:26 PM, Anthony  wrote:
>
>> On Thursday, November 10, 2011 12:42:49 PM UTC-5, Richard wrote:
>>>
>>>
>>> "if 'new' in request.args:" works (allow to load the grid) but the
>>> "if form.create_form:" not work alone or in conjunction with the former
>>>
>>
>> Yeah, looks like it would have to be something like "if
>> hasattr(form, 'create_form'):".
>>
>
>

>>


Re: [web2py] Re: SQLFORM.grid : formstyle, readable and writable control

2011-11-10 Thread Anthony
I'd go with the second option -- more fool proof.

On Thursday, November 10, 2011 3:11:11 PM UTC-5, Richard wrote:
>
> Ok so this :
>
> "if 'new' in request.args and form.create_form:"
>
> or shorter :
>
> "if hasattr(form, 'create_form'):"
>
> ?
>
> Thank you.
>
> Richard
>
> On Thu, Nov 10, 2011 at 2:58 PM, Anthony  wrote:
>
>> If you have "if 'new' in request.args:' you should not also need "if 
>> form.create_form" (even if you did, you could simply put them in the same 
>> "if" statement with an "and"). Alternatively, use "if hasattr(form, 
>> 'create_form'):" -- all by itself.
>>
>> Anthony
>>
>>
>> On Thursday, November 10, 2011 2:48:49 PM UTC-5, Richard wrote:
>>
>>> Here a working piece of code :
>>>
>>> def test_sqlformgrid():
>>> form = SQLFORM.grid(db.TABLE, ui='jquery-ui', 
>>> editable=auth.has_membership('**reviewer'), 
>>> deletable=auth.has_membership(**'reviewer'), formstyle = 'divs')
>>> if 'new' in request.args:
>>> if form.create_form
>>> for i in range(0,len(form.create_form[**0])):
>>> if len(form.create_form[0][i][2][**0]) > 0:
>>> form.create_form[0][i][0].**append(SPAN((helpicon(), 
>>> SPAN(form.create_form[0][i][2]**[0])),_class='tooltip'))
>>> del(form.create_form[0][i][2])
>>> return dict(form=form)
>>>
>>> Off course the for i in range... Is specific to my need but it the way 
>>> to manipulate the generated html form before it goes in user hand...
>>>
>>> :)
>>>
>>> Richard
>>>
>>> On Thu, Nov 10, 2011 at 2:44 PM, Richard Vézina wrote:
>>>
  It was working "if form.create_form:"...

 I thought that grid use form variable doesn't matter if the 
 SQLFORM.grid wasn't in a form variable at all...

 And my bad because I show form = crud... But it was not my 
 SQLFORM.grid... Arrg.

 Sorry about that...

 Richard

 On Thu, Nov 10, 2011 at 1:26 PM, Anthony  wrote:

> On Thursday, November 10, 2011 12:42:49 PM UTC-5, Richard wrote:
>>
>>
>> "if 'new' in request.args:" works (allow to load the grid) but the 
>> "if form.create_form:" not work alone or in conjunction with the former
>>
>
> Yeah, looks like it would have to be something like "if hasattr(form, 
> 'create_form'):". 
>


>>>
>

[web2py] redirected post requests and the validate function using post_vars

2011-11-10 Thread apple
The validate function uses current.request.post_vars. However when you
redirect a submitted form it becomes a "get" rather than "post" and
request.post_vars is empty.

Is there any reason why it is not just current.request.vars?


[web2py] Re: crud.read vars

2011-11-10 Thread Anthony
First, you don't use form.process() with crud forms -- crud handles the 
processing itself. Also, I believe that "read" forms do not have anything 
in form.vars, so you'll have to get those values directly from the 
submitted record.

Anthony

On Thursday, November 10, 2011 3:18:14 PM UTC-5, lucas wrote:
>
> hello everyone, 
>
> trying to understand why the pmsg below fails to pull the values of 
> the form ef.  all i get is None for each of the three, 
> ef.vars.email_address, ef.vars.subject, and ef.vars.message_body.  all 
> three are spelled correctly and the full form ef, displays all of the 
> proper information once the view is rendered. 
>
> def c_email(): 
> msg = "" 
> pmsg = "" 
> response.subtitle = "Email Us" 
> ef = crud.create(db.email, onaccept=lambda ef: ef.vars.id) 
> if ef.process().accepted: 
> if ef.vars.id: 
> msg = ef.vars.id 
> ef = crud.read(db.email, msg)#ef changes here 
> msg = str(msg)+" Your message was accepted and sent. Thank 
> you for your interest in IQa." 
> pmsg = P("reply_to: ", ef.vars.email_address, ", subject: 
> ", ef.vars.subject, ", message: ", ef.vars.message_body) 
> return dict(message=msg, email_form=ef, post_message=pmsg)



[web2py] Random Selection Issue

2011-11-10 Thread Andrew Evans
Hello I am trying to randomly select from entries in my database then store
that random result. The problem is its storing the wrong result (I think
its storing the previous random selection)

Any ideas how I can achieve my goal?


@auth.requires_login()
def xreflection():
game_id = request.args(0)
reflection_id = request.args(1)
if reflection_id == None:
return dict(redirect(URL('error','invalid')))
if (game_id == None):
return dict(redirect(URL('error','invalid')))
gameDB = db(db.xgame.id == int(game_id)).select() or
redirect(URL('error','invalid'))
cardDB = db(db.xcard.type ==
int(reflection_id)).select(orderby='',limitby=(0,1)) or
redirect(URL('error','invalid'))
for xcard in cardDB:
for xgame in gameDB:

form = SQLFORM(db.xreflection)
db.xreflection.game.default = xgame.id
#weird stuff happens here!
db.xreflection.card.default = xcard.id

db.xreflection.reflection_type.default = reflection_id
if form.accepts(request.vars, session):
db.notification.insert(receptient = xgame.userinfo, title =
form.vars.title, description = 'has responded to',type =
reflection_id,xgame=xgame.id)
session.flash = 'You have successfully reflected.'
return dict(redirect(URL('view','xgame',args=xgame.id)))
elif form.errors:
response.flash = 'Please correct the highlighted fields'
return dict(form=form,  xgame=xgame,xcard=xcard)
else:
return dict(form=form, xgame=xgame,xcard=xcard)


[web2py] Re: GAE - SQL cloud connection

2011-11-10 Thread pallav
Hi Massimo,

I just ran into the same issue on GAE SQL. Any update/ideas since the
last post? I'm happy to help code/debug/brainstorm.

Thanks,
Pallav

On Oct 19, 10:53 am, Massimo Di Pierro 
wrote:
> This is another of those weird mysql issues
>
> CREATE TABLE IF NOT EXISTS web2py_filesystem (path VARCHAR(512),
> content LONGTEXT, PRIMARYKEY(path));
>
> results in DatabaseError: 1071: Specifiedkeywastoolong; maxkey
> length is 767 bytes
>
> I need to think about a workaround I have been running on
> google:sql and I did not run into this problem before.
>
> On Oct 18, 10:51 pm, Simon Ashley  wrote:
>
>
>
>
>
>
>
> > Having an issues connecting to the SQL cloud.
>
> > Have a simple application which works on SQLite.
> > Able to deploy to GAE using the following:
> >   db = DAL('gae')
>
> > However if its changed to:
> >   db = DAL('google:sql://cdmr01:csm/csmcel05',migrate_enabled=True)
> >   # cdmr01:csm is the sql cloud instance and csmcel05 the GAE
> > application; which we assume is correct.
>
> > It can't create the database failing with the following log:
>
> > E 2011-10-19 13:00:14.137
> > Traceback (most recent call last):
> >   File "/base/data/home/apps/s~csmcel05/1.354064527714710096/gluon/
> > restricted.py", line 192, in restricted
> >     exec ccode in environment
> >   File "/base/data/home/apps/s~csmcel05/1.354064527714710096/
> > applications/demurage/models/db.py", line 16, in 
> >     session.connect(request, response, db=db)
> >   File "/base/data/home/apps/s~csmcel05/1.354064527714710096/gluon/
> > globals.py", line 425, in connect
> >     migrate=table_migrate,
> >   File "/base/data/home/apps/s~csmcel05/1.354064527714710096/gluon/
> > dal.py", line 4534, in define_table
> >     polymodel=polymodel)
> >   File "/base/data/home/apps/s~csmcel05/1.354064527714710096/gluon/
> > dal.py", line 691, in create_table
> >     logfile = self.file_open(table._loggername, 'a')
> >   File "/base/data/home/apps/s~csmcel05/1.354064527714710096/gluon/
> > dal.py", line 2925, in file_open
> >     return DatabaseStoredFile(self.db,filename,mode)
> >   File "/base/data/home/apps/s~csmcel05/1.354064527714710096/gluon/
> > dal.py", line 2866, in __init__
> >     self.db.executesql("CREATE TABLE IF NOT EXISTS web2py_filesystem
> > (path VARCHAR(512), content LONGTEXT, PRIMARYKEY(path) )
> > ENGINE=InnoDB;")
> >   File "/base/data/home/apps/s~csmcel05/1.354064527714710096/gluon/
> > dal.py", line 4607, in executesql
> >     self._adapter.execute(query)
> >   File "/base/data/home/apps/s~csmcel05/1.354064527714710096/gluon/
> > dal.py", line 1339, in execute
> >     return self.log_execute(*a, **b)
> >   File "/base/data/home/apps/s~csmcel05/1.354064527714710096/gluon/
> > dal.py", line 1334, in log_execute
> >     ret = self.cursor.execute(*a, **b)
> >   File "/base/python_runtime/python_lib/versions/1/google/storage/
> > speckle/python/api/rdbms.py", line 287, in execute
> >     response = self._conn.MakeRequest('Exec', request)
> >   File "/base/python_runtime/python_lib/versions/1/google/storage/
> > speckle/python/api/rdbms.py", line 579, in MakeRequest
> >     response = self._MakeRetriableRequest(stub_method, request)
> >   File "/base/python_runtime/python_lib/versions/1/google/storage/
> > speckle/python/api/rdbms.py", line 610, in _MakeRetriableRequest
> >     sql_exception.message))
> > DatabaseError: 1071: Specifiedkeywastoolong; maxkeylength is 767
> > bytes
>
> > Any ideas or work arounds?
> > (would be good to have a sample application we know works, if the
> > issue is with the connection/routes /app configurations)


[web2py] crud.read vars

2011-11-10 Thread lucas
hello everyone,

trying to understand why the pmsg below fails to pull the values of
the form ef.  all i get is None for each of the three,
ef.vars.email_address, ef.vars.subject, and ef.vars.message_body.  all
three are spelled correctly and the full form ef, displays all of the
proper information once the view is rendered.

def c_email():
msg = ""
pmsg = ""
response.subtitle = "Email Us"
ef = crud.create(db.email, onaccept=lambda ef: ef.vars.id)
if ef.process().accepted:
if ef.vars.id:
msg = ef.vars.id
ef = crud.read(db.email, msg)#ef changes here
msg = str(msg)+" Your message was accepted and sent. Thank
you for your interest in IQa."
pmsg = P("reply_to: ", ef.vars.email_address, ", subject:
", ef.vars.subject, ", message: ", ef.vars.message_body)
return dict(message=msg, email_form=ef, post_message=pmsg)


Re: [web2py] Re: SQLFORM.grid : formstyle, readable and writable control

2011-11-10 Thread Richard Vézina
Ok so this :

"if 'new' in request.args and form.create_form:"

or shorter :

"if hasattr(form, 'create_form'):"

?

Thank you.

Richard

On Thu, Nov 10, 2011 at 2:58 PM, Anthony  wrote:

> If you have "if 'new' in request.args:' you should not also need "if
> form.create_form" (even if you did, you could simply put them in the same
> "if" statement with an "and"). Alternatively, use "if hasattr(form,
> 'create_form'):" -- all by itself.
>
> Anthony
>
>
> On Thursday, November 10, 2011 2:48:49 PM UTC-5, Richard wrote:
>
>> Here a working piece of code :
>>
>> def test_sqlformgrid():
>> form = SQLFORM.grid(db.TABLE, ui='jquery-ui',
>> editable=auth.has_membership('**reviewer'),
>> deletable=auth.has_membership(**'reviewer'), formstyle = 'divs')
>> if 'new' in request.args:
>> if form.create_form
>> for i in range(0,len(form.create_form[**0])):
>> if len(form.create_form[0][i][2][**0]) > 0:
>> form.create_form[0][i][0].**append(SPAN((helpicon(),
>> SPAN(form.create_form[0][i][2]**[0])),_class='tooltip'))
>> del(form.create_form[0][i][2])
>> return dict(form=form)
>>
>> Off course the for i in range... Is specific to my need but it the way to
>> manipulate the generated html form before it goes in user hand...
>>
>> :)
>>
>> Richard
>>
>> On Thu, Nov 10, 2011 at 2:44 PM, Richard Vézina wrote:
>>
>>> It was working "if form.create_form:"...
>>>
>>> I thought that grid use form variable doesn't matter if the SQLFORM.grid
>>> wasn't in a form variable at all...
>>>
>>> And my bad because I show form = crud... But it was not my
>>> SQLFORM.grid... Arrg.
>>>
>>> Sorry about that...
>>>
>>> Richard
>>>
>>> On Thu, Nov 10, 2011 at 1:26 PM, Anthony  wrote:
>>>
 On Thursday, November 10, 2011 12:42:49 PM UTC-5, Richard wrote:
>
>
> "if 'new' in request.args:" works (allow to load the grid) but the "if
> form.create_form:" not work alone or in conjunction with the former
>

 Yeah, looks like it would have to be something like "if hasattr(form,
 'create_form'):".

>>>
>>>
>>


Re: [web2py] Re: SQLFORM.grid : formstyle, readable and writable control

2011-11-10 Thread Anthony
If you have "if 'new' in request.args:' you should not also need "if 
form.create_form" (even if you did, you could simply put them in the same 
"if" statement with an "and"). Alternatively, use "if hasattr(form, 
'create_form'):" -- all by itself.

Anthony

On Thursday, November 10, 2011 2:48:49 PM UTC-5, Richard wrote:
>
> Here a working piece of code :
>
> def test_sqlformgrid():
> form = SQLFORM.grid(db.TABLE, ui='jquery-ui', 
> editable=auth.has_membership('reviewer'), 
> deletable=auth.has_membership('reviewer'), formstyle = 'divs')
> if 'new' in request.args:
> if form.create_form
> for i in range(0,len(form.create_form[0])):
> if len(form.create_form[0][i][2][0]) > 0:
> form.create_form[0][i][0].append(SPAN((helpicon(), 
> SPAN(form.create_form[0][i][2][0])),_class='tooltip'))
> del(form.create_form[0][i][2])
> return dict(form=form)
>
> Off course the for i in range... Is specific to my need but it the way to 
> manipulate the generated html form before it goes in user hand...
>
> :)
>
> Richard
>
> On Thu, Nov 10, 2011 at 2:44 PM, Richard Vézina wrote:
>
>> It was working "if form.create_form:"...
>>
>> I thought that grid use form variable doesn't matter if the SQLFORM.grid 
>> wasn't in a form variable at all...
>>
>> And my bad because I show form = crud... But it was not my 
>> SQLFORM.grid... Arrg.
>>
>> Sorry about that...
>>
>> Richard
>>
>> On Thu, Nov 10, 2011 at 1:26 PM, Anthony  wrote:
>>
>>> On Thursday, November 10, 2011 12:42:49 PM UTC-5, Richard wrote:


 "if 'new' in request.args:" works (allow to load the grid) but the "if 
 form.create_form:" not work alone or in conjunction with the former

>>>
>>> Yeah, looks like it would have to be something like "if hasattr(form, 
>>> 'create_form'):". 
>>>
>>
>>
>

Re: [web2py] Re: SQLFORM.grid : formstyle, readable and writable control

2011-11-10 Thread Richard Vézina
Here a working piece of code :

def test_sqlformgrid():
form = SQLFORM.grid(db.TABLE, ui='jquery-ui',
editable=auth.has_membership('reviewer'),
deletable=auth.has_membership('reviewer'), formstyle = 'divs')
if 'new' in request.args:
if form.create_form
for i in range(0,len(form.create_form[0])):
if len(form.create_form[0][i][2][0]) > 0:
form.create_form[0][i][0].append(SPAN((helpicon(),
SPAN(form.create_form[0][i][2][0])),_class='tooltip'))
del(form.create_form[0][i][2])
return dict(form=form)

Off course the for i in range... Is specific to my need but it the way to
manipulate the generated html form before it goes in user hand...

:)

Richard

On Thu, Nov 10, 2011 at 2:44 PM, Richard Vézina  wrote:

> It was working "if form.create_form:"...
>
> I thought that grid use form variable doesn't matter if the SQLFORM.grid
> wasn't in a form variable at all...
>
> And my bad because I show form = crud... But it was not my SQLFORM.grid...
> Arrg.
>
> Sorry about that...
>
> Richard
>
> On Thu, Nov 10, 2011 at 1:26 PM, Anthony  wrote:
>
>> On Thursday, November 10, 2011 12:42:49 PM UTC-5, Richard wrote:
>>>
>>>
>>> "if 'new' in request.args:" works (allow to load the grid) but the "if
>>> form.create_form:" not work alone or in conjunction with the former
>>>
>>
>> Yeah, looks like it would have to be something like "if hasattr(form,
>> 'create_form'):".
>>
>
>


Re: [web2py] Re: SQLFORM.grid : formstyle, readable and writable control

2011-11-10 Thread Richard Vézina
It was working "if form.create_form:"...

I thought that grid use form variable doesn't matter if the SQLFORM.grid
wasn't in a form variable at all...

And my bad because I show form = crud... But it was not my SQLFORM.grid...
Arrg.

Sorry about that...

Richard

On Thu, Nov 10, 2011 at 1:26 PM, Anthony  wrote:

> On Thursday, November 10, 2011 12:42:49 PM UTC-5, Richard wrote:
>>
>>
>> "if 'new' in request.args:" works (allow to load the grid) but the "if
>> form.create_form:" not work alone or in conjunction with the former
>>
>
> Yeah, looks like it would have to be something like "if hasattr(form,
> 'create_form'):".
>


Re: [web2py] Re: html from text

2011-11-10 Thread Richard Vézina
Mean can't...

On Thu, Nov 10, 2011 at 2:32 PM, Richard Vézina  wrote:

> Yeah I can take this awful shortcut :(
>
> Thanks Anthony.
>
> Richard
>
>
> On Thu, Nov 10, 2011 at 2:27 PM, Anthony  wrote:
>
>> I don't think values inside  tags can include additional HTML
>> markup.
>>
>> Anthony
>>
>>
>> On Thursday, November 10, 2011 2:06:22 PM UTC-5, Richard wrote:
>>
>>> Ok I think you were asking if it were the select html menu...
>>>
>>> Select menu and I want option to display differently...
>>>
>>> I should not used the ul li helper... I just copied this lambda from
>>> somewhere else in my code to try something and ul li seems to cause
>>> confusion in this context. I want to have my option value to display
>>> differently like this :
>>>
>>> 10-11-1/ Volume 02/ Tome 05 dtggfd/
>>>  element1
>>>
>>> Instead of :
>>>
>>> 10-11-1/Volume 02/Tome 05/element1
>>>
>>> And I am not sure if it even possible...
>>>
>>> Hope it more clear.
>>>
>>>
>>> Richard
>>>
>>>
>>>
>>> On Thu, Nov 10, 2011 at 1:34 PM, Anthony  wrote:
>>>
 On Thursday, November 10, 2011 1:31:04 PM UTC-5, Richard wrote:
>
> Yes!


 It was an either/or question. Is it a  or a  based menu?

>>>
>>>
>


Re: [web2py] Re: html from text

2011-11-10 Thread Richard Vézina
Yeah I can take this awful shortcut :(

Thanks Anthony.

Richard

On Thu, Nov 10, 2011 at 2:27 PM, Anthony  wrote:

> I don't think values inside  tags can include additional HTML
> markup.
>
> Anthony
>
>
> On Thursday, November 10, 2011 2:06:22 PM UTC-5, Richard wrote:
>
>> Ok I think you were asking if it were the select html menu...
>>
>> Select menu and I want option to display differently...
>>
>> I should not used the ul li helper... I just copied this lambda from
>> somewhere else in my code to try something and ul li seems to cause
>> confusion in this context. I want to have my option value to display
>> differently like this :
>>
>> 10-11-1/ Volume 02/ Tome 05 dtggfd/
>>  element1
>>
>> Instead of :
>>
>> 10-11-1/Volume 02/Tome 05/element1
>>
>> And I am not sure if it even possible...
>>
>> Hope it more clear.
>>
>>
>> Richard
>>
>>
>>
>> On Thu, Nov 10, 2011 at 1:34 PM, Anthony  wrote:
>>
>>> On Thursday, November 10, 2011 1:31:04 PM UTC-5, Richard wrote:

 Yes!
>>>
>>>
>>> It was an either/or question. Is it a  or a  based menu?
>>>
>>
>>


Re: [web2py] smartgrid styling

2011-11-10 Thread Jim Steil
Have you started a brand new app and used it, or added it to an an older 
app?  There were a number of css changes/additions at some point.


-Jim

On 11/10/2011 12:45 PM, Cliff wrote:

Am I missing something?

Running 1.99.2 smartgrid works but definitely needs styling.  I see
the styling for web2py grid in base css and grid looks fine.
Smartgrid not so much.


Re: [web2py] Re: html from text

2011-11-10 Thread Anthony
I don't think values inside  tags can include additional HTML 
markup.

Anthony

On Thursday, November 10, 2011 2:06:22 PM UTC-5, Richard wrote:
>
> Ok I think you were asking if it were the select html menu...
>
> Select menu and I want option to display differently...
>
> I should not used the ul li helper... I just copied this lambda from 
> somewhere else in my code to try something and ul li seems to cause 
> confusion in this context. I want to have my option value to display 
> differently like this :
>
> 10-11-1/ Volume 02/ Tome 05 dtggfd/
>  element1
>
> Instead of :
>
> 10-11-1/Volume 02/Tome 05/element1
>
> And I am not sure if it even possible...
>
> Hope it more clear.
>
>
> Richard
>
>
>
> On Thu, Nov 10, 2011 at 1:34 PM, Anthony  wrote:
>
>> On Thursday, November 10, 2011 1:31:04 PM UTC-5, Richard wrote:
>>>
>>> Yes!
>>
>>
>> It was an either/or question. Is it a  or a  based menu? 
>>
>
>

Re: [web2py] Re: html from text

2011-11-10 Thread Richard Vézina
Need something like this :
http://www.web2ajax.fr/2008/02/03/facebook-like-jquery-and-autosuggest-search-engine/

Richard

On Thu, Nov 10, 2011 at 2:06 PM, Richard Vézina  wrote:

> Ok I think you were asking if it were the select html menu...
>
> Select menu and I want option to display differently...
>
> I should not used the ul li helper... I just copied this lambda from
> somewhere else in my code to try something and ul li seems to cause
> confusion in this context. I want to have my option value to display
> differently like this :
>
> 10-11-1/ Volume 02/ Tome 05 dtggfd/
>  element1
>
> Instead of :
>
> 10-11-1/Volume 02/Tome 05/element1
>
> And I am not sure if it even possible...
>
> Hope it more clear.
>
>
> Richard
>
>
>
> On Thu, Nov 10, 2011 at 1:34 PM, Anthony  wrote:
>
>> On Thursday, November 10, 2011 1:31:04 PM UTC-5, Richard wrote:
>>>
>>> Yes!
>>
>>
>> It was an either/or question. Is it a  or a  based menu?
>>
>
>


Re: [web2py] cool css3 hover effects

2011-11-10 Thread Richard Vézina
Pretty nice... Thanks Richard

On Thu, Nov 10, 2011 at 1:57 PM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> http://tympanus.net/Tutorials/OriginalHoverEffects/index.html


Re: [web2py] Re: html from text

2011-11-10 Thread Richard Vézina
Ok I think you were asking if it were the select html menu...

Select menu and I want option to display differently...

I should not used the ul li helper... I just copied this lambda from
somewhere else in my code to try something and ul li seems to cause
confusion in this context. I want to have my option value to display
differently like this :

10-11-1/ Volume 02/ Tome 05 dtggfd/
 element1

Instead of :

10-11-1/Volume 02/Tome 05/element1

And I am not sure if it even possible...

Hope it more clear.


Richard



On Thu, Nov 10, 2011 at 1:34 PM, Anthony  wrote:

> On Thursday, November 10, 2011 1:31:04 PM UTC-5, Richard wrote:
>>
>> Yes!
>
>
> It was an either/or question. Is it a  or a  based menu?
>


[web2py] Re: Apostrophe error in the database

2011-11-10 Thread Massimo Di Pierro
Technically the flashbuilder service is wrong because it does not
understand unicode escaping.

Anyway, I changed the behavior for XML. Check trunk.


On Nov 10, 12:39 pm, eric tchonfene  wrote:
> The XML is being parsed by a Flashbuilder  app and  yes the apostrophe
> showing up that way is causing a problem.
>
>
>
>
>
>
>
> On Thu, Nov 10, 2011 at 12:28 PM, Anthony  wrote:
> > On Thursday, November 10, 2011 12:42:42 PM UTC-5, africanacloud wrote:
>
> >> When I look at the data in the database it shows up just fine (Lady's
> >> room) the error only happens when I am trying to view data as xml I get
> >> Lady'sRoom.As I said I am new to web2py so I need to do some reading
> >> to understand the tool.
>
> >  What are you doing with the xml? Does the apostrophe being represented
> > that way cause problems for the ultimate use of the xml?


[web2py] Re: Apostrophe error in the database

2011-11-10 Thread Anthony
On Thursday, November 10, 2011 12:29:58 PM UTC-5, Massimo Di Pierro wrote:
>
> Yes but there is nothing wrong with that. Your page is in unicode and 
> that is the right way to represent the apostrophe un unicode. 
>
> Does it show an postrophe when you look at it?
>

Massimo, he's generating XML to be consumed by another app and doesn't want 
the values escaped, which the gluon.serializers.xml_rec serializer does. 
Maybe there should be an option to prevent the serializer from escaping 
(note, the JSON serializer doesn't do any escaping).

Anthony 


Re: [web2py] Re: Apostrophe error in the database

2011-11-10 Thread Anthony
On Thursday, November 10, 2011 1:39:01 PM UTC-5, africanacloud wrote:
>
> The XML is being parsed by a Flashbuilder  app and  yes the apostrophe 
> showing up that way is causing a problem.
>

Is JSON an option? I don't think the JSON serializer does any escaping.

Anthony 


[web2py] cool css3 hover effects

2011-11-10 Thread Massimo Di Pierro
http://tympanus.net/Tutorials/OriginalHoverEffects/index.html


[web2py] smartgrid styling

2011-11-10 Thread Cliff
Am I missing something?

Running 1.99.2 smartgrid works but definitely needs styling.  I see
the styling for web2py grid in base css and grid looks fine.
Smartgrid not so much.


Re: [web2py] Re: Apostrophe error in the database

2011-11-10 Thread eric tchonfene
The XML is being parsed by a Flashbuilder  app and  yes the apostrophe
showing up that way is causing a problem.

On Thu, Nov 10, 2011 at 12:28 PM, Anthony  wrote:

> On Thursday, November 10, 2011 12:42:42 PM UTC-5, africanacloud wrote:
>>
>> When I look at the data in the database it shows up just fine (Lady's
>> room) the error only happens when I am trying to view data as xml I get
>> Lady'sRoom.As I said I am new to web2py so I need to do some reading
>> to understand the tool.
>>
>
>  What are you doing with the xml? Does the apostrophe being represented
> that way cause problems for the ultimate use of the xml?
>


Re: [web2py] Re: html from text

2011-11-10 Thread Anthony
On Thursday, November 10, 2011 1:31:04 PM UTC-5, Richard wrote:
>
> Yes!


It was an either/or question. Is it a  or a  based menu? 


Re: [web2py] Re: html from text

2011-11-10 Thread Richard Vézina
Yes!

Richard

On Thu, Nov 10, 2011 at 1:20 PM, Anthony  wrote:

> When you say "dropdown", is it a  element, or some kind of JS or
> CSS menu based on a ?
>
>
> On Thursday, November 10, 2011 12:55:57 PM UTC-5, Richard wrote:
>
>> I have a dropdown, I use to represent the id of the linked table with the
>> reprensent I wrote... Now the dropdown witdh get pretty large because of
>> user data that I need to concatenate to make thing clear on what will be
>> selected... User use to duplicate the unique key of the foreight table
>> since que id is surrogate and the candidate field for unique key are not
>> unique I have to make it unique by showing the element to wich the linked
>> table link to...
>>
>> Hope you can follow...
>>
>> But basically I concatenate multiple table relation like this
>> table1uniquefield/**table2uniquefield/etc. None of the table are really
>> unique until they are associate together so I need to concatenate the
>> linked row between my differents tables...
>>
>> So I try to solve my issue by tweaking the display of dropdown menu by
>> putting on many row the reprensentation... Instead of having :
>>
>> table1-1/table2/table3-**element1 give ID 1 table 3
>> table1-2/table2/table3-**element1 give ID 2 table 3
>> table1-3/table3/table3-**element2 give ID 3 table 3
>>
>> I want to have in my dropdown :
>>
>> table1-1/
>> table2/
>> table3-element1 give ID 1 table 3
>> table1-2/
>> table2/
>> table3-element1 give ID 2 table 3
>> table1-3/
>> table3/
>> table3-element2 give ID 3 table 3
>>
>> Pretty awful I know...
>>
>> I will try other solution latter jQuery UI Autocomplet...
>>
>> Richard
>>
>> On Thu, Nov 10, 2011 at 12:19 PM, Anthony  wrote:
>>
>>> I don't understand -- where is that ul supposed to go? What field are
>>> your representing? What is the "default navigator drop box"?
>>>
>>>
>>> On Thursday, November 10, 2011 12:03:27 PM UTC-5, Richard wrote:
>>>
 Workin in console :


 In [1]: test123 = 'test/test2/test3/'

 In [2]: test123
 Out[2]: 'test/test2/test3/'

 In [3]: for v in test123.split('/'):
...: if v != '':
...: v
...:
...:
 Out[3]: 'test'
 Out[3]: 'test2'
 Out[3]: 'test3'

 In [4]: XML(UL(*[ LI(v) for v in test123.split('/') if v != '' ]))
 Out[4]: 

 In [5]: print XML(UL(*[ LI(v) for v in test123.split('/') if v != '' ]))
 testtest2test3

 But in generated view I only get the default option no ul or li...

  Thanks

 Richard

 On Thu, Nov 10, 2011 at 12:01 PM, Richard Vézina wrote:

> Hello Anthony,
>
> I am trying to do something bizzard... I would like to have your
> advice if it's even possible :
>
> represent=lambda value, row: (value!=None and XML(UL(*[ LI(v) for v in
> value.split('/') if v != '' ]))) or 'None'
>
> I would like the default navigator drop box to display html stuff is
> this possible?
>
> Thanks
>
> Richard
>
>
> On Thu, Nov 10, 2011 at 8:07 AM, Anthony  wrote:
>
>> On Thursday, November 10, 2011 7:58:57 AM UTC-5, peter wrote:
>>>
>>> I have a couple of problems with 'text' fields in databases. I want
>>> to
>>> be able to use a WYSIWIG editor, so I have set up ckeditor using the
>>> instructions here
>>>
>>> http://www.web2pyslices.com/**slices/take_slice/18
>>>
>>> This works fine, but there is no toolbar appearing with the editor.
>>> How does one get the basic toolbar to appear?
>>>
>>
>> You have to set the CKEditor options -- see it's documentation:
>> http://**ckeditor**.com/ 
>>
>>
>>>
>>> If I succeed in getting this working and can embolden text etc. How
>>> do
>>> I convert the text to html that reflects this emboldening?
>>>
>>
>> You won't be converting text to HTML -- CKEditor itself generates
>> HTML, which is what will get saved in the associated text field in the 
>> DB.
>> The trick is how to get the HTML to display properly when you pull it 
>> from
>> the DB and include it in the view. By default, web2py will escape the 
>> HTML,
>> so it won't display as intended. To avoid that, use the XML() helper -- 
>> in
>> the view, {{=XML(your_html_content)}}. Though this is dangerous if
>> you are allowing users to enter the HTML because they can insert 
>> malicious
>> Javascript. In that case, use {{=XML(your_html_content,
>> sanitize=True)}}, though that will limit the allowed HTML tags and
>> attributes. See 
>> http://web2py.com/book/**def**ault/chapter/05#XML
>> .
>>
>> Anthony
>>
>
>

>>


Re: [web2py] Re: Apostrophe error in the database

2011-11-10 Thread Anthony
On Thursday, November 10, 2011 12:42:42 PM UTC-5, africanacloud wrote:
>
> When I look at the data in the database it shows up just fine (Lady's 
> room) the error only happens when I am trying to view data as xml I get 
> Lady'sRoom.As I said I am new to web2py so I need to do some reading  
> to understand the tool.
>
 
 What are you doing with the xml? Does the apostrophe being represented 
that way cause problems for the ultimate use of the xml?


Re: [web2py] Re: SQLFORM.grid : formstyle, readable and writable control

2011-11-10 Thread Anthony
On Thursday, November 10, 2011 12:42:49 PM UTC-5, Richard wrote:
>
>
> "if 'new' in request.args:" works (allow to load the grid) but the "if 
> form.create_form:" not work alone or in conjunction with the former
>

Yeah, looks like it would have to be something like "if hasattr(form, 
'create_form'):". 


Re: [web2py] Re: html from text

2011-11-10 Thread Anthony
When you say "dropdown", is it a  element, or some kind of JS or 
CSS menu based on a ?

On Thursday, November 10, 2011 12:55:57 PM UTC-5, Richard wrote:
>
> I have a dropdown, I use to represent the id of the linked table with the 
> reprensent I wrote... Now the dropdown witdh get pretty large because of 
> user data that I need to concatenate to make thing clear on what will be 
> selected... User use to duplicate the unique key of the foreight table 
> since que id is surrogate and the candidate field for unique key are not 
> unique I have to make it unique by showing the element to wich the linked 
> table link to...
>
> Hope you can follow... 
>
> But basically I concatenate multiple table relation like this 
> table1uniquefield/table2uniquefield/etc. None of the table are really 
> unique until they are associate together so I need to concatenate the 
> linked row between my differents tables...
>
> So I try to solve my issue by tweaking the display of dropdown menu by 
> putting on many row the reprensentation... Instead of having :
>
> table1-1/table2/table3-element1 give ID 1 table 3
> table1-2/table2/table3-element1 give ID 2 table 3
> table1-3/table3/table3-element2 give ID 3 table 3
>
> I want to have in my dropdown :
>
> table1-1/
> table2/
> table3-element1 give ID 1 table 3
> table1-2/
> table2/
> table3-element1 give ID 2 table 3
> table1-3/
> table3/
> table3-element2 give ID 3 table 3
>
> Pretty awful I know...
>
> I will try other solution latter jQuery UI Autocomplet... 
>
> Richard
>
> On Thu, Nov 10, 2011 at 12:19 PM, Anthony  wrote:
>
>> I don't understand -- where is that ul supposed to go? What field are 
>> your representing? What is the "default navigator drop box"?
>>
>>
>> On Thursday, November 10, 2011 12:03:27 PM UTC-5, Richard wrote:
>>
>>> Workin in console :
>>>
>>>  
>>> In [1]: test123 = 'test/test2/test3/'
>>>
>>> In [2]: test123
>>> Out[2]: 'test/test2/test3/'
>>>
>>> In [3]: for v in test123.split('/'):
>>>...: if v != '':
>>>...: v
>>>...: 
>>>...: 
>>> Out[3]: 'test'
>>> Out[3]: 'test2'
>>> Out[3]: 'test3'
>>>
>>> In [4]: XML(UL(*[ LI(v) for v in test123.split('/') if v != '' ]))
>>> Out[4]: 
>>>
>>> In [5]: print XML(UL(*[ LI(v) for v in test123.split('/') if v != '' ]))
>>> testtest2test3
>>>
>>> But in generated view I only get the default option no ul or li...
>>>
>>>  Thanks
>>>
>>> Richard
>>>
>>> On Thu, Nov 10, 2011 at 12:01 PM, Richard Vézina wrote:
>>>
 Hello Anthony,

 I am trying to do something bizzard... I would like to have your advice 
 if it's even possible :

 represent=lambda value, row: (value!=None and XML(UL(*[ LI(v) for v in 
 value.split('/') if v != '' ]))) or 'None'

 I would like the default navigator drop box to display html stuff is 
 this possible?

 Thanks

 Richard
  

 On Thu, Nov 10, 2011 at 8:07 AM, Anthony  wrote:

> On Thursday, November 10, 2011 7:58:57 AM UTC-5, peter wrote:
>>
>> I have a couple of problems with 'text' fields in databases. I want 
>> to 
>> be able to use a WYSIWIG editor, so I have set up ckeditor using the 
>> instructions here 
>>
>> http://www.web2pyslices.com/**sl**ices/take_slice/18
>>  
>>
>> This works fine, but there is no toolbar appearing with the editor. 
>> How does one get the basic toolbar to appear?
>>
>
> You have to set the CKEditor options -- see it's documentation: 
> http://**ckeditor.com/ 
>  
>
>>
>> If I succeed in getting this working and can embolden text etc. How 
>> do 
>> I convert the text to html that reflects this emboldening?
>>
>
> You won't be converting text to HTML -- CKEditor itself generates 
> HTML, which is what will get saved in the associated text field in the 
> DB. 
> The trick is how to get the HTML to display properly when you pull it 
> from 
> the DB and include it in the view. By default, web2py will escape the 
> HTML, 
> so it won't display as intended. To avoid that, use the XML() helper -- 
> in 
> the view, {{=XML(your_html_content)}}. Though this is dangerous if 
> you are allowing users to enter the HTML because they can insert 
> malicious 
> Javascript. In that case, use {{=XML(your_html_content, 
> sanitize=True)}}, though that will limit the allowed HTML tags and 
> attributes. See 
> http://web2py.com/book/**default/chapter/05#XML
> .
>
> Anthony
>


>>>
>

[web2py] Re: Active Directory Authentication and Apache

2011-11-10 Thread Akabander

Responding to my own post... I found the problem by using tethereal to
capture the exchange between my server and the Active Directory
server.

I was under the mistaken impression that because the web2py LDAP
authentication does not require binding information that the AD server
had been configured to accept anonymous binds. This is not the case!
The web2py LDAP module does something rather clever: Apparently if
there is no bind information in the configuration, the module will use
the user-entered credentials to first bind to the server before
performing a query (using the dn fields to create an email address for
the binding). So from a configuration standpoint, it looks like no
bind user/password information is needed, when in fact it is created
on the fly.

Apache lacks such cleverness, and I had to specify a user and password
before it would authenticate against the AD server.

Hopefully this will be useful information should someone else get as
confused as I was!

Nick




Re: [web2py] Re: SQLFORM.smartgrid - multiple problems with latest trunk

2011-11-10 Thread Jim Steil

Ticket created

http://code.google.com/p/web2py/issues/detail?id=508


On 11/10/2011 11:33 AM, Massimo Di Pierro wrote:

please repost problems asap about it. I have made some backward
incompatible changes to the grid/smartgrid in order to clean up the
API and updating the book.

the columns argument is gone because it was redundant. we have fields.
I have added some params.

On Nov 10, 11:16 am, Jim Steil  wrote:

Hi

I've been using SQLFORM.smartgrid for some time now.  I updated to the
latest trunk this morning and am now having a number of different issues
with code unchanged from yesterday.

Are there changes pending and I should hold off reporting problems, or
should I start going through them?

  -Jim


Re: [web2py] Re: html from text

2011-11-10 Thread Richard Vézina
I have a dropdown, I use to represent the id of the linked table with the
reprensent I wrote... Now the dropdown witdh get pretty large because of
user data that I need to concatenate to make thing clear on what will be
selected... User use to duplicate the unique key of the foreight table
since que id is surrogate and the candidate field for unique key are not
unique I have to make it unique by showing the element to wich the linked
table link to...

Hope you can follow...

But basically I concatenate multiple table relation like this
table1uniquefield/table2uniquefield/etc. None of the table are really
unique until they are associate together so I need to concatenate the
linked row between my differents tables...

So I try to solve my issue by tweaking the display of dropdown menu by
putting on many row the reprensentation... Instead of having :

table1-1/table2/table3-element1 give ID 1 table 3
table1-2/table2/table3-element1 give ID 2 table 3
table1-3/table3/table3-element2 give ID 3 table 3

I want to have in my dropdown :

table1-1/
table2/
table3-element1 give ID 1 table 3
table1-2/
table2/
table3-element1 give ID 2 table 3
table1-3/
table3/
table3-element2 give ID 3 table 3

Pretty awful I know...

I will try other solution latter jQuery UI Autocomplet...

Richard

On Thu, Nov 10, 2011 at 12:19 PM, Anthony  wrote:

> I don't understand -- where is that ul supposed to go? What field are your
> representing? What is the "default navigator drop box"?
>
>
> On Thursday, November 10, 2011 12:03:27 PM UTC-5, Richard wrote:
>
>> Workin in console :
>>
>>
>> In [1]: test123 = 'test/test2/test3/'
>>
>> In [2]: test123
>> Out[2]: 'test/test2/test3/'
>>
>> In [3]: for v in test123.split('/'):
>>...: if v != '':
>>...: v
>>...:
>>...:
>> Out[3]: 'test'
>> Out[3]: 'test2'
>> Out[3]: 'test3'
>>
>> In [4]: XML(UL(*[ LI(v) for v in test123.split('/') if v != '' ]))
>> Out[4]: 
>>
>> In [5]: print XML(UL(*[ LI(v) for v in test123.split('/') if v != '' ]))
>> testtest2test3
>>
>> But in generated view I only get the default option no ul or li...
>>
>> Thanks
>>
>> Richard
>>
>> On Thu, Nov 10, 2011 at 12:01 PM, Richard Vézina 
>> wrote:
>>
>>> Hello Anthony,
>>>
>>> I am trying to do something bizzard... I would like to have your advice
>>> if it's even possible :
>>>
>>> represent=lambda value, row: (value!=None and XML(UL(*[ LI(v) for v in
>>> value.split('/') if v != '' ]))) or 'None'
>>>
>>> I would like the default navigator drop box to display html stuff is
>>> this possible?
>>>
>>> Thanks
>>>
>>> Richard
>>>
>>>
>>> On Thu, Nov 10, 2011 at 8:07 AM, Anthony  wrote:
>>>
 On Thursday, November 10, 2011 7:58:57 AM UTC-5, peter wrote:
>
> I have a couple of problems with 'text' fields in databases. I want to
> be able to use a WYSIWIG editor, so I have set up ckeditor using the
> instructions here
>
> http://www.web2pyslices.com/**sl**ices/take_slice/18
>
> This works fine, but there is no toolbar appearing with the editor.
> How does one get the basic toolbar to appear?
>

 You have to set the CKEditor options -- see it's documentation: http://
 **ckeditor.com/ 


>
> If I succeed in getting this working and can embolden text etc. How do
> I convert the text to html that reflects this emboldening?
>

 You won't be converting text to HTML -- CKEditor itself generates HTML,
 which is what will get saved in the associated text field in the DB. The
 trick is how to get the HTML to display properly when you pull it from the
 DB and include it in the view. By default, web2py will escape the HTML, so
 it won't display as intended. To avoid that, use the XML() helper -- in the
 view, {{=XML(your_html_content)}}. Though this is dangerous if you are
 allowing users to enter the HTML because they can insert malicious
 Javascript. In that case, use {{=XML(your_html_content,
 sanitize=True)}}, though that will limit the allowed HTML tags and
 attributes. See 
 http://web2py.com/book/**default/chapter/05#XML
 .

 Anthony

>>>
>>>
>>


Re: [web2py] Re: Apostrophe error in the database

2011-11-10 Thread eric tchonfene
When I look at the data in the database it shows up just fine (Lady's room)
the error only happens when I am trying to view data as xml I get
Lady'sRoom.As I said I am new to web2py so I need to do some reading
to understand the tool.

On Thu, Nov 10, 2011 at 11:29 AM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> Yes but there is nothing wrong with that. Your page is in unicode and
> that is the right way to represent the apostrophe un unicode.
>
> Does it show an postrophe when you look at it?
>
> On Nov 10, 9:04 am, eric tchonfene  wrote:
> > This the result I get when I call the function
> > this the xml that I get back my apostrophe is changed to '
> > Lady'sRoom
> >
> > On Thu, Nov 10, 2011 at 8:31 AM, Massimo Di Pierro <
> >
> >
> >
> >
> >
> >
> >
> > massimo.dipie...@gmail.com> wrote:
> > > There are two warnings in this page:
> > >http://www.pythonsecurity.org/wiki/web2py/?version=22001
> >
> > > They have bot been addressed one year ago. They have been addressed by
> > > quoting the string.
> >
> > > This is the expected bahviour. What problems does it cause you?
> >
> > > Massimo
> >
> > > On Nov 9, 6:55 pm, africanacloud  wrote:
> > > > I am new to web2py and I have a problem  understanding why all my
> > > > apostrophes are replaced by '.
> >
> > > > here is my table:
> > > > db.define_table('rooms',
> > > > Field('Name'),
> >
> > >
> Field('created_on','datetime',default=request.now,writable=False,readable=F
> > > alse))
> >
> > > > below is my function:
> >
> > > > @service.xml
> > > > def rooms():
> > > > ROOMS = db(db.rooms).select()
> > > > return ROOMS
> >
> > > > this is the result is.
> > > > Lady'sRoom
> > > > Any of you know what is going on here?


Re: [web2py] Re: GAE & Python 2.7

2011-11-10 Thread Jonathan Lundell
On Nov 10, 2011, at 9:40 AM, pallav wrote:

> Thank you. Am testing it out now.
> 
> On Nov 3, 8:48 pm, Jonathan Lundell  wrote:
>> There's now a new version of app.example.yaml in the trunk. If you're 
>> working with the Google App Engine, read on.
>> 
>> GAEhas been evolving a bit, and now supports Python 2.7 (vs 2.5). The new 
>> app.example.yaml is configured to use Python 2.7 and 
>> supportconcurrentrequests. It can be modified in (I think) an obvious way to 
>> do 2.5, but the 2.7 version should be considerable faster, since it uses 
>> WSGI instead of CGI.
>> 
>> Two drawbacks. 2.7 support is still in beta, and theGAELauncher doesn't 
>> support it, so you'll need to deploy your app through the command line.

app.yaml in the trunk now defaults to 2.5, so you'll need to edit it for 2.7.  
And the latest Launcher supports 2.7 (hurray!).

Re: [web2py] Re: SQLFORM.grid : formstyle, readable and writable control

2011-11-10 Thread Richard Vézina
On Thu, Nov 10, 2011 at 12:26 PM, Anthony  wrote:

> On Thursday, November 10, 2011 12:25:09 PM UTC-5, Anthony wrote:
>>
>>
>> When you first call this function, there will be no form.create_form
>> because it's just generating the grid. When you click on the "Add" button,
>> it should call this same function, but with "new" as one of the URL args.
>> So, I guess you'd have to add an "if 'new' in request.args:" condition.
>>
>
> Actually:
>
> if form.create_form:
>
> should work as well.
>

"if 'new' in request.args:" works (allow to load the grid) but the "if
form.create_form:" not work alone or in conjunction with the former :

def test_sqlformgrid():
table = SQLFORM.grid(db.TABLE, ui='jquery-ui',
editable=auth.has_membership('reviewer'),
deletable=auth.has_membership('reviewer'), formstyle = 'divs')
if 'new' in request.args:
if form.create_form: # not working neither without the if 'new'...
for i in range(0,len(form.create_form[0])):
if len(form[0][i][2][0]) > 0:
form[0][i][0].append(SPAN((helpicon(),
SPAN(form[0][i][2][0])),_class='tooltip'))
del(form[0][i][2])
return dict(table=table)

Richard


Re: [web2py] Re: Python 2.7 on GAE (experimental)

2011-11-10 Thread Jonathan Lundell
On Nov 10, 2011, at 9:32 AM, pallav wrote:

>> web2py is normally multithreaded when running as a WSGI app (as with its 
>> internal Rocket server, or Apache mod_wsgi). GAE is just catching up.
>> One GAE consideration, though, is that while normally requests within the 
>> same web2py session are serialized, that is not the case on GAE.
> 
> Thanks for the response. If I understand the response correctly it is
> okay to enable the multithreading option in app.yaml because web2py
> already is thread-safe? (I am trying to use Python 2.7 on GAE - this
> is an experimental feature on GAE but I feel it is the way to go)

Right. I'm using 2.7+GAE as well, though I'm using the native Google Datastore 
API instead of the DAL, because I need transactions, which DAL doesn't support 
in the Datastore, especially under 2.7 (for reasons I can elaborate on if 
you're interested).

> 
> I don't understand the implication of the second sentence though - if
> responses are not serialized, what should I watch out for? I looked
> through the book and it speaks about concurrent database transactions,
> but not much else.

That's the real issue. The web2py trunk (but not IIRC the stable release) has 
DAL support for select-for-update, which should give us transaction support 
with most SQL databases. But not with the Google Datastore, or presumably with 
other NoSQL databases. One workaround would be to use GAE with MySQL, I suppose.



[web2py] Re: GAE & Python 2.7

2011-11-10 Thread pallav
Thank you. Am testing it out now.

On Nov 3, 8:48 pm, Jonathan Lundell  wrote:
> There's now a new version of app.example.yaml in the trunk. If you're working 
> with the Google App Engine, read on.
>
> GAEhas been evolving a bit, and now supports Python 2.7 (vs 2.5). The new 
> app.example.yaml is configured to use Python 2.7 and 
> supportconcurrentrequests. It can be modified in (I think) an obvious way to 
> do 2.5, but the 2.7 version should be considerable faster, since it uses WSGI 
> instead of CGI.
>
> Two drawbacks. 2.7 support is still in beta, and theGAELauncher doesn't 
> support it, so you'll need to deploy your app through the command line.


Re: [web2py] Re: SQLFORM.smartgrid - multiple problems with latest trunk

2011-11-10 Thread Jim Steil

Working up some test cases now and will submit tickets.

-Jim

On 11/10/2011 11:33 AM, Massimo Di Pierro wrote:

please repost problems asap about it. I have made some backward
incompatible changes to the grid/smartgrid in order to clean up the
API and updating the book.

the columns argument is gone because it was redundant. we have fields.
I have added some params.

On Nov 10, 11:16 am, Jim Steil  wrote:

Hi

I've been using SQLFORM.smartgrid for some time now.  I updated to the
latest trunk this morning and am now having a number of different issues
with code unchanged from yesterday.

Are there changes pending and I should hold off reporting problems, or
should I start going through them?

  -Jim


[web2py] Re: SQLFORM.smartgrid - multiple problems with latest trunk

2011-11-10 Thread Massimo Di Pierro
please repost problems asap about it. I have made some backward
incompatible changes to the grid/smartgrid in order to clean up the
API and updating the book.

the columns argument is gone because it was redundant. we have fields.
I have added some params.

On Nov 10, 11:16 am, Jim Steil  wrote:
> Hi
>
> I've been using SQLFORM.smartgrid for some time now.  I updated to the
> latest trunk this morning and am now having a number of different issues
> with code unchanged from yesterday.
>
> Are there changes pending and I should hold off reporting problems, or
> should I start going through them?
>
>      -Jim


[web2py] Re: Online Book Typo

2011-11-10 Thread Massimo Di Pierro
Lots of typos have been fixed. Will post a book ed 3.3 shortly

On Nov 10, 11:19 am, mikech  wrote:
> So can we assume that the typos we see there now, have not been reported?


[web2py] Re: Python 2.7 on GAE (experimental)

2011-11-10 Thread pallav
> web2py is normally multithreaded when running as a WSGI app (as with its 
> internal Rocket server, or Apache mod_wsgi). GAE is just catching up.
> One GAE consideration, though, is that while normally requests within the 
> same web2py session are serialized, that is not the case on GAE.

Thanks for the response. If I understand the response correctly it is
okay to enable the multithreading option in app.yaml because web2py
already is thread-safe? (I am trying to use Python 2.7 on GAE - this
is an experimental feature on GAE but I feel it is the way to go)

I don't understand the implication of the second sentence though - if
responses are not serialized, what should I watch out for? I looked
through the book and it speaks about concurrent database transactions,
but not much else.


[web2py] Re: Apostrophe error in the database

2011-11-10 Thread Massimo Di Pierro
Yes but there is nothing wrong with that. Your page is in unicode and
that is the right way to represent the apostrophe un unicode.

Does it show an postrophe when you look at it?

On Nov 10, 9:04 am, eric tchonfene  wrote:
> This the result I get when I call the function
> this the xml that I get back my apostrophe is changed to '
> Lady'sRoom
>
> On Thu, Nov 10, 2011 at 8:31 AM, Massimo Di Pierro <
>
>
>
>
>
>
>
> massimo.dipie...@gmail.com> wrote:
> > There are two warnings in this page:
> >http://www.pythonsecurity.org/wiki/web2py/?version=22001
>
> > They have bot been addressed one year ago. They have been addressed by
> > quoting the string.
>
> > This is the expected bahviour. What problems does it cause you?
>
> > Massimo
>
> > On Nov 9, 6:55 pm, africanacloud  wrote:
> > > I am new to web2py and I have a problem  understanding why all my
> > > apostrophes are replaced by '.
>
> > > here is my table:
> > > db.define_table('rooms',
> > >     Field('Name'),
>
> > Field('created_on','datetime',default=request.now,writable=False,readable=F
> > alse))
>
> > > below is my function:
>
> > > @service.xml
> > > def rooms():
> > >         ROOMS = db(db.rooms).select()
> > >         return ROOMS
>
> > > this is the result is.
> > > Lady'sRoom
> > > Any of you know what is going on here?


[web2py] Re: SQLFORM.grid : formstyle, readable and writable control

2011-11-10 Thread Cliff
Got a little embarrassment here.

In an earlier post I wrote something incorrect, as follows:
   # even more
   # for those times when the grid default form isn't sufficient
   form = SQLFORM(db.sometable, .)
   if form.accepts(...) #old method, I know
  yada
  yada
   return dict(form=form)

grid returns a div with the SQLFORM as the second element.  Therefore
the code should be:
if form[1].accepts(...)
  yada
  blah

Sorry if I misled anyone.
On Nov 10, 10:52 am, Richard Vézina 
wrote:
> Hello Anthony,
>
> Are they flowing by the function where the SQLFORM.grid is calling or do I
> have to modify the grid class into sqlhtml.py?
>
> I naively try this that didn't work :
>
> def test_sqlformgrid():
>     table = SQLFORM.grid(db.TABLE, ui='jquery-ui',
> editable=auth.has_membership('reviewer'),
> deletable=auth.has_membership('reviewer'), formstyle = 'divs')
>     for i in range(0,len(form.create_form[0])):
>         if len(form[0][i][2][0]) > 0:
>             form[0][i][0].append(SPAN((helpicon(),
> SPAN(form[0][i][2][0])),_class='tooltip'))
>         del(form[0][i][2])
>     return dict(table=table)
>
> Thanks
>
> Richard
>
>
>
>
>
>
>
> On Thu, Nov 10, 2011 at 9:47 AM, Anthony  wrote:
> > On Wednesday, November 9, 2011 5:11:40 PM UTC-5, Richard wrote:
>
> >> Now I would like to know how I can intercept the html form before it get
> >> in the face of the user... I mean I use to do this hack to show user help
> >> bubble to the user :
>
> >> form = crud.create(db[request.args(0)**])
> >> for i in range(0,len(form[0])):
> >>                 if len(form[0][i][2][0]) > 0:
> >>                     form[0][i][0].append(SPAN((**helpicon(),
> >> SPAN(form[0][i][2][0])),_**class='tooltip'))
> >>                 del(form[0][i][2])
>
> >> So I would do the same with create, update form generated by SQLFORM.grid
>
> > In the create/update case, grid returns a div with the form as the second
> > component, and it looks like the form is also accessible via
> > form.create_form and form.edit_form, so I assume you should be able to use
> > some variation of the above to manipulate the form before returning it to
> > the view.
>
> > Anthony


Re: [web2py] Re: SQLFORM.grid : formstyle, readable and writable control

2011-11-10 Thread Anthony
On Thursday, November 10, 2011 12:25:09 PM UTC-5, Anthony wrote:
>
>
> When you first call this function, there will be no form.create_form 
> because it's just generating the grid. When you click on the "Add" button, 
> it should call this same function, but with "new" as one of the URL args. 
> So, I guess you'd have to add an "if 'new' in request.args:" condition.
>

Actually:

if form.create_form:

should work as well. 


Re: [web2py] Re: SQLFORM.grid : formstyle, readable and writable control

2011-11-10 Thread Anthony
On Thursday, November 10, 2011 10:52:42 AM UTC-5, Richard wrote:
>
> def test_sqlformgrid():
> table = SQLFORM.grid(db.TABLE, ui='jquery-ui', 
> editable=auth.has_membership('reviewer'), 
> deletable=auth.has_membership('reviewer'), formstyle = 'divs')
> for i in range(0,len(form.create_form[0])):
> if len(form[0][i][2][0]) > 0:
> form[0][i][0].append(SPAN((helpicon(), 
> SPAN(form[0][i][2][0])),_class='tooltip'))
> del(form[0][i][2])
> return dict(table=table)
>

When you first call this function, there will be no form.create_form 
because it's just generating the grid. When you click on the "Add" button, 
it should call this same function, but with "new" as one of the URL args. 
So, I guess you'd have to add an "if 'new' in request.args:" condition.

Anthony 


Re: [web2py] Re: html from text

2011-11-10 Thread Anthony
I don't understand -- where is that ul supposed to go? What field are your 
representing? What is the "default navigator drop box"?

On Thursday, November 10, 2011 12:03:27 PM UTC-5, Richard wrote:
>
> Workin in console :
>
>  
> In [1]: test123 = 'test/test2/test3/'
>
> In [2]: test123
> Out[2]: 'test/test2/test3/'
>
> In [3]: for v in test123.split('/'):
>...: if v != '':
>...: v
>...: 
>...: 
> Out[3]: 'test'
> Out[3]: 'test2'
> Out[3]: 'test3'
>
> In [4]: XML(UL(*[ LI(v) for v in test123.split('/') if v != '' ]))
> Out[4]: 
>
> In [5]: print XML(UL(*[ LI(v) for v in test123.split('/') if v != '' ]))
> testtest2test3
>
> But in generated view I only get the default option no ul or li...
>
> Thanks
>
> Richard
>
> On Thu, Nov 10, 2011 at 12:01 PM, Richard Vézina wrote:
>
>> Hello Anthony,
>>
>> I am trying to do something bizzard... I would like to have your advice 
>> if it's even possible :
>>
>> represent=lambda value, row: (value!=None and XML(UL(*[ LI(v) for v in 
>> value.split('/') if v != '' ]))) or 'None'
>>
>> I would like the default navigator drop box to display html stuff is this 
>> possible?
>>
>> Thanks
>>
>> Richard
>>
>>
>> On Thu, Nov 10, 2011 at 8:07 AM, Anthony  wrote:
>>
>>> On Thursday, November 10, 2011 7:58:57 AM UTC-5, peter wrote:

 I have a couple of problems with 'text' fields in databases. I want to 
 be able to use a WYSIWIG editor, so I have set up ckeditor using the 
 instructions here 

 http://www.web2pyslices.com/**slices/take_slice/18
  

 This works fine, but there is no toolbar appearing with the editor. 
 How does one get the basic toolbar to appear?

>>>
>>> You have to set the CKEditor options -- see it's documentation: 
>>> http://ckeditor.com/
>>>  
>>>

 If I succeed in getting this working and can embolden text etc. How do 
 I convert the text to html that reflects this emboldening?

>>>
>>> You won't be converting text to HTML -- CKEditor itself generates HTML, 
>>> which is what will get saved in the associated text field in the DB. The 
>>> trick is how to get the HTML to display properly when you pull it from the 
>>> DB and include it in the view. By default, web2py will escape the HTML, so 
>>> it won't display as intended. To avoid that, use the XML() helper -- in the 
>>> view, {{=XML(your_html_content)}}. Though this is dangerous if you are 
>>> allowing users to enter the HTML because they can insert malicious 
>>> Javascript. In that case, use {{=XML(your_html_content, sanitize=True)}}, 
>>> though that will limit the allowed HTML tags and attributes. See 
>>> http://web2py.com/book/default/chapter/05#XML.
>>>
>>> Anthony
>>>
>>
>>
>

Re: [web2py] Re: Online Book Typo

2011-11-10 Thread mikech
So can we assume that the typos we see there now, have not been reported?

[web2py] SQLFORM.smartgrid - multiple problems with latest trunk

2011-11-10 Thread Jim Steil

Hi

I've been using SQLFORM.smartgrid for some time now.  I updated to the 
latest trunk this morning and am now having a number of different issues 
with code unchanged from yesterday.


Are there changes pending and I should hold off reporting problems, or 
should I start going through them?


-Jim


[web2py] Re: excessive memory usage on webfaction

2011-11-10 Thread BrendanC
I had the same  problem with webfaction - be sure to set your static files 
to be delivered by ngenix or apache.
I followed the info in the link above and it reduced my memory usage 
However I have both a Django and a Web2py instance set up on my account and 
Web2py takes more memory for my a small  test app  (maybe a need a few more 
tweaks as I'd expect Web2py to be smaller).

One other gotcha to watch out for - on webfaction (and possibly other 
hosting services) your app must be defined at the root of your domain. I 
wasted a day trying to configure my app as a subdomain. (iow - 
myacct.webfaction.com/myweb2pyapp works; 
myacct.webfaction.com/mywepapps/myweb2pyapp *WILL NOT WORK*. 

This is mentioned in the install script that webfaction provides for 
installing web2py, but I missed it. So read it carefully. Webfaction 
support also missed this when I spent a futile day trying to get it to work.

Hope this helps,
BrendanC


Re: [web2py] Re: html from text

2011-11-10 Thread Richard Vézina
Hello Anthony,

I am trying to do something bizzard... I would like to have your advice if
it's even possible :

represent=lambda value, row: (value!=None and XML(UL(*[ LI(v) for v in
value.split('/') if v != '' ]))) or 'None'

I would like the default navigator drop box to display html stuff is this
possible?

Thanks

Richard

On Thu, Nov 10, 2011 at 8:07 AM, Anthony  wrote:

> On Thursday, November 10, 2011 7:58:57 AM UTC-5, peter wrote:
>>
>> I have a couple of problems with 'text' fields in databases. I want to
>> be able to use a WYSIWIG editor, so I have set up ckeditor using the
>> instructions here
>>
>> http://www.web2pyslices.com/**slices/take_slice/18
>>
>> This works fine, but there is no toolbar appearing with the editor.
>> How does one get the basic toolbar to appear?
>>
>
> You have to set the CKEditor options -- see it's documentation:
> http://ckeditor.com/
>
>
>>
>> If I succeed in getting this working and can embolden text etc. How do
>> I convert the text to html that reflects this emboldening?
>>
>
> You won't be converting text to HTML -- CKEditor itself generates HTML,
> which is what will get saved in the associated text field in the DB. The
> trick is how to get the HTML to display properly when you pull it from the
> DB and include it in the view. By default, web2py will escape the HTML, so
> it won't display as intended. To avoid that, use the XML() helper -- in the
> view, {{=XML(your_html_content)}}. Though this is dangerous if you are
> allowing users to enter the HTML because they can insert malicious
> Javascript. In that case, use {{=XML(your_html_content, sanitize=True)}},
> though that will limit the allowed HTML tags and attributes. See
> http://web2py.com/book/default/chapter/05#XML.
>
> Anthony
>


Re: [web2py] Re: html from text

2011-11-10 Thread Richard Vézina
Workin in console :


In [1]: test123 = 'test/test2/test3/'

In [2]: test123
Out[2]: 'test/test2/test3/'

In [3]: for v in test123.split('/'):
   ...: if v != '':
   ...: v
   ...:
   ...:
Out[3]: 'test'
Out[3]: 'test2'
Out[3]: 'test3'

In [4]: XML(UL(*[ LI(v) for v in test123.split('/') if v != '' ]))
Out[4]: 

In [5]: print XML(UL(*[ LI(v) for v in test123.split('/') if v != '' ]))
testtest2test3

But in generated view I only get the default option no ul or li...

Thanks

Richard

On Thu, Nov 10, 2011 at 12:01 PM, Richard Vézina <
ml.richard.vez...@gmail.com> wrote:

> Hello Anthony,
>
> I am trying to do something bizzard... I would like to have your advice if
> it's even possible :
>
> represent=lambda value, row: (value!=None and XML(UL(*[ LI(v) for v in
> value.split('/') if v != '' ]))) or 'None'
>
> I would like the default navigator drop box to display html stuff is this
> possible?
>
> Thanks
>
> Richard
>
>
> On Thu, Nov 10, 2011 at 8:07 AM, Anthony  wrote:
>
>> On Thursday, November 10, 2011 7:58:57 AM UTC-5, peter wrote:
>>>
>>> I have a couple of problems with 'text' fields in databases. I want to
>>> be able to use a WYSIWIG editor, so I have set up ckeditor using the
>>> instructions here
>>>
>>> http://www.web2pyslices.com/**slices/take_slice/18
>>>
>>> This works fine, but there is no toolbar appearing with the editor.
>>> How does one get the basic toolbar to appear?
>>>
>>
>> You have to set the CKEditor options -- see it's documentation:
>> http://ckeditor.com/
>>
>>
>>>
>>> If I succeed in getting this working and can embolden text etc. How do
>>> I convert the text to html that reflects this emboldening?
>>>
>>
>> You won't be converting text to HTML -- CKEditor itself generates HTML,
>> which is what will get saved in the associated text field in the DB. The
>> trick is how to get the HTML to display properly when you pull it from the
>> DB and include it in the view. By default, web2py will escape the HTML, so
>> it won't display as intended. To avoid that, use the XML() helper -- in the
>> view, {{=XML(your_html_content)}}. Though this is dangerous if you are
>> allowing users to enter the HTML because they can insert malicious
>> Javascript. In that case, use {{=XML(your_html_content, sanitize=True)}},
>> though that will limit the allowed HTML tags and attributes. See
>> http://web2py.com/book/default/chapter/05#XML.
>>
>> Anthony
>>
>
>


[web2py] Re: excessive memory usage on webfaction

2011-11-10 Thread annet
Hi Richard,

This thread: 
http://groups.google.com/group/web2py/browse_thread/thread/ce28ccceb29a459/e2d7471f2894b177

... provide two solutions to reduce memory usage.


Kind regards,

Annet.


[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 but not 100% sure).


[web2py] SQLFORM.smartgrid | linked_tables with

2011-11-10 Thread olivier
Hi here!

I am experimenting with the smartgrid. Very nice time-saving feature
which reminds me why I love web2py! ;-)
(I believe there is still no doc about grid and/or smartgrid?)

I have a problem with linked_tables.

The model looks like this:

db.define_table('person',Field('name'))
db.define_table('relationship',
   Field('personA', db.person),
   Field('relationship_type'),
   Field('personB', db.person)
)

When I use
g = QLFORM.smartgrid(db.person, linked_table=['relationship'])
the action buttons generated include a 'relationship' button twice...
(which makes sense)

Can I avoid this replication? (I am only interested in showing the
existence of a relationship)
Is it possible to have a merge of those two button which will access
all relationships for that person, regardless of the fact it is a
personA or personB in that relationship?

I believe I can go with a custom link here, but I was wondering if
there was a quicker way to achieve this.

I can wait for the 4th version of the book... I had to leave
developing with web2py for a few months and I can no more catch up
with all the amazing new features!  ;-)

Many thanks,

  Olivier







[web2py] Re: The -f command line switch seems to break custom_import

2011-11-10 Thread pgergo
Fix, in case anyone interested:

--- a/custom_import.py  2011-10-01 12:03:20.0 +0200
+++ b/custom_import.py 2011-11-10 16:22:29.466847323 +0100
@@ -11,7 +11,7 @@
 def custom_import_install(web2py_path):
 global _web2py_importer
 global _web2py_path
-if _web2py_importer:
+if _web2py_path == web2py_path:
 return  # Already installed
 _web2py_path = web2py_path
 _web2py_importer = _Web2pyImporter(web2py_path)
--- a/main.py   2011-10-01 12:03:20.0 +0200
+++ b/main.py  2011-11-10 16:22:06.963343076 +0100
@@ -751,6 +751,7 @@
 global_settings.applications_parent = path
 os.chdir(path)
 [add_path_first(p) for p in (path, abspath('site-
packages'), "")]
+custom_import_install(web2py_path)

 save_password(password, port)
 self.pid_filename = pid_filename


Re: [web2py] Offline Access to web2py manual?

2011-11-10 Thread ~redShadow~
On Thu, 2011-11-10 at 04:03 -0800, Anthony wrote:
> On Thursday, November 10, 2011 6:58:44 AM UTC-5, Samuele Santi wrote:
> Why are always the more useful things undocumented??
> 
> This is not any kind of official web2py method -- it's a general
> method available in Linux for copying the content of websites (and
> there are other methods). We can't document every conceivable topic
> about programming and the internet. ;-)

Sure, I was complaining for lack of *wget* documentation, not web2py :)
(although yeah, maybe I should email wget authors about that..)

-- 
Samuele ~redShadow~ Santi

 redshadow[at]hackzine.org - redshadowhack[at]gmail.com

  Blog: http://hackzine.org

  GPG Key signature:
   050D 3E9F 6E0B 44CE C008 D1FC 166C 3C7E EB26 4933

/me recommends:
Squadra Informatica - http://www.squadrainformatica.com

 - Proud ThinkPad T-Series owner
 - Registered Linux-User: #440008
  * GENTOO User since 1199142000 (2008-01-01)
  * former DEBIAN SID user

  "Software is like sex: it's better when it's free!"
  -- Linus Torvalds



signature.asc
Description: This is a digitally signed message part


Re: [web2py] SQLFORM.grid - columns arg is gone

2011-11-10 Thread Jim Steil

Here is the change I made in my code to accommodate:

Old code:

columns=['assetType.name']

New code:

fields=[db.assetType.name]

Other than that, seems like they work the same.  Can anyone provide a 
deeper explanation of the differences?


-Jim


On 11/10/2011 9:17 AM, Jim Steil wrote:

Hi

I just updated my web2py from trunk today and noticed that the columns 
arg in SQLFORM.grid is gone.  I was using it to specify which fields 
to display in my grid.  Can the 'fields' arg be used the same as columns?


-Jim



[web2py] Re: html from text

2011-11-10 Thread Anthony
I did it like this (using the jQuery adapter to start CKEditor):


$(function() {
var toolbar = [
{ name: 'document',items : [ 'Source' ] },
{ name: 'clipboard',   items : [ 
'Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo' ] },
{ name: 'links',   items : [ 'Link','Unlink','Anchor' ] },
{ name: 'insert',  items : [ 
'Image','Flash','Table','HorizontalRule','Smiley','SpecialChar' ] },
{ name: 'editing', items : [ 
'Find','Replace','-','SelectAll','-','SpellChecker', 'Scayt' ] },
{ name: 'tools',   items : [ 'Maximize', 
'ShowBlocks','-','About' ] },
'/',
{ name: 'styles',  items : [ 'Format','FontSize' ] },
{ name: 'colors',  items : [ 'TextColor' ] },
{ name: 'basicstyles', items : [ 
'Bold','Italic','Underline','Strike','Subscript','Superscript','-','RemoveFormat'
 
] },
{ name: 'paragraph',   items : [ 
'NumberedList','BulletedList','-','Outdent','Indent','-','Blockquote','CreateDiv','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','BidiLtr','BidiRtl'
 
] }
];

$('textarea').ckeditor(function(e) {},
{
toolbar : toolbar,
}
);
});


Anthony


Re: [web2py] Re: SQLFORM.grid : formstyle, readable and writable control

2011-11-10 Thread Richard Vézina
Hello Anthony,

Are they flowing by the function where the SQLFORM.grid is calling or do I
have to modify the grid class into sqlhtml.py?

I naively try this that didn't work :

def test_sqlformgrid():
table = SQLFORM.grid(db.TABLE, ui='jquery-ui',
editable=auth.has_membership('reviewer'),
deletable=auth.has_membership('reviewer'), formstyle = 'divs')
for i in range(0,len(form.create_form[0])):
if len(form[0][i][2][0]) > 0:
form[0][i][0].append(SPAN((helpicon(),
SPAN(form[0][i][2][0])),_class='tooltip'))
del(form[0][i][2])
return dict(table=table)

Thanks

Richard

On Thu, Nov 10, 2011 at 9:47 AM, Anthony  wrote:

> On Wednesday, November 9, 2011 5:11:40 PM UTC-5, Richard wrote:
>>
>>
>> Now I would like to know how I can intercept the html form before it get
>> in the face of the user... I mean I use to do this hack to show user help
>> bubble to the user :
>>
>>
>> form = crud.create(db[request.args(0)**])
>> for i in range(0,len(form[0])):
>> if len(form[0][i][2][0]) > 0:
>> form[0][i][0].append(SPAN((**helpicon(),
>> SPAN(form[0][i][2][0])),_**class='tooltip'))
>> del(form[0][i][2])
>>
>> So I would do the same with create, update form generated by SQLFORM.grid
>>
>
> In the create/update case, grid returns a div with the form as the second
> component, and it looks like the form is also accessible via
> form.create_form and form.edit_form, so I assume you should be able to use
> some variation of the above to manipulate the form before returning it to
> the view.
>
> Anthony
>
>


[web2py] Re: SQLFORM.grid - columns arg is gone

2011-11-10 Thread Cliff
It does not work that way in 1.99.2.

On Nov 10, 10:17 am, Jim Steil  wrote:
> Hi
>
> I just updated my web2py from trunk today and noticed that the columns
> arg in SQLFORM.grid is gone.  I was using it to specify which fields to
> display in my grid.  Can the 'fields' arg be used the same as columns?
>
>      -Jim


[web2py] Re: SQLFORM.grid - columns arg is gone

2011-11-10 Thread Anthony
On Thursday, November 10, 2011 10:17:20 AM UTC-5, Jim S wrote:
>
> Can the 'fields' arg be used the same as columns?
>
Based on the comments in the new code, looks like that is the intention. 


[web2py] Re: html from text

2011-11-10 Thread peter
I am a bit bemused, surely the reason for using ckeditor is to have
wysiwyg editing. Yet I have tried both the slices version and the the
plugin of ckeditor and they both just seem to allow editing but with
no toolbar for emboldening etc. I woudl have thought the defualt ought
to include this.

I have tried

putting
CKEDITOR.editorConfig = function( config )
{
config.toolbar='Basic';
};
in config.js

using the documentation from http://ckeditor.com/

but his does not do it. Is there anyone there who has got the toolbar
to appear, and if so how did you do it.
Thanks

Peter

On Nov 10, 2:48 pm, peter  wrote:
> thanks


[web2py] SQLFORM.grid - columns arg is gone

2011-11-10 Thread Jim Steil

Hi

I just updated my web2py from trunk today and noticed that the columns 
arg in SQLFORM.grid is gone.  I was using it to specify which fields to 
display in my grid.  Can the 'fields' arg be used the same as columns?


-Jim



[web2py] Re: new welcome app - need help with css

2011-11-10 Thread Paolo Caruccio
Other css rules are related to the specific case and override the general 
css rules applied to web2py_grid.
But I'm agreed with you: the best solution is to give a class or an id to 
the container div.

Paolo


Re: [web2py] Re: Apostrophe error in the database

2011-11-10 Thread eric tchonfene
This the result I get when I call the function
this the xml that I get back my apostrophe is changed to '
Lady'sRoom

On Thu, Nov 10, 2011 at 8:31 AM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> There are two warnings in this page:
> http://www.pythonsecurity.org/wiki/web2py/?version=22001
>
> They have bot been addressed one year ago. They have been addressed by
> quoting the string.
>
> This is the expected bahviour. What problems does it cause you?
>
> Massimo
>
> On Nov 9, 6:55 pm, africanacloud  wrote:
> > I am new to web2py and I have a problem  understanding why all my
> > apostrophes are replaced by '.
> >
> > here is my table:
> > db.define_table('rooms',
> > Field('Name'),
> >
> >
> Field('created_on','datetime',default=request.now,writable=False,readable=F
> alse))
> >
> > below is my function:
> >
> > @service.xml
> > def rooms():
> > ROOMS = db(db.rooms).select()
> > return ROOMS
> >
> > this is the result is.
> > Lady'sRoom
> > Any of you know what is going on here?
>


[web2py] Re: changing default redirect after failed login attempt.

2011-11-10 Thread Christopher Steel
Ah ha!

This works like a charm, makes sense

auth.settings.controller = 'plugin_user_admin'




[web2py] Re: html from text

2011-11-10 Thread peter
thanks


Re: [web2py] Re: SQLFORM.grid : formstyle, readable and writable control

2011-11-10 Thread Anthony
On Wednesday, November 9, 2011 5:11:40 PM UTC-5, Richard wrote:
>
>
> Now I would like to know how I can intercept the html form before it get 
> in the face of the user... I mean I use to do this hack to show user help 
> bubble to the user :
>
>
> form = crud.create(db[request.args(0)])
> for i in range(0,len(form[0])):
> if len(form[0][i][2][0]) > 0:
> form[0][i][0].append(SPAN((helpicon(), 
> SPAN(form[0][i][2][0])),_class='tooltip'))
> del(form[0][i][2])
>
> So I would do the same with create, update form generated by SQLFORM.grid
>

In the create/update case, grid returns a div with the form as the second 
component, and it looks like the form is also accessible via 
form.create_form and form.edit_form, so I assume you should be able to use 
some variation of the above to manipulate the form before returning it to 
the view.

Anthony
 


  1   2   >