[web2py] newline character in text & string fields on GAE

92 views
Skip to first unread message

G. Clifford Williams

unread,
Apr 23, 2010, 9:24:24 PM4/23/10
to web...@googlegroups.com
according to http://code.google.com/appengine/docs/python/gettingstarted/usingdatastore.html we need to use multiline=True to get strings to behave with newline chars on GAE. Is there a prescribed mechanism by which we accomplish this in web2py?

--
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en

mdipierro

unread,
Apr 23, 2010, 10:20:28 PM4/23/10
to web2py-users
Should be the default behavior? Probably yes.

Meanwhile you can use Field(type='text')

On Apr 23, 8:24 pm, "G. Clifford Williams" <g...@notadiscussion.com>
wrote:
> according tohttp://code.google.com/appengine/docs/python/gettingstarted/usingdata...we need to use multiline=True to get strings to behave with newline chars on GAE. Is there a prescribed mechanism by which we accomplish this in web2py?

G. Clifford Williams

unread,
Apr 27, 2010, 12:35:36 AM4/27/10
to web...@googlegroups.com
Had:
Field('content', 'text', length=1500, requires=IS_NOT_EMPTY(),
label='Gripe'),
and then tried:
Field('content', length=1500, requires=IS_NOT_EMPTY(),
label='Gripe', type='text'),


in both cases I get no 'new line' characters.

(running 1.76.5)

mdipierro

unread,
Apr 27, 2010, 2:18:53 AM4/27/10
to web2py-users
What do you mean exactly "you get no new line"?

1) you cannot insert strings containing new lines
2) the new lines disapper when you extract the data (get replaced by
something else?)
3) you do not see the newline when you display the field values (are
you sure this is not an escaping issue '\n' vs '<br/>'?)

does it behave differently on GAE vs non-GAE?

Massimo

On Apr 26, 11:35 pm, "G. Clifford Williams" <g...@notadiscussion.com>
wrote:
> Had:
>    Field('content', 'text',  length=1500, requires=IS_NOT_EMPTY(),
>            label='Gripe'),
> and then tried:
>    Field('content', length=1500, requires=IS_NOT_EMPTY(),
>            label='Gripe', type='text'),
>
> in both cases I get no 'new line' characters.
>
> (running 1.76.5)
>
> On Apr 23, 2010, at 9:20 PM, mdipierro wrote:
>
> > Should be the default behavior? Probably yes.
>
> > Meanwhile you can use Field(type='text')
>
> > On Apr 23, 8:24 pm, "G. Clifford Williams" <g...@notadiscussion.com>
> > wrote:
> >> according tohttp://code.google.com/appengine/docs/python/gettingstarted/usingdata...need to use multiline=True to get strings to behave with newline chars on GAE. Is there a prescribed mechanism by which we accomplish this in web2py?

G. Clifford Williams

unread,
Apr 28, 2010, 9:26:38 AM4/28/10
to web...@googlegroups.com
Well what I HAD meant was that on GAE wherever I'd supplied a newline char as input I'd see an odd encoding in the storage file. When I queried the database I didn't see the newline in the response. Now I realize how silly I was. When I run the same code against sqlite I see the literal newline chars and that created an errant presumption. My apologies for the false alarm.

mdipierro

unread,
Apr 28, 2010, 10:09:04 AM4/28/10
to web2py-users
No apologies. Thanks for checking and reporting.

On Apr 28, 8:26 am, "G. Clifford Williams" <g...@notadiscussion.com>
> >>>> according tohttp://code.google.com/appengine/docs/python/gettingstarted/usingdata...to use multiline=True to get strings to behave with newline chars on GAE. Is there a prescribed mechanism by which we accomplish this in web2py?
Reply all
Reply to author
Forward
0 new messages