[web2py:20004] Re: Some doubts

2009-04-19 Thread Fran

On Apr 19, 7:19 am, mdipierro  wrote:
> > 3) To a form created with SQLFORM I want to add a new field, not
> > belonging to the table. It is a necessary field to validate, similar
> > to use captchas, but with text.
> > Is it possible to do what I need?
> if form is your form...
> form[0] is the ...
> so you can do
> form[0].append(TR('label',INPUT
> (_name='youvarname',requires=IS_NOT_EMPTY()),''))
> To insert the field in the form. Or you just use a custom field.

Lovely :)

No way to do the same with adding an extra column to a SQLTABLE, is
there? ;)
SQLTABLE doesn't even have a 'col3' (comment) to play with...

F
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:20005] Re: URL structure for multilanguage site

2009-04-19 Thread jiri

Thanks, routes_in fragment seems to be what I was looking for. Session
variable for remembering last selected language - I like that, I am
going to include that also.

I am not sure about handling language purely using sessions in
general. It could be  worthful if you have an app like webmail for
example and you want to translate it. But in case of site with content
in multiple languages I believe that right way is to have pages
(content) in different languages to have different URLs. How can
search engine handle different language version of page/article if
language is handled using sessions(and browser language setting)
only?

Jiri

On 18 Dub, 17:41, mdipierro  wrote:
> Personally I do not user routes much and I like to do
>
> if request.vars.force_language: session.force_language
> if session.force_language: T.force(force_language)
>
> and have button in the 'index' page that reload the index page in
> various languages
>
> French
>
> Because of the session var, web2py will remember my preferred
> language.
>
> Massimo
>
> On Apr 18, 10:35 am, mdipierro  wrote:
>
>
>
> > routes_in = (
> > ('/yourapp/static/(?P.*)','/yourapp/static/$any'),
> > ('/yourapp/$language/(?P.*)','/yourapp/default/$any?_language=
> > $language'),
> > )
>
> > and in your model
>
> > if request.vars._language: T.force(request.vars._language)
>
> > Massimo
>
> > On Apr 18, 9:49 am, Iceberg  wrote:
>
> > > By the way, I believe the T("...") handles short phrase better, but if
> > > you need to deal with some long article such as company background
> > > description, it will also be a good choice to manually organize your
> > > file as:
> > >   yourapp/static/en/about.html
> > >   yourapp/static/de/about.html
> > >   ...
>
> > > On Apr18, 10:09pm, Jason Brower  wrote:
>
> > > > It's my understanding the web2py takes care of all the multi language
> > > > stuff automatically, no need to set it in the browser.
> > > > Just set the language file and make sure to put a T("") Around ya
> > > > strings.
> > > > br-
> > > > Jason Brower
>
> > > > On Sat, 2009-04-18 at 04:14 -0700, jiri wrote:
> > > > > Hello,
>
> > > > > I am new to web2py and I am working on multi-language site using this
> > > > > framework. What is the best way to structure URLs for such site?
> > > > > Previously I used this scheme (see below) in Pylons framework, it was
> > > > > mapped using routing module to "lang" parameter and then correct
> > > > > language was set up just before selected controller function (by URL)
> > > > > was called. What I need to do to use this scheme in web2py or what is
> > > > > the recommended way to do this?
>
> > > > > /en/about/
> > > > > /en/products/
> > > > > ...
> > > > > /de/about/
> > > > > /de/products/
> > > > > ...
> > > > > /es/about/
> > > > > /es/products/
> > > > > ...
>
> > > > > Jiri
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:20006] Question on request.vars

2009-04-19 Thread Joseph Jude

Hi all,
I have a function as below. This is called as part of API function
rather than from the browser.

def assign():
print request.vars.fields
if request.vars.fields:
case_values=json.loads(request.vars.fields)
ret_dict=api.assign_case(db,case_values)
else:
ret_dict={'id': 1, 'msg': 'No parameters received'}
return json.dumps(ret_dict)


When I invoke this via,
curl -u u...@example.com:web2py http://localhost:8000/init/api/assign/
-d fields='{"id":16,"assign_to":"age...@example.com"}'

I do get request.vars.fields properly and the function executes as
desired. However when I try the same via a python script like the
below:

data = {
'fields': {'case_id': 16, 'assign_to': 'age...@example.com'}
}

data = urllib.urlencode(data)
response = urllib2.urlopen(request,data).read()


There is no input parameter (fields). When I examine the
request.vars.fields, it shows like the below:



There are \r\n at the begining and % at the end. Is there a reason for
this? How can I test my function using python script (ie achieve the
same result as curl).

Hope my question is not too confusing.

Thank you,
Joseph
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:20007] Re: Request for more organize feature request lists...

2009-04-19 Thread Jason Brower

I guess I see the checking-for-valid-bug phase a step that others can do
to help lift some of the load off of members that can code.  But your
right, there is a lot of garbage reports out there.
I just wish there was a way, that when I have the time, I can sit down
and start to sift through reports and start solving them all from one
place.  I can see a list of bugs and even sort them to my liking.  Pick
out the ones I think I can help fix and proceed from there.
At some point I think we should consider moving bugs to an area that can
be better delegated.  But for now, as you know, this project has been
doing a great job helping fix issues in the system.
Thanks,
Jason Brower


On Sun, 2009-04-19 at 01:12 -0500, Yarko Tymciurak wrote:
> You are right, Jason...
> 
> 
> But still, I think putting a bug in the group list first serves a
> purpose:  it validates that others can reproduce
> 
> 
> When that happens (or when you get no response) then this serves as a
> useful pre-requisite before putting in a bug tracker.
> 
> 
> I have spend many a weekend removing bugs from issue trackers which
> did not have enough information to reproduce (that is - someone was
> convinced they found a bug, and maybe they did - but it was useless
> because others could not easily produce the problem).
> 
> 
> It makes sense to validate that you have a problem with the community
> before reporting it as a tracked problem, don't you agree?
> 
> 
> Regards,
> - Yarko
> 
> On Sat, Apr 18, 2009 at 11:05 PM, Jason Brower 
> wrote:
> 
> There are many times I report a bug or feature, in other
> projects, and
> the main developers are working too hard on other parts of the
> project.
> (Openoffice is just not working on a feature I requested 3
> years ago.)
> The biggest reason I see a tracker as useful is because I want
> to
> contribute.  I can see a list of bugs, and can contribute by
> helping
> triage and report on them.  I can report a bug and see when it
> really is
> fixed, or when it needs to be tested.  It's so much more
> organized, and
> most OSS contributers don't sign up for the emailing list of
> all
> software they have bugs in and use, they report the bugs, as
> they have
> to pick and choose the projects they can fully contribute to.
>  Many
> people have to focus on using the product so much they must
> have a quick
> way to contribute the bug report or they simple can't do it at
> all.
> To me, this is part of the maturing OSS project.
> ---
> Jason Brower
> 
> 
> 
> On Sat, 2009-04-18 at 17:42 -0500, Yarko Tymciurak wrote:
> > :-)   I can "reproduce" this!
> >
> >
> > "[revert] to previour page"  !!! :-)
> >
> >
> > Can you supply a patch?  (just kidding - if Massimo doesn't
> fix this
> > this weekend, would you post to
> >
> >
> > AND, ALL:  PLEASE NOTE CORRECTION TO BUGS LINK:
> >
> >
> > https://bugs.launchpad.net/web2py
> >
> >
> > (The one Fran reported is not used - SVN is just a
> convenience mirror
> > of the launchpad repository;  for now, Launchpad is the
> official
> > repository of web2py)
> >
> >
> > Regards,
> > - Yarko
> >
> > On Sat, Apr 18, 2009 at 5:24 PM, mikech 
> wrote:
> >
> > I would like to report that on the edit page of the
> > administrative
> > interface the word
> > previous is misspelled after the revert button.
> >
> > Mike
> >
> >
> > On Apr 18, 1:10 pm, Fran
>  wrote:
> > > On Apr 18, 4:52 pm, Jason Brower
> 
> > wrote:
> > >
> > > > Can we use launchpad to keep try of bugs and
> feature
> > requests?  I love
> > > > to post ideas that come to my mind, but putting
> to a list
> > with a project
> > > > this large makes the features melt into the
> intertube.
> > >
> > > Issue Tracker is
> > here:http://code.google.com/p/web2py/issues/list
> > >
> > > Although, as Yarko says, this group is different
> from normal
> > in that
> > > issues are better posted to the listed first...
> > >
> > > F
> >
> >
> >
> >
> >
> > >
> 
> 
> 
> 
> 
> 
> 
> > 


--~--~-~--~~~

[web2py:20008] Re: Request for more organize feature request lists...

2009-04-19 Thread Douglas Soares de Andrade

Em Domingo 19 Abril 2009, às 03:23:03, mdipierro escreveu:
> I agree with yarko and for one more reason: The processing of
> accessing lanchpad to close a bug usually takes longer than fixing the
> bug (assuming it is a real bug).
>
> Massimo

I agree with you all and im very happy with the development cycle i see in 
web2py, as it helps us to improve and learn new features just by seeing the 
threads.

I think we can work as we are doing now, and think in something when we cant 
manage to read the list properly - when it reach the python main list traffic 
=).

Btw, you all have been doing a great job, it has been inspiring to see web2py 
envolving with all the talks and discussions without losing what makes it be 
"the" framework for me... its ease of use/learn.

Thanks a lot

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:20009] Re: dataTables and date

2009-04-19 Thread jmvermeer

I am still struggling with the formatting of date, I first tried to
solve the problem the best way, when I didn't get that to work I
thought I'd try the quick fix, unfortunately, resulting in the same
errors.


This works, however, the date is displayed in the format: -mm-dd,
whereas I need dd-mm-.

Validator in model:

db.event.van_datum.requires=IS_DATE('%Y-%m-%d')
db.event.tot_datum.requires=IS_NULL_OR(IS_DATE('%Y-%m-%d'))


web2py_ajax.html:

try {$("input.date").focus( function() {Calendar.setup({
 inputField:this.id, ifFormat:"{{=T('%Y-%m-%d')}}",
showsTime:false
}); }); } catch(e) {};
try { $("input.datetime").focus( function() {Calendar.setup({
 inputField:this.id, ifFormat:"{{=T('%Y-%m-%d %H:%M:%S')}}",
showsTime: true,timeFormat: "24"
}); }); } catch(e) {};
try { $("input.time").clockpick({
 starthour:0, endhour:23, showminutes:true, military:true
}); } catch(e) {};


Function in controller:

def byplace():
response.functionname=T('Event list by place')
response.image=URL(r=request,c='static',f='media/core/banner.png')
form=form_factory(SQLField('plaats',requires=IS_NOT_EMPTY(),\
widget=lambda self, value:INPUT
(_id='eventbyplace',_name='plaats',_class='ac_input',_type='text',requires=self.requires)),
SQLField('datum',type='date',requires=IS_DATE('%Y-%m-%d')),\
SQLField('dagen',requires=IS_IN_SET([7,14,28,56],labels=['1
week','2 weken','4 weken','8 weken'])))
events=[]
if form.accepts(request.vars,session):
response.flash=T('no results')
fromdate=request.vars.datum
todate=IS_DATE()(fromdate)[0]+datetime.timedelta(days=int
(request.vars.dagen))
events=db((db.event.plaats==request.vars.plaats)&
(db.event.van_datum>=fromdate)&\
(db.event.van_datum<=todate)&(db.event.doelgroep=='Consumer')&
(db.event.scope=='Extern'))\
.select
(db.event.id,db.event.event,db.event.van_datum,db.event.locatie,\
db.event.eventtype,orderby=db.event.van_datum)
elif form.errors:
response.flash=T('form has errors')
else:
response.flash=T('please fill the form')
return dict(form=form,events=events)


In the view:


{{=event.van_datum}}




This doesn't work:

Validator in model:

db.event.van_datum.requires=IS_DATE('%d-%m-%Y')
db.event.tot_datum.requires=IS_NULL_OR(IS_DATE('%d-%m-%Y'))


web2py_ajax.html:

try {$("input.date").focus( function() {Calendar.setup({
 inputField:this.id, ifFormat:"{{=T('%d-%m-%Y')}}",
showsTime:false
}); }); } catch(e) {};
try { $("input.datetime").focus( function() {Calendar.setup({
 inputField:this.id, ifFormat:"{{=T('%d-%m-%Y %H:%M:%S')}}",
showsTime: true,timeFormat: "24"
}); }); } catch(e) {};
try { $("input.time").clockpick({
 starthour:0, endhour:23, showminutes:true, military:true
}); } catch(e) {};
On Apr 17, 8:09 am, jmverm...@xs4all.nl wrote:


Function in the controller:
def byplace():
response.functionname=T('Event list by place')
response.image=URL(r=request,c='static',f='media/core/banner.png')
form=form_factory(SQLField('plaats',requires=IS_NOT_EMPTY(),\
widget=lambda self, value:INPUT
(_id='eventbyplace',_name='plaats',_class='ac_input',_type='text',requires=self.requires)),
SQLField('datum',type='date',requires=IS_DATE('%d-%m-%Y')),\
SQLField('dagen',requires=IS_IN_SET([7,14,28,56],labels=['1
week','2 weken','4 weken','8 weken'])))
events=[]
if form.accepts(request.vars,session):
response.flash=T('no results')
fromdate=request.vars.datum
todate=IS_DATE()(fromdate)[0]+datetime.timedelta(days=int
(request.vars.dagen))
events=db((db.event.plaats==request.vars.plaats)&
(db.event.van_datum>=fromdate)&\
(db.event.van_datum<=todate)&(db.event.doelgroep=='Consumer')&
(db.event.scope=='Extern'))\
.select
(db.event.id,db.event.event,db.event.van_datum,db.event.locatie,\
db.event.eventtype,orderby=db.event.van_datum)
elif form.errors:
response.flash=T('form has errors')
else:
response.flash=T('please fill the form')
return dict(form=form,events=events)



Exposing the function results in the following error:

File "/Library/Python/2.5/site-packages/web2pyfitwise/applications/
core/controllers/eventlist.py", line 25, in byplace
todate=IS_DATE()(fromdate)[0]+datetime.timedelta(days=int
(request.vars.dagen))
TypeError: cannot concatenate 'str' and 'datetime.timedelta' objects


When I replace todate=... with:

todate=form.vars.datum+datetime.timedelta(days=int(form.vars.dagen))

and expose the function I get this error:


File "/Library/Python/2.5/site-packages/web2pyfitwise/applications/
core/controllers/eventlist.py", line 29, in byplace
db.event.eventtype,orderby=db.event.van_datum)
  File "/Library/Python/2.5/site-packages/web2pyfitwise/gluon/sql.py",
line 1902, in select
r = response(query)
  File "/Library/Python/2.5/site-packages/web2pyfitwise/gluon/sql.py",
line 1897, in response
self._db._execute(query)
 

[web2py:20010] CRUD not updating

2009-04-19 Thread Tito Garrido
Hi,

I'm using SQLTABLE with linkto=URL(r=request,f='data/update'), but when I
try to update/delete nothing happens...

I'm using web2py 1.61.1

Am I doing something wrong?

Thanks,

Tito


-- 
Linux User #387870
.
 _/_õ|__|
..º[ .-.___.-._| . . . .
.__( o)__( o).:___

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:20011] Re: Request for more organize feature request lists...

2009-04-19 Thread Jason Brower

Alright, being your the one that closes and fixes most of these bugs, I
will leave it to you.  But don't be afraid to assign things to us. :D
Regards,
Jason Brower


On Sun, 2009-04-19 at 08:21 -0300, Douglas Soares de Andrade wrote:
> Em Domingo 19 Abril 2009, às 03:23:03, mdipierro escreveu:
> > I agree with yarko and for one more reason: The processing of
> > accessing lanchpad to close a bug usually takes longer than fixing the
> > bug (assuming it is a real bug).
> >
> > Massimo
> 
> I agree with you all and im very happy with the development cycle i see in 
> web2py, as it helps us to improve and learn new features just by seeing the 
> threads.
> 
> I think we can work as we are doing now, and think in something when we cant 
> manage to read the list properly - when it reach the python main list traffic 
> =).
> 
> Btw, you all have been doing a great job, it has been inspiring to see web2py 
> envolving with all the talks and discussions without losing what makes it be 
> "the" framework for me... its ease of use/learn.
> 
> Thanks a lot
> 
> > 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:20012] GAE from Windows Disto

2009-04-19 Thread Col Wilson

Can someone give me a pointer on where the app.yaml file is on a
windows distro? Any other pointers would also be helpful.

I've tried searching previous posts, but nothing seems to help.

Thanks

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:20013] Re: Some doubts

2009-04-19 Thread Jose



On 19 abr, 03:19, mdipierro  wrote:

> yes
>
> query=db.table.field.belongs(('a','b','c'))
> query=~db.table.field.belongs(('a','b','c'))
> query=db.table.field.belonds(db(query)._select
> (db.othertable.otherfield))

OK. Thanks.

> if form is your form...
> form[0] is the ...
> so you can do
>
> form[0].append(TR('label',INPUT
> (_name='youvarname',requires=IS_NOT_EMPTY()),''))
>
> To insert the field in the form. Or you just use a custom field.

Thanks, it is what wanted. It shows me the new field in the form, but
it happens that the submit does not validate it.

I did this:

form[0].insert(len(form[0])-1,TR('label',INPUT
(_name='youvarname',requires=IS_NOT_EMPTY()),''))


Jose
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:20014] Re: GAE from Windows Disto

2009-04-19 Thread Yarko Tymciurak
I think you need the source version of web2py to prepare to run on app
engine.
See http://mdp.cti.depaul.edu/AlterEgo/default/show/186
(but be careful - it provides links to specific versions which are now out
of date:  see 
http://code.google.com/p/googleappengine/)


On Sun, Apr 19, 2009 at 5:28 AM, Col Wilson  wrote:

>
> Can someone give me a pointer on where the app.yaml file is on a
> windows distro? Any other pointers would also be helpful.
>
> I've tried searching previous posts, but nothing seems to help.
>
> Thanks
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:20015] Re: Can response.flash have different colors?

2009-04-19 Thread mdipierro

BTW... one can also do

response.flash=DIV("this is a message",_class="warn")

and then declare a class "warn" in the CSS.

On Apr 19, 1:29 am, mdipierro  wrote:
> session.flash does only one think in web2py: it gets moved into
> response.flash upon redirect. If you want you can do already
>
> #in model
> from gluon.storage import Storage
> session.flash=Storage()
> response.flash=Storage()
> #in controllers
> #before redirection
> session.flash.warn='oops'
> #or without redirection
> response.flash.warn='oops'
>
> and in your layout you do:
> {{if response.flash.warn:}}{{=response.flash.warn}}
> {{pass}}
> etc.
>
> I do not feel there is anything more that needs to be implemented in
> web2py. It is already very general.
>
> Massimo
>
> On Apr 19, 1:08 am, Yarko Tymciurak  wrote:
>
> > I think flash is different than hardcoded colors of layout in css...
> > These are context-sensitive things, and logical (maybe you are right - in
> > css) definitions seems appropriate.
>
> > On Sat, Apr 18, 2009 at 8:28 PM, Iceberg  wrote:
>
> > > Nice brainstorming. Hope you don't mind I add some more summary.
>
> > > 1. Hopefully we can at least have an agreement about controllers
> > > should have easy way to express info, warn and error. This is about
> > > logic and design.
>
> > > 2. As to how to customize those three message's appearance, this is
> > > about technical implementation. Yarko suggests an approach which
> > > defines some response.warning (actually he means
> > > response.warning_color) in model/0.py, that is fine. But to me, it is
> > > slightly, unnecessarily complicated, it is not KISS enough. Because we
> > > can easily customize the style.css when needed.
>
> > > Hardcoded colors sounds stupid, I know. But after all, all the entire
> > > web2py appearance are hardcoded in style.css, no one complains about
> > > that. That is because, those kind of things are supposed to be in css
> > > level, even hardcode.
>
> > > On Apr19, 3:49am, Yarko Tymciurak  wrote:
> > > > this too sounds good...
> > > > In fact, controller should have some LOGICAL (name as opposed to hard
> > > code)
> > > > representation on level of / kind of "flash", and this is why in my
> > > earlier
> > > > post I took Iceberg's code, and changed to some name (flash.warning,
> > > etc.)
> > > > and commented:  "defined in models/0.py" ---  which structurally may not
> > > be
> > > > the right place - but mearly where things are always known to be read /
> > > > loaded per-request (which is why in pycon registration we put a lot ... 
> > > > a
> > > > LOT of configuration settings in 0.py)..
>
> > > > Ignoring that models is all read as a mere technicality, as this (any
> > > tool
> > > > or common or configuration item) is not at all a model thing, there does
> > > > need to be a place to hold common application variables and settings
> > > if
> > > > not in variables, then in classes that encapsulate the variables and
> > > > statically hold them.
>
> > > > So - I'm now thinking that both Massimo's and Icebergs latest comments
> > > need
> > > > to be merged.
>
> > > > Regards,
> > > > - Yarko
>
> > > > On Sat, Apr 18, 2009 at 10:32 AM, Iceberg  wrote:
>
> > > > > Well, I had similar thoughts as Massimo at the beginning, and that is
> > > > > exactly why I "stop here", and even use hardcode magic color.
>
> > > > > IMHO, a controller should be able to clearly express general info,
> > > > > warning msg, and bad error. Because they are so commonly needed in
> > > > > EVERY web app. If you think you don't need to separate them from each
> > > > > other, you are wrong. I observed users of my app tend to ignore
> > > > > warnings even errors because they just look same in a glance, all are
> > > > > a long sentence of blah in an orange bar. If we change info to be in
> > > > > green, warning in yellow, error in red, that will certainly catch
> > > > > immediate attention.
>
> > > > > As to the colors, I think they are not important in the controller.
> > > > > Actually, from a traditional MVC angle of view, controller should not
> > > > > care about color at all. So I leave them into the View part,
> > > > > developers can change them via css and/or layout.html to customize
> > > > > color, location, animation, background pic, round corner, ...
> > > > > whatever.
>
> > > > > So, please, at least we need a way to show info, warn and error. If
> > > > > you don't like the convention (protocol) I suggested, how about these?
>
> > > > > In controller:
> > > > >  response.info='OK, data is accepted'
> > > > >  response.warn='Input is unusual but anyway data is accepted'
> > > > >  response.error='Something is wrong'
>
> > > > > In layout.html:
> > > > >  {{if response.info:}}
> > > > >    {{=response.info}}
> > > > >  {{pass}}
> > > > >  ... (you get the idea)
>
> > > > > But sure in this way, Massimo need to change more than one file in
> > > > > web2py. But if he agrees to do so, it is definitely better than my
> > > > > original pro

[web2py:20016] Re: URL structure for multilanguage site

2009-04-19 Thread mdipierro

I do not know. This may help:

http://www.seoconsultants.com/meta-tags/language.asp

On Apr 19, 5:03 am, jiri  wrote:
> Thanks, routes_in fragment seems to be what I was looking for. Session
> variable for remembering last selected language - I like that, I am
> going to include that also.
>
> I am not sure about handling language purely using sessions in
> general. It could be  worthful if you have an app like webmail for
> example and you want to translate it. But in case of site with content
> in multiple languages I believe that right way is to have pages
> (content) in different languages to have different URLs. How can
> search engine handle different language version of page/article if
> language is handled using sessions(and browser language setting)
> only?
>
> Jiri
>
> On 18 Dub, 17:41, mdipierro  wrote:
>
> > Personally I do not user routes much and I like to do
>
> > if request.vars.force_language: session.force_language
> > if session.force_language: T.force(force_language)
>
> > and have button in the 'index' page that reload the index page in
> > various languages
>
> > French
>
> > Because of the session var, web2py will remember my preferred
> > language.
>
> > Massimo
>
> > On Apr 18, 10:35 am, mdipierro  wrote:
>
> > > routes_in = (
> > > ('/yourapp/static/(?P.*)','/yourapp/static/$any'),
> > > ('/yourapp/$language/(?P.*)','/yourapp/default/$any?_language=
> > > $language'),
> > > )
>
> > > and in your model
>
> > > if request.vars._language: T.force(request.vars._language)
>
> > > Massimo
>
> > > On Apr 18, 9:49 am, Iceberg  wrote:
>
> > > > By the way, I believe the T("...") handles short phrase better, but if
> > > > you need to deal with some long article such as company background
> > > > description, it will also be a good choice to manually organize your
> > > > file as:
> > > >   yourapp/static/en/about.html
> > > >   yourapp/static/de/about.html
> > > >   ...
>
> > > > On Apr18, 10:09pm, Jason Brower  wrote:
>
> > > > > It's my understanding the web2py takes care of all the multi language
> > > > > stuff automatically, no need to set it in the browser.
> > > > > Just set the language file and make sure to put a T("") Around ya
> > > > > strings.
> > > > > br-
> > > > > Jason Brower
>
> > > > > On Sat, 2009-04-18 at 04:14 -0700, jiri wrote:
> > > > > > Hello,
>
> > > > > > I am new to web2py and I am working on multi-language site using 
> > > > > > this
> > > > > > framework. What is the best way to structure URLs for such site?
> > > > > > Previously I used this scheme (see below) in Pylons framework, it 
> > > > > > was
> > > > > > mapped using routing module to "lang" parameter and then correct
> > > > > > language was set up just before selected controller function (by 
> > > > > > URL)
> > > > > > was called. What I need to do to use this scheme in web2py or what 
> > > > > > is
> > > > > > the recommended way to do this?
>
> > > > > > /en/about/
> > > > > > /en/products/
> > > > > > ...
> > > > > > /de/about/
> > > > > > /de/products/
> > > > > > ...
> > > > > > /es/about/
> > > > > > /es/products/
> > > > > > ...
>
> > > > > > Jiri
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:20017] Re: Can response.flash have different colors?

2009-04-19 Thread Yarko Tymciurak
this seems like a nice approach...  one that separates concerns between
controller and view, and yet leaves things out of web2py, that is all to the
application...
Does it make sense to support this kind of convention by having default
classes in CSS?

On Sun, Apr 19, 2009 at 10:04 AM, mdipierro  wrote:

>
> BTW... one can also do
>
> response.flash=DIV("this is a message",_class="warn")
>
> and then declare a class "warn" in the CSS.
>
> On Apr 19, 1:29 am, mdipierro  wrote:
> > session.flash does only one think in web2py: it gets moved into
> > response.flash upon redirect. If you want you can do already
> >
> > #in model
> > from gluon.storage import Storage
> > session.flash=Storage()
> > response.flash=Storage()
> > #in controllers
> > #before redirection
> > session.flash.warn='oops'
> > #or without redirection
> > response.flash.warn='oops'
> >
> > and in your layout you do:
> > {{if response.flash.warn:}}{{=response.flash.warn}}
> > {{pass}}
> > etc.
> >
> > I do not feel there is anything more that needs to be implemented in
> > web2py. It is already very general.
> >
> > Massimo
> >
> > On Apr 19, 1:08 am, Yarko Tymciurak  wrote:
> >
> > > I think flash is different than hardcoded colors of layout in css...
> > > These are context-sensitive things, and logical (maybe you are right -
> in
> > > css) definitions seems appropriate.
> >
> > > On Sat, Apr 18, 2009 at 8:28 PM, Iceberg  wrote:
> >
> > > > Nice brainstorming. Hope you don't mind I add some more summary.
> >
> > > > 1. Hopefully we can at least have an agreement about controllers
> > > > should have easy way to express info, warn and error. This is about
> > > > logic and design.
> >
> > > > 2. As to how to customize those three message's appearance, this is
> > > > about technical implementation. Yarko suggests an approach which
> > > > defines some response.warning (actually he means
> > > > response.warning_color) in model/0.py, that is fine. But to me, it is
> > > > slightly, unnecessarily complicated, it is not KISS enough. Because
> we
> > > > can easily customize the style.css when needed.
> >
> > > > Hardcoded colors sounds stupid, I know. But after all, all the entire
> > > > web2py appearance are hardcoded in style.css, no one complains about
> > > > that. That is because, those kind of things are supposed to be in css
> > > > level, even hardcode.
> >
> > > > On Apr19, 3:49am, Yarko Tymciurak  wrote:
> > > > > this too sounds good...
> > > > > In fact, controller should have some LOGICAL (name as opposed to
> hard
> > > > code)
> > > > > representation on level of / kind of "flash", and this is why in my
> > > > earlier
> > > > > post I took Iceberg's code, and changed to some name
> (flash.warning,
> > > > etc.)
> > > > > and commented:  "defined in models/0.py" ---  which structurally
> may not
> > > > be
> > > > > the right place - but mearly where things are always known to be
> read /
> > > > > loaded per-request (which is why in pycon registration we put a lot
> ... a
> > > > > LOT of configuration settings in 0.py)..
> >
> > > > > Ignoring that models is all read as a mere technicality, as this
> (any
> > > > tool
> > > > > or common or configuration item) is not at all a model thing, there
> does
> > > > > need to be a place to hold common application variables and
> settings
> > > > if
> > > > > not in variables, then in classes that encapsulate the variables
> and
> > > > > statically hold them.
> >
> > > > > So - I'm now thinking that both Massimo's and Icebergs latest
> comments
> > > > need
> > > > > to be merged.
> >
> > > > > Regards,
> > > > > - Yarko
> >
> > > > > On Sat, Apr 18, 2009 at 10:32 AM, Iceberg 
> wrote:
> >
> > > > > > Well, I had similar thoughts as Massimo at the beginning, and
> that is
> > > > > > exactly why I "stop here", and even use hardcode magic color.
> >
> > > > > > IMHO, a controller should be able to clearly express general
> info,
> > > > > > warning msg, and bad error. Because they are so commonly needed
> in
> > > > > > EVERY web app. If you think you don't need to separate them from
> each
> > > > > > other, you are wrong. I observed users of my app tend to ignore
> > > > > > warnings even errors because they just look same in a glance, all
> are
> > > > > > a long sentence of blah in an orange bar. If we change info to be
> in
> > > > > > green, warning in yellow, error in red, that will certainly catch
> > > > > > immediate attention.
> >
> > > > > > As to the colors, I think they are not important in the
> controller.
> > > > > > Actually, from a traditional MVC angle of view, controller should
> not
> > > > > > care about color at all. So I leave them into the View part,
> > > > > > developers can change them via css and/or layout.html to
> customize
> > > > > > color, location, animation, background pic, round corner, ...
> > > > > > whatever.
> >
> > > > > > So, please, at least we need a way to show info, warn and error.
> If
> > > > > > you don't like the convention (pr

[web2py:20018] Re: Question on request.vars

2009-04-19 Thread mdipierro

The "assign" function expects the request.vars.fields to be in JSON.
This should do it but I have not tried it.

data = {'fields': simplejson.dumps({'case_id': 16, 'assign_to':
'age...@example.com'})}
data = urllib.urlencode(data)
response = urllib2.urlopen(request,data).read()

Massimo

On Apr 19, 5:55 am, Joseph Jude  wrote:
> Hi all,
> I have a function as below. This is called as part of API function
> rather than from the browser.
>
> def assign():
>     print request.vars.fields
>     if request.vars.fields:
>         case_values=json.loads(request.vars.fields)
>         ret_dict=api.assign_case(db,case_values)
>     else:
>         ret_dict={'id': 1, 'msg': 'No parameters received'}
>     return json.dumps(ret_dict)
>
> When I invoke this via,
> curl -u u...@example.com:web2pyhttp://localhost:8000/init/api/assign/
> -d fields='{"id":16,"assign_to":"age...@example.com"}'
>
> I do get request.vars.fields properly and the function executes as
> desired. However when I try the same via a python script like the
> below:
>
> data = {
>                 'fields': {'case_id': 16, 'assign_to': 'age...@example.com'}
>                 }
>
> data = urllib.urlencode(data)
> response = urllib2.urlopen(request,data).read()
>
> There is no input parameter (fields). When I examine the
> request.vars.fields, it shows like the below:
>
>  'age...@example.com'%"}>
>
> There are \r\n at the begining and % at the end. Is there a reason for
> this? How can I test my function using python script (ie achieve the
> same result as curl).
>
> Hope my question is not too confusing.
>
> Thank you,
> Joseph
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:20019] Re: dataTables and date

2009-04-19 Thread mdipierro

I promise I will look into this today.

Massimo

On Apr 19, 7:05 am, jmverm...@xs4all.nl wrote:
> I am still struggling with the formatting of date, I first tried to
> solve the problem the best way, when I didn't get that to work I
> thought I'd try the quick fix, unfortunately, resulting in the same
> errors.
>
> This works, however, the date is displayed in the format: -mm-dd,
> whereas I need dd-mm-.
>
> Validator in model:
>
> db.event.van_datum.requires=IS_DATE('%Y-%m-%d')
> db.event.tot_datum.requires=IS_NULL_OR(IS_DATE('%Y-%m-%d'))
>
> web2py_ajax.html:
>
> try {$("input.date").focus( function() {Calendar.setup({
>      inputField:this.id, ifFormat:"{{=T('%Y-%m-%d')}}",
> showsTime:false}); }); } catch(e) {};
>
> try { $("input.datetime").focus( function() {Calendar.setup({
>      inputField:this.id, ifFormat:"{{=T('%Y-%m-%d %H:%M:%S')}}",
> showsTime: true,timeFormat: "24"}); }); } catch(e) {};
>
> try { $("input.time").clockpick({
>      starthour:0, endhour:23, showminutes:true, military:true
>
> }); } catch(e) {};
>
> Function in controller:
>
> def byplace():
>     response.functionname=T('Event list by place')
>     response.image=URL(r=request,c='static',f='media/core/banner.png')
>     form=form_factory(SQLField('plaats',requires=IS_NOT_EMPTY(),\
>     widget=lambda self, value:INPUT
> (_id='eventbyplace',_name='plaats',_class='ac_input',_type='text',requires=self.requires)),
>     SQLField('datum',type='date',requires=IS_DATE('%Y-%m-%d')),\
>     SQLField('dagen',requires=IS_IN_SET([7,14,28,56],labels=['1
> week','2 weken','4 weken','8 weken'])))
>     events=[]
>     if form.accepts(request.vars,session):
>         response.flash=T('no results')
>         fromdate=request.vars.datum
>         todate=IS_DATE()(fromdate)[0]+datetime.timedelta(days=int
> (request.vars.dagen))
>         events=db((db.event.plaats==request.vars.plaats)&
> (db.event.van_datum>=fromdate)&\
>         (db.event.van_datum<=todate)&(db.event.doelgroep=='Consumer')&
> (db.event.scope=='Extern'))\
>         .select
> (db.event.id,db.event.event,db.event.van_datum,db.event.locatie,\
>         db.event.eventtype,orderby=db.event.van_datum)
>     elif form.errors:
>         response.flash=T('form has errors')
>     else:
>         response.flash=T('please fill the form')
>     return dict(form=form,events=events)
>
> In the view:
>
> 
>     {{=event.van_datum}}
> 
>
> This doesn't work:
>
> Validator in model:
>
> db.event.van_datum.requires=IS_DATE('%d-%m-%Y')
> db.event.tot_datum.requires=IS_NULL_OR(IS_DATE('%d-%m-%Y'))
>
> web2py_ajax.html:
>
> try {$("input.date").focus( function() {Calendar.setup({
>      inputField:this.id, ifFormat:"{{=T('%d-%m-%Y')}}",
> showsTime:false}); }); } catch(e) {};
>
> try { $("input.datetime").focus( function() {Calendar.setup({
>      inputField:this.id, ifFormat:"{{=T('%d-%m-%Y %H:%M:%S')}}",
> showsTime: true,timeFormat: "24"}); }); } catch(e) {};
>
> try { $("input.time").clockpick({
>      starthour:0, endhour:23, showminutes:true, military:true}); } catch(e) 
> {};
>
> On Apr 17, 8:09 am, jmverm...@xs4all.nl wrote:
>
> Function in the controller:
> def byplace():
>     response.functionname=T('Event list by place')
>     response.image=URL(r=request,c='static',f='media/core/banner.png')
>     form=form_factory(SQLField('plaats',requires=IS_NOT_EMPTY(),\
>     widget=lambda self, value:INPUT
> (_id='eventbyplace',_name='plaats',_class='ac_input',_type='text',requires=self.requires)),
>     SQLField('datum',type='date',requires=IS_DATE('%d-%m-%Y')),\
>     SQLField('dagen',requires=IS_IN_SET([7,14,28,56],labels=['1
> week','2 weken','4 weken','8 weken'])))
>     events=[]
>     if form.accepts(request.vars,session):
>         response.flash=T('no results')
>         fromdate=request.vars.datum
>         todate=IS_DATE()(fromdate)[0]+datetime.timedelta(days=int
> (request.vars.dagen))
>         events=db((db.event.plaats==request.vars.plaats)&
> (db.event.van_datum>=fromdate)&\
>         (db.event.van_datum<=todate)&(db.event.doelgroep=='Consumer')&
> (db.event.scope=='Extern'))\
>         .select
> (db.event.id,db.event.event,db.event.van_datum,db.event.locatie,\
>         db.event.eventtype,orderby=db.event.van_datum)
>     elif form.errors:
>         response.flash=T('form has errors')
>     else:
>         response.flash=T('please fill the form')
>     return dict(form=form,events=events)
>
> Exposing the function results in the following error:
>
> File "/Library/Python/2.5/site-packages/web2pyfitwise/applications/
> core/controllers/eventlist.py", line 25, in byplace
>     todate=IS_DATE()(fromdate)[0]+datetime.timedelta(days=int
> (request.vars.dagen))
> TypeError: cannot concatenate 'str' and 'datetime.timedelta' objects
>
> When I replace todate=... with:
>
> todate=form.vars.datum+datetime.timedelta(days=int(form.vars.dagen))
>
> and expose the function I get this error:
>
> File "/Library/Python/2.5/site-packages/web2pyfitwise/applications/
> core/controllers/eve

[web2py:20020] Re: CRUD not updating

2009-04-19 Thread mdipierro

Can you post a piece of code to reproduce it? What is the date on the
version? Is this the stable from the web page or the development
version from the trunk?

Massimo

On Apr 19, 7:06 am, Tito Garrido  wrote:
> Hi,
>
> I'm using SQLTABLE with linkto=URL(r=request,f='data/update'), but when I
> try to update/delete nothing happens...
>
> I'm using web2py 1.61.1
>
> Am I doing something wrong?
>
> Thanks,
>
> Tito
>
> --
> Linux User #387870
> .
>  _/_õ|__|
> ..º[ .-.___.-._| . . . .
> .__( o)__( o).:___
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:20021] Re: Request for more organize feature request lists...

2009-04-19 Thread mdipierro

Thank you for the availability. I have done so some times and I will
do so more in the future.

Massimo

On Apr 19, 8:31 am, Jason Brower  wrote:
> Alright, being your the one that closes and fixes most of these bugs, I
> will leave it to you.  But don't be afraid to assign things to us. :D
> Regards,
> Jason Brower
>
> On Sun, 2009-04-19 at 08:21 -0300, Douglas Soares de Andrade wrote:
>
> > Em Domingo 19 Abril 2009, às 03:23:03, mdipierro escreveu:
> > > I agree with yarko and for one more reason: The processing of
> > > accessing lanchpad to close a bug usually takes longer than fixing the
> > > bug (assuming it is a real bug).
>
> > > Massimo
>
> > I agree with you all and im very happy with the development cycle i see in
> > web2py, as it helps us to improve and learn new features just by seeing the
> > threads.
>
> > I think we can work as we are doing now, and think in something when we cant
> > manage to read the list properly - when it reach the python main list 
> > traffic
> > =).
>
> > Btw, you all have been doing a great job, it has been inspiring to see 
> > web2py
> > envolving with all the talks and discussions without losing what makes it be
> > "the" framework for me... its ease of use/learn.
>
> > Thanks a lot
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:20022] Re: Some doubts

2009-04-19 Thread mdipierro

This may be a bug. Let me look into it.

On Apr 19, 9:45 am, Jose  wrote:
> On 19 abr, 03:19, mdipierro  wrote:
>
> > yes
>
> > query=db.table.field.belongs(('a','b','c'))
> > query=~db.table.field.belongs(('a','b','c'))
> > query=db.table.field.belonds(db(query)._select
> > (db.othertable.otherfield))
>
> OK. Thanks.
>
> > if form is your form...
> > form[0] is the ...
> > so you can do
>
> > form[0].append(TR('label',INPUT
> > (_name='youvarname',requires=IS_NOT_EMPTY()),''))
>
> > To insert the field in the form. Or you just use a custom field.
>
> Thanks, it is what wanted. It shows me the new field in the form, but
> it happens that the submit does not validate it.
>
> I did this:
>
> form[0].insert(len(form[0])-1,TR('label',INPUT
> (_name='youvarname',requires=IS_NOT_EMPTY()),''))
>
> Jose
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:20023] Re: Can response.flash have different colors?

2009-04-19 Thread mdipierro

yes we can do that. I can include a warn, info and error in different
colors.

Massimo

On Apr 19, 10:07 am, Yarko Tymciurak  wrote:
> this seems like a nice approach...  one that separates concerns between
> controller and view, and yet leaves things out of web2py, that is all to the
> application...
> Does it make sense to support this kind of convention by having default
> classes in CSS?
>
> On Sun, Apr 19, 2009 at 10:04 AM, mdipierro  wrote:
>
> > BTW... one can also do
>
> > response.flash=DIV("this is a message",_class="warn")
>
> > and then declare a class "warn" in the CSS.
>
> > On Apr 19, 1:29 am, mdipierro  wrote:
> > > session.flash does only one think in web2py: it gets moved into
> > > response.flash upon redirect. If you want you can do already
>
> > > #in model
> > > from gluon.storage import Storage
> > > session.flash=Storage()
> > > response.flash=Storage()
> > > #in controllers
> > > #before redirection
> > > session.flash.warn='oops'
> > > #or without redirection
> > > response.flash.warn='oops'
>
> > > and in your layout you do:
> > > {{if response.flash.warn:}}{{=response.flash.warn}}
> > > {{pass}}
> > > etc.
>
> > > I do not feel there is anything more that needs to be implemented in
> > > web2py. It is already very general.
>
> > > Massimo
>
> > > On Apr 19, 1:08 am, Yarko Tymciurak  wrote:
>
> > > > I think flash is different than hardcoded colors of layout in css...
> > > > These are context-sensitive things, and logical (maybe you are right -
> > in
> > > > css) definitions seems appropriate.
>
> > > > On Sat, Apr 18, 2009 at 8:28 PM, Iceberg  wrote:
>
> > > > > Nice brainstorming. Hope you don't mind I add some more summary.
>
> > > > > 1. Hopefully we can at least have an agreement about controllers
> > > > > should have easy way to express info, warn and error. This is about
> > > > > logic and design.
>
> > > > > 2. As to how to customize those three message's appearance, this is
> > > > > about technical implementation. Yarko suggests an approach which
> > > > > defines some response.warning (actually he means
> > > > > response.warning_color) in model/0.py, that is fine. But to me, it is
> > > > > slightly, unnecessarily complicated, it is not KISS enough. Because
> > we
> > > > > can easily customize the style.css when needed.
>
> > > > > Hardcoded colors sounds stupid, I know. But after all, all the entire
> > > > > web2py appearance are hardcoded in style.css, no one complains about
> > > > > that. That is because, those kind of things are supposed to be in css
> > > > > level, even hardcode.
>
> > > > > On Apr19, 3:49am, Yarko Tymciurak  wrote:
> > > > > > this too sounds good...
> > > > > > In fact, controller should have some LOGICAL (name as opposed to
> > hard
> > > > > code)
> > > > > > representation on level of / kind of "flash", and this is why in my
> > > > > earlier
> > > > > > post I took Iceberg's code, and changed to some name
> > (flash.warning,
> > > > > etc.)
> > > > > > and commented:  "defined in models/0.py" ---  which structurally
> > may not
> > > > > be
> > > > > > the right place - but mearly where things are always known to be
> > read /
> > > > > > loaded per-request (which is why in pycon registration we put a lot
> > ... a
> > > > > > LOT of configuration settings in 0.py)..
>
> > > > > > Ignoring that models is all read as a mere technicality, as this
> > (any
> > > > > tool
> > > > > > or common or configuration item) is not at all a model thing, there
> > does
> > > > > > need to be a place to hold common application variables and
> > settings
> > > > > if
> > > > > > not in variables, then in classes that encapsulate the variables
> > and
> > > > > > statically hold them.
>
> > > > > > So - I'm now thinking that both Massimo's and Icebergs latest
> > comments
> > > > > need
> > > > > > to be merged.
>
> > > > > > Regards,
> > > > > > - Yarko
>
> > > > > > On Sat, Apr 18, 2009 at 10:32 AM, Iceberg 
> > wrote:
>
> > > > > > > Well, I had similar thoughts as Massimo at the beginning, and
> > that is
> > > > > > > exactly why I "stop here", and even use hardcode magic color.
>
> > > > > > > IMHO, a controller should be able to clearly express general
> > info,
> > > > > > > warning msg, and bad error. Because they are so commonly needed
> > in
> > > > > > > EVERY web app. If you think you don't need to separate them from
> > each
> > > > > > > other, you are wrong. I observed users of my app tend to ignore
> > > > > > > warnings even errors because they just look same in a glance, all
> > are
> > > > > > > a long sentence of blah in an orange bar. If we change info to be
> > in
> > > > > > > green, warning in yellow, error in red, that will certainly catch
> > > > > > > immediate attention.
>
> > > > > > > As to the colors, I think they are not important in the
> > controller.
> > > > > > > Actually, from a traditional MVC angle of view, controller should
> > not
> > > > > > > care about color at all. So I leave them into the View part

[web2py:20024] Re: CRUD not updating

2009-04-19 Thread Tito Garrido
It's from the svn trunk:
web2py Version 1.61.1 (2009-04-18 10:09:25)
web2py is up to date 


Controller, user_admin.py:
FORM_ACCEPT=T('record inserted')
FORM_ERROR=T('form errors')

#
auth.settings.on_failed_authorization=URL(r=request,f='error')
def user(): return dict(form=auth())
def data(): return dict(form=crud())
def download(): return response.download(request,db)
def error(): return dict(message = T("not authorized"))
#

@auth.requires_membership('Admin')
def index():
user_table=SQLTABLE(db(db.auth_user.id>0).select(db.auth_user.id
,db.auth_user.first_name,db.auth_user.last_name,db.auth_user.email),headers={'
auth_user.id':T('Id'),'auth_user.first_name':T('First
Name'),'auth_user.last_name':T('Last Name'),'auth_user.email' :
T('Email')},_border=1, linkto=URL(r=request,f='data/update'))
form_user = SQLFORM(db.auth_user)
if form_user.accepts(request.vars, session):
session.flash=FORM_ACCEPT
redirect(URL(r=request,f='admin'))
elif form_user.errors:
response.flash=FORM_ERROR
membership=SQLTABLE(db((db.auth_membership.user_id==db.auth_user.id
)&(db.auth_membership.group_id==db.auth_group.id)).select(
db.auth_membership.id
,db.auth_user.email,db.auth_group.role,orderby=db.auth_group.role),headers={'
auth_membership.id' : 'Id','auth_user.email' : 'Email', 'auth_group.role' :
T('Group')},_border=1, linkto=URL(r=request,f='data/update'))
form_membership = SQLFORM(db.auth_membership)
if form_membership.accepts(request.vars, session):
session.flash=FORM_ACCEPT
redirect(URL(r=request,f='admin'))
elif form_membership.errors:
response.flash=FORM_ERROR
group=SQLTABLE(db(db.auth_group.id>0).select(db.auth_group.id
,db.auth_group.role),headers={'auth_group.id': 'Id','auth_group.role' :
T('Role')},_border=1, linkto=URL(r=request,f='data/update'))
form_group = SQLFORM(db.auth_group)
if form_group.accepts(request.vars, session):
session.flash=FORM_ACCEPT
redirect(URL(r=request,f='admin'))
elif form_group.errors:
response.flash=FORM_ERROR
return
dict(user_table=user_table,form_user=form_user,form_membership=form_membership,membership=membership,group=group,form_group=form_group)

Just that...

When I click on a group id, for example, to edit, it goes to the edit screen
but the submit button doesn't work.

Thanks in advance!

Tito Garrido

On Sun, Apr 19, 2009 at 12:15 PM, mdipierro  wrote:

>
> Can you post a piece of code to reproduce it? What is the date on the
> version? Is this the stable from the web page or the development
> version from the trunk?
>
> Massimo
>
> On Apr 19, 7:06 am, Tito Garrido  wrote:
> > Hi,
> >
> > I'm using SQLTABLE with linkto=URL(r=request,f='data/update'), but when I
> > try to update/delete nothing happens...
> >
> > I'm using web2py 1.61.1
> >
> > Am I doing something wrong?
> >
> > Thanks,
> >
> > Tito
> >
> > --
> > Linux User #387870
> > .
> >  _/_õ|__|
> > ..º[ .-.___.-._| . . . .
> > .__( o)__( o).:___
> >
>


-- 
Linux User #387870
.
 _/_õ|__|
..º[ .-.___.-._| . . . .
.__( o)__( o).:___

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:20025] Re: Some doubts

2009-04-19 Thread Jose



On 19 abr, 12:17, mdipierro  wrote:
> This may be a bug. Let me look into it.
>
I used
form = crud.create(db.table)

instead of
form = SQLFORM(db.table)

With form = SQLFORM(db.table) if it works.

Jose
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:20026] Re: CRUD not updating

2009-04-19 Thread Tito Garrido
Sorry I forgot to post my db.py:

db.define_table('auth_user',
SQLField('first_name', length=128,default=''),
SQLField('last_name', length=128,default=''),
SQLField('email', length=128,default=''),
SQLField('password', 'password', readable=False),
SQLField('registration_key', length=128, writable=False,
readable=False,default=''),
SQLField('pic','upload',default=''))

db.auth_user.first_name.requires = IS_NOT_EMPTY()
db.auth_user.last_name.requires = IS_NOT_EMPTY()
db.auth_user.password.requires = CRYPT()
db.auth_user.email.requires = [IS_EMAIL(), IS_NOT_IN_DB(db,
db.auth_user.email)]
db.auth_user.registration_key.default = ''

Thanks!

On Sun, Apr 19, 2009 at 12:33 PM, Tito Garrido wrote:

> It's from the svn trunk:
> web2py Version 1.61.1 (2009-04-18 10:09:25)
> web2py is up to date 
>
>
> Controller, user_admin.py:
> FORM_ACCEPT=T('record inserted')
> FORM_ERROR=T('form errors')
>
> #
> auth.settings.on_failed_authorization=URL(r=request,f='error')
> def user(): return dict(form=auth())
> def data(): return dict(form=crud())
> def download(): return response.download(request,db)
> def error(): return dict(message = T("not authorized"))
> #
>
> @auth.requires_membership('Admin')
> def index():
> user_table=SQLTABLE(db(db.auth_user.id>0).select(db.auth_user.id
> ,db.auth_user.first_name,db.auth_user.last_name,db.auth_user.email),headers={'
> auth_user.id':T('Id'),'auth_user.first_name':T('First
> Name'),'auth_user.last_name':T('Last Name'),'auth_user.email' :
> T('Email')},_border=1, linkto=URL(r=request,f='data/update'))
> form_user = SQLFORM(db.auth_user)
> if form_user.accepts(request.vars, session):
> session.flash=FORM_ACCEPT
> redirect(URL(r=request,f='admin'))
> elif form_user.errors:
> response.flash=FORM_ERROR
> membership=SQLTABLE(db((db.auth_membership.user_id==db.auth_user.id
> )&(db.auth_membership.group_id==db.auth_group.id)).select(
> db.auth_membership.id
> ,db.auth_user.email,db.auth_group.role,orderby=db.auth_group.role),headers={'
> auth_membership.id' : 'Id','auth_user.email' : 'Email', 'auth_group.role'
> : T('Group')},_border=1, linkto=URL(r=request,f='data/update'))
> form_membership = SQLFORM(db.auth_membership)
> if form_membership.accepts(request.vars, session):
> session.flash=FORM_ACCEPT
> redirect(URL(r=request,f='admin'))
> elif form_membership.errors:
> response.flash=FORM_ERROR
> group=SQLTABLE(db(db.auth_group.id>0).select(db.auth_group.id
> ,db.auth_group.role),headers={'auth_group.id': 'Id','auth_group.role' :
> T('Role')},_border=1, linkto=URL(r=request,f='data/update'))
> form_group = SQLFORM(db.auth_group)
> if form_group.accepts(request.vars, session):
> session.flash=FORM_ACCEPT
> redirect(URL(r=request,f='admin'))
> elif form_group.errors:
> response.flash=FORM_ERROR
> return
> dict(user_table=user_table,form_user=form_user,form_membership=form_membership,membership=membership,group=group,form_group=form_group)
>
> Just that...
>
> When I click on a group id, for example, to edit, it goes to the edit
> screen but the submit button doesn't work.
>
> Thanks in advance!
>
> Tito Garrido
>
>
> On Sun, Apr 19, 2009 at 12:15 PM, mdipierro wrote:
>
>>
>> Can you post a piece of code to reproduce it? What is the date on the
>> version? Is this the stable from the web page or the development
>> version from the trunk?
>>
>> Massimo
>>
>> On Apr 19, 7:06 am, Tito Garrido  wrote:
>> > Hi,
>> >
>> > I'm using SQLTABLE with linkto=URL(r=request,f='data/update'), but when
>> I
>> > try to update/delete nothing happens...
>> >
>> > I'm using web2py 1.61.1
>> >
>> > Am I doing something wrong?
>> >
>> > Thanks,
>> >
>> > Tito
>> >
>> > --
>> > Linux User #387870
>> > .
>> >  _/_õ|__|
>> > ..º[ .-.___.-._| . . . .
>> > .__( o)__( o).:___
>> >>
>>
>
>
> --
> Linux User #387870
> .
>  _/_õ|__|
> ..º[ .-.___.-._| . . . .
> .__( o)__( o).:___
>



-- 
Linux User #387870
.
 _/_õ|__|
..º[ .-.___.-._| . . . .
.__( o)__( o).:___

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:20027] Re: URL structure for multilanguage site

2009-04-19 Thread Jiri Zahradil
I tried to investigate that and it is clear that content localized by
session/browser preferance only *cannot* be properly indexed by search
engines. Localized version of content must have 1) own URL, 2) must have
properly set Content-Language in HTTP headers (can be set by meta tag also).
--
Jiri



On Sun, Apr 19, 2009 at 5:05 PM, mdipierro  wrote:

>
> I do not know. This may help:
>
> http://www.seoconsultants.com/meta-tags/language.asp
>
> On Apr 19, 5:03 am, jiri  wrote:
> > Thanks, routes_in fragment seems to be what I was looking for. Session
> > variable for remembering last selected language - I like that, I am
> > going to include that also.
> >
> > I am not sure about handling language purely using sessions in
> > general. It could be  worthful if you have an app like webmail for
> > example and you want to translate it. But in case of site with content
> > in multiple languages I believe that right way is to have pages
> > (content) in different languages to have different URLs. How can
> > search engine handle different language version of page/article if
> > language is handled using sessions(and browser language setting)
> > only?
> >
> > Jiri
> >
> > On 18 Dub, 17:41, mdipierro  wrote:
> >
> > > Personally I do not user routes much and I like to do
> >
> > > if request.vars.force_language: session.force_language
> > > if session.force_language: T.force(force_language)
> >
> > > and have button in the 'index' page that reload the index page in
> > > various languages
> >
> > > French
> >
> > > Because of the session var, web2py will remember my preferred
> > > language.
> >
> > > Massimo
> >
> > > On Apr 18, 10:35 am, mdipierro  wrote:
> >
> > > > routes_in = (
> > > > ('/yourapp/static/(?P.*)','/yourapp/static/$any'),
> > > > ('/yourapp/$language/(?P.*)','/yourapp/default/$any?_language=
> > > > $language'),
> > > > )
> >
> > > > and in your model
> >
> > > > if request.vars._language: T.force(request.vars._language)
> >
> > > > Massimo
> >
> > > > On Apr 18, 9:49 am, Iceberg  wrote:
> >
> > > > > By the way, I believe the T("...") handles short phrase better, but
> if
> > > > > you need to deal with some long article such as company background
> > > > > description, it will also be a good choice to manually organize
> your
> > > > > file as:
> > > > >   yourapp/static/en/about.html
> > > > >   yourapp/static/de/about.html
> > > > >   ...
> >
> > > > > On Apr18, 10:09pm, Jason Brower  wrote:
> >
> > > > > > It's my understanding the web2py takes care of all the multi
> language
> > > > > > stuff automatically, no need to set it in the browser.
> > > > > > Just set the language file and make sure to put a T("") Around ya
> > > > > > strings.
> > > > > > br-
> > > > > > Jason Brower
> >
> > > > > > On Sat, 2009-04-18 at 04:14 -0700, jiri wrote:
> > > > > > > Hello,
> >
> > > > > > > I am new to web2py and I am working on multi-language site
> using this
> > > > > > > framework. What is the best way to structure URLs for such
> site?
> > > > > > > Previously I used this scheme (see below) in Pylons framework,
> it was
> > > > > > > mapped using routing module to "lang" parameter and then
> correct
> > > > > > > language was set up just before selected controller function
> (by URL)
> > > > > > > was called. What I need to do to use this scheme in web2py or
> what is
> > > > > > > the recommended way to do this?
> >
> > > > > > > /en/about/
> > > > > > > /en/products/
> > > > > > > ...
> > > > > > > /de/about/
> > > > > > > /de/products/
> > > > > > > ...
> > > > > > > /es/about/
> > > > > > > /es/products/
> > > > > > > ...
> >
> > > > > > > Jiri
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:20028] Re: Question on request.vars

2009-04-19 Thread Joseph Jude

Massimo,
Thanks for the reply. But it didn't work. I've this simple assign
function:


def assign():
print request.vars

and it prints this. Note the \r\n as first characters. This is what is
causing the problem



Just for the ref, I'm using the below python script for sending
parameters.

data = {'fields': {'case_id': 16, 'assign_to': 'age...@example.com'}}

data = urllib.urlencode(data)
response = urllib2.urlopen(request,data).read()

Hope you can help me out. Thanks,
Joseph

On Apr 19, 8:10 pm, mdipierro  wrote:
> The "assign" function expects the request.vars.fields to be in JSON.
> This should do it but I have not tried it.
>
> data = {'fields': simplejson.dumps({'case_id': 16, 'assign_to':
> 'age...@example.com'})}
> data = urllib.urlencode(data)
> response = urllib2.urlopen(request,data).read()
>
> Massimo
>
> On Apr 19, 5:55 am, Joseph Jude  wrote:
>
> > Hi all,
> > I have a function as below. This is called as part of API function
> > rather than from the browser.
>
> > def assign():
> >     print request.vars.fields
> >     if request.vars.fields:
> >         case_values=json.loads(request.vars.fields)
> >         ret_dict=api.assign_case(db,case_values)
> >     else:
> >         ret_dict={'id': 1, 'msg': 'No parameters received'}
> >     return json.dumps(ret_dict)
>
> > When I invoke this via,
> > curl -u u...@example.com:web2pyhttp://localhost:8000/init/api/assign/
> > -d fields='{"id":16,"assign_to":"age...@example.com"}'
>
> > I do get request.vars.fields properly and the function executes as
> > desired. However when I try the same via a python script like the
> > below:
>
> > data = {
> >                 'fields': {'case_id': 16, 'assign_to': 'age...@example.com'}
> >                 }
>
> > data = urllib.urlencode(data)
> > response = urllib2.urlopen(request,data).read()
>
> > There is no input parameter (fields). When I examine the
> > request.vars.fields, it shows like the below:
>
> >  > 'age...@example.com'%"}>
>
> > There are \r\n at the begining and % at the end. Is there a reason for
> > this? How can I test my function using python script (ie achieve the
> > same result as curl).
>
> > Hope my question is not too confusing.
>
> > Thank you,
> > Joseph
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:20029] Re: Can response.flash have different colors?

2009-04-19 Thread Douglas Soares de Andrade

Em Domingo 19 Abril 2009, às 12:25:34, mdipierro escreveu:
> yes we can do that. I can include a warn, info and error in different
> colors.
>
> Massimo

Great, +1 to this =)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:20030] Re: Can response.flash have different colors?

2009-04-19 Thread Iceberg

Glad to have a happy ending of this story. :-)

On Apr19, 11:25pm, mdipierro  wrote:
> yes we can do that. I can include a warn, info and error in different
> colors.
>
> Massimo
>
> On Apr 19, 10:07 am, Yarko Tymciurak  wrote:
>
> > this seems like a nice approach...  one that separates concerns between
> > controller and view, and yet leaves things out of web2py, that is all to the
> > application...
> > Does it make sense to support this kind of convention by having default
> > classes in CSS?
>
> > On Sun, Apr 19, 2009 at 10:04 AM, mdipierro  wrote:
>
> > > BTW... one can also do
> > > response.flash=DIV("this is a message",_class="warn")
> > > and then declare a class "warn" in the CSS.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:20031] Auth "decorators" - Just not getting it.

2009-04-19 Thread Jason Brower

I have this..
-
@auth.requires_login():
def profile():
tags = db().select(db.tag.ALL,orderby=db.tag.name)
tagForm = SQLFORM(db.tag, _class="jNice")
userForm = SQLFORM(db.users)
if tagForm.accepts(request.vars):
response.flash='Tag Added!'
else tagForm.errors: response.flash='Hmm... Something is wrong
here...'
if userForm.accepts(request.vars):
response.flash='User Added!'
else userForm.errors: response.flash='Hmm... Something is wrong
here...'
return dict(form=tagForm, tags = tags, userForm = userForm,
today=today)

In my eyes that is exactly what has been told for me to do from here:
http://mdp.cti.depaul.edu/examples/default/tools#authorization
But seem to be stuck at "invalid syntax"
Everything in my little python mind is telling me to indent after a :
but it's not that way in the example.  What am I doing wrong here?
Thanks guys,
Jason Brower




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:20032] Re: CRUD not updating

2009-04-19 Thread Iceberg

I happened to confirm same problem today.

I am now using stable web2py 1.61.1, but it seems the problem exists
even earlier than 1.61.1 ...

My simplified code for reproducing.

Model:
db = SQLDB('sqlite://storage.db')
db.define_table('repository',
  db.Field('name'),
  )
from gluon.tools import Mail, Auth, Crud
crud=Crud(globals(),db)

Controller:
def data(): return dict(form=crud())

On Apr19, 11:15pm, mdipierro  wrote:
> Can you post a piece of code to reproduce it? What is the date on the
> version? Is this the stable from the web page or the development
> version from the trunk?
>
> Massimo
>
> On Apr 19, 7:06 am, Tito Garrido  wrote:
>
> > Hi,
>
> > I'm using SQLTABLE with linkto=URL(r=request,f='data/update'), but when I
> > try to update/delete nothing happens...
>
> > I'm using web2py 1.61.1
>
> > Am I doing something wrong?
>
> > Thanks,
>
> > Tito
>
> > --
> > Linux User #387870
> > .
> >  _/_õ|__|
> > ..º[ .-.___.-._| . . . .
> > .__( o)__( o).:___
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:20033] Re: Auth "decorators" - Just not getting it.

2009-04-19 Thread AchipA

IIRC decorators are just function *names*, loose ():

On Apr 19, 1:13 pm, Jason Brower  wrote:
> I have this..
> -
> @auth.requires_login():
> def profile():
>     tags = db().select(db.tag.ALL,orderby=db.tag.name)
>     tagForm = SQLFORM(db.tag, _class="jNice")
>     userForm = SQLFORM(db.users)
>     if tagForm.accepts(request.vars):
>         response.flash='Tag Added!'
>     else tagForm.errors: response.flash='Hmm... Something is wrong
> here...'
>     if userForm.accepts(request.vars):
>         response.flash='User Added!'
>     else userForm.errors: response.flash='Hmm... Something is wrong
> here...'
>     return dict(form=tagForm, tags = tags, userForm = userForm,
> today=today)
> 
> In my eyes that is exactly what has been told for me to do from 
> here:http://mdp.cti.depaul.edu/examples/default/tools#authorization
> But seem to be stuck at "invalid syntax"
> Everything in my little python mind is telling me to indent after a :
> but it's not that way in the example.  What am I doing wrong here?
> Thanks guys,
> Jason Brower
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:20034] Auth issue resolved....

2009-04-19 Thread Jason Brower

It seems there is a typo.
There should be no : at the end of decorators.
Thanks,
Jason Brower



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:20035] Re: Some doubts

2009-04-19 Thread mdipierro

yes, you cannot use crud because that prcesses the form before
returning the form, so before you can modify it.
SQLFORM is the way to go.

Massimo

On Apr 19, 10:35 am, Jose  wrote:
> On 19 abr, 12:17, mdipierro  wrote:> This may be a 
> bug. Let me look into it.
>
> I used
> form = crud.create(db.table)
>
> instead of
> form = SQLFORM(db.table)
>
> With form = SQLFORM(db.table) if it works.
>
> Jose
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:20036] Re: Auth "decorators" - Just not getting it.

2009-04-19 Thread mdipierro

no ":" at the end of the decorator.

Massimo

On Apr 19, 12:37 pm, AchipA  wrote:
> IIRC decorators are just function *names*, loose ():
>
> On Apr 19, 1:13 pm, Jason Brower  wrote:
>
> > I have this..
> > -
> > @auth.requires_login():
> > def profile():
> >     tags = db().select(db.tag.ALL,orderby=db.tag.name)
> >     tagForm = SQLFORM(db.tag, _class="jNice")
> >     userForm = SQLFORM(db.users)
> >     if tagForm.accepts(request.vars):
> >         response.flash='Tag Added!'
> >     else tagForm.errors: response.flash='Hmm... Something is wrong
> > here...'
> >     if userForm.accepts(request.vars):
> >         response.flash='User Added!'
> >     else userForm.errors: response.flash='Hmm... Something is wrong
> > here...'
> >     return dict(form=tagForm, tags = tags, userForm = userForm,
> > today=today)
> > 
> > In my eyes that is exactly what has been told for me to do from 
> > here:http://mdp.cti.depaul.edu/examples/default/tools#authorization
> > But seem to be stuck at "invalid syntax"
> > Everything in my little python mind is telling me to indent after a :
> > but it's not that way in the example.  What am I doing wrong here?
> > Thanks guys,
> > Jason Brower
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:20037] Re: dataTables and date

2009-04-19 Thread mdipierro

Here is how I make it work. I am not sure what is missing in your
case

In model
db.define_table('person',SQField('name'),SQLField
('birthday','date',requires=IS_DATE(str(T('%Y-%m-%d')

create a language file for example it.py and translate:

'%Y-%m-%d': '%d/%m/%Y',
'%Y-%m-%d %H:%M:%S': '%d/%m/%Y %H:%M:%S',

everything works for me. No need to change anything in
web2py_ajax.html.

Massimo




On 19 Apr, 10:12, mdipierro  wrote:
> I promise I will look into this today.
>
> Massimo
>
> On Apr 19, 7:05 am, jmverm...@xs4all.nl wrote:
>
> > I am still struggling with the formatting of date, I first tried to
> > solve the problem the best way, when I didn't get that to work I
> > thought I'd try the quick fix, unfortunately, resulting in the same
> > errors.
>
> > This works, however, the date is displayed in the format: -mm-dd,
> > whereas I need dd-mm-.
>
> > Validator in model:
>
> > db.event.van_datum.requires=IS_DATE('%Y-%m-%d')
> > db.event.tot_datum.requires=IS_NULL_OR(IS_DATE('%Y-%m-%d'))
>
> > web2py_ajax.html:
>
> > try {$("input.date").focus( function() {Calendar.setup({
> >      inputField:this.id, ifFormat:"{{=T('%Y-%m-%d')}}",
> > showsTime:false}); }); } catch(e) {};
>
> > try { $("input.datetime").focus( function() {Calendar.setup({
> >      inputField:this.id, ifFormat:"{{=T('%Y-%m-%d %H:%M:%S')}}",
> > showsTime: true,timeFormat: "24"}); }); } catch(e) {};
>
> > try { $("input.time").clockpick({
> >      starthour:0, endhour:23, showminutes:true, military:true
>
> > }); } catch(e) {};
>
> > Function in controller:
>
> > def byplace():
> >     response.functionname=T('Event list by place')
> >     response.image=URL(r=request,c='static',f='media/core/banner.png')
> >     form=form_factory(SQLField('plaats',requires=IS_NOT_EMPTY(),\
> >     widget=lambda self, value:INPUT
> > (_id='eventbyplace',_name='plaats',_class='ac_input',_type='text',requires=self.requires)),
> >     SQLField('datum',type='date',requires=IS_DATE('%Y-%m-%d')),\
> >     SQLField('dagen',requires=IS_IN_SET([7,14,28,56],labels=['1
> > week','2 weken','4 weken','8 weken'])))
> >     events=[]
> >     if form.accepts(request.vars,session):
> >         response.flash=T('no results')
> >         fromdate=request.vars.datum
> >         todate=IS_DATE()(fromdate)[0]+datetime.timedelta(days=int
> > (request.vars.dagen))
> >         events=db((db.event.plaats==request.vars.plaats)&
> > (db.event.van_datum>=fromdate)&\
> >         (db.event.van_datum<=todate)&(db.event.doelgroep=='Consumer')&
> > (db.event.scope=='Extern'))\
> >         .select
> > (db.event.id,db.event.event,db.event.van_datum,db.event.locatie,\
> >         db.event.eventtype,orderby=db.event.van_datum)
> >     elif form.errors:
> >         response.flash=T('form has errors')
> >     else:
> >         response.flash=T('please fill the form')
> >     return dict(form=form,events=events)
>
> > In the view:
>
> > 
> >     {{=event.van_datum}}
> > 
>
> > This doesn't work:
>
> > Validator in model:
>
> > db.event.van_datum.requires=IS_DATE('%d-%m-%Y')
> > db.event.tot_datum.requires=IS_NULL_OR(IS_DATE('%d-%m-%Y'))
>
> > web2py_ajax.html:
>
> > try {$("input.date").focus( function() {Calendar.setup({
> >      inputField:this.id, ifFormat:"{{=T('%d-%m-%Y')}}",
> > showsTime:false}); }); } catch(e) {};
>
> > try { $("input.datetime").focus( function() {Calendar.setup({
> >      inputField:this.id, ifFormat:"{{=T('%d-%m-%Y %H:%M:%S')}}",
> > showsTime: true,timeFormat: "24"}); }); } catch(e) {};
>
> > try { $("input.time").clockpick({
> >      starthour:0, endhour:23, showminutes:true, military:true}); } catch(e) 
> > {};
>
> > On Apr 17, 8:09 am, jmverm...@xs4all.nl wrote:
>
> > Function in the controller:
> > def byplace():
> >     response.functionname=T('Event list by place')
> >     response.image=URL(r=request,c='static',f='media/core/banner.png')
> >     form=form_factory(SQLField('plaats',requires=IS_NOT_EMPTY(),\
> >     widget=lambda self, value:INPUT
> > (_id='eventbyplace',_name='plaats',_class='ac_input',_type='text',requires=self.requires)),
> >     SQLField('datum',type='date',requires=IS_DATE('%d-%m-%Y')),\
> >     SQLField('dagen',requires=IS_IN_SET([7,14,28,56],labels=['1
> > week','2 weken','4 weken','8 weken'])))
> >     events=[]
> >     if form.accepts(request.vars,session):
> >         response.flash=T('no results')
> >         fromdate=request.vars.datum
> >         todate=IS_DATE()(fromdate)[0]+datetime.timedelta(days=int
> > (request.vars.dagen))
> >         events=db((db.event.plaats==request.vars.plaats)&
> > (db.event.van_datum>=fromdate)&\
> >         (db.event.van_datum<=todate)&(db.event.doelgroep=='Consumer')&
> > (db.event.scope=='Extern'))\
> >         .select
> > (db.event.id,db.event.event,db.event.van_datum,db.event.locatie,\
> >         db.event.eventtype,orderby=db.event.van_datum)
> >     elif form.errors:
> >         response.flash=T('form has errors')
> >     else:
> >         response.flash=T('please fill the form')

[web2py:20038] Re: CRUD not updating

2009-04-19 Thread mdipierro

Can you try trunk now? It works for me.

Massimo

On 19 Apr, 12:30, Iceberg  wrote:
> I happened to confirm same problem today.
>
> I am now using stable web2py 1.61.1, but it seems the problem exists
> even earlier than 1.61.1 ...
>
> My simplified code for reproducing.
>
> Model:
> db = SQLDB('sqlite://storage.db')
> db.define_table('repository',
>   db.Field('name'),
>   )
> from gluon.tools import Mail, Auth, Crud
> crud=Crud(globals(),db)
>
> Controller:
> def data(): return dict(form=crud())
>
> On Apr19, 11:15pm, mdipierro  wrote:
>
> > Can you post a piece of code to reproduce it? What is the date on the
> > version? Is this the stable from the web page or the development
> > version from the trunk?
>
> > Massimo
>
> > On Apr 19, 7:06 am, Tito Garrido  wrote:
>
> > > Hi,
>
> > > I'm using SQLTABLE with linkto=URL(r=request,f='data/update'), but when I
> > > try to update/delete nothing happens...
>
> > > I'm using web2py 1.61.1
>
> > > Am I doing something wrong?
>
> > > Thanks,
>
> > > Tito
>
> > > --
> > > Linux User #387870
> > > .
> > >  _/_õ|__|
> > > ..º[ .-.___.-._| . . . .
> > > .__( o)__( o).:___
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:20039] Re: CRUD not updating

2009-04-19 Thread Tito Garrido
Now it works... as soon as it get update it goes to data/tables, is that
something configurable?

Thanks!

On Sun, Apr 19, 2009 at 6:43 PM, mdipierro  wrote:

>
> Can you try trunk now? It works for me.
>
> Massimo
>
> On 19 Apr, 12:30, Iceberg  wrote:
> > I happened to confirm same problem today.
> >
> > I am now using stable web2py 1.61.1, but it seems the problem exists
> > even earlier than 1.61.1 ...
> >
> > My simplified code for reproducing.
> >
> > Model:
> > db = SQLDB('sqlite://storage.db')
> > db.define_table('repository',
> >   db.Field('name'),
> >   )
> > from gluon.tools import Mail, Auth, Crud
> > crud=Crud(globals(),db)
> >
> > Controller:
> > def data(): return dict(form=crud())
> >
> > On Apr19, 11:15pm, mdipierro  wrote:
> >
> > > Can you post a piece of code to reproduce it? What is the date on the
> > > version? Is this the stable from the web page or the development
> > > version from the trunk?
> >
> > > Massimo
> >
> > > On Apr 19, 7:06 am, Tito Garrido  wrote:
> >
> > > > Hi,
> >
> > > > I'm using SQLTABLE with linkto=URL(r=request,f='data/update'), but
> when I
> > > > try to update/delete nothing happens...
> >
> > > > I'm using web2py 1.61.1
> >
> > > > Am I doing something wrong?
> >
> > > > Thanks,
> >
> > > > Tito
> >
> > > > --
> > > > Linux User #387870
> > > > .
> > > >  _/_õ|__|
> > > > ..º[ .-.___.-._| . . . .
> > > > .__( o)__( o).:___
> >
>


-- 
Linux User #387870
.
 _/_õ|__|
..º[ .-.___.-._| . . . .
.__( o)__( o).:___

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:20040] Re: CRUD not updating

2009-04-19 Thread mdipierro

yes.

auth.settings.update_next=URL(...)

On 19 Apr, 16:55, Tito Garrido  wrote:
> Now it works... as soon as it get update it goes to data/tables, is that
> something configurable?
>
> Thanks!
>
>
>
> On Sun, Apr 19, 2009 at 6:43 PM, mdipierro  wrote:
>
> > Can you try trunk now? It works for me.
>
> > Massimo
>
> > On 19 Apr, 12:30, Iceberg  wrote:
> > > I happened to confirm same problem today.
>
> > > I am now using stable web2py 1.61.1, but it seems the problem exists
> > > even earlier than 1.61.1 ...
>
> > > My simplified code for reproducing.
>
> > > Model:
> > > db = SQLDB('sqlite://storage.db')
> > > db.define_table('repository',
> > >   db.Field('name'),
> > >   )
> > > from gluon.tools import Mail, Auth, Crud
> > > crud=Crud(globals(),db)
>
> > > Controller:
> > > def data(): return dict(form=crud())
>
> > > On Apr19, 11:15pm, mdipierro  wrote:
>
> > > > Can you post a piece of code to reproduce it? What is the date on the
> > > > version? Is this the stable from the web page or the development
> > > > version from the trunk?
>
> > > > Massimo
>
> > > > On Apr 19, 7:06 am, Tito Garrido  wrote:
>
> > > > > Hi,
>
> > > > > I'm using SQLTABLE with linkto=URL(r=request,f='data/update'), but
> > when I
> > > > > try to update/delete nothing happens...
>
> > > > > I'm using web2py 1.61.1
>
> > > > > Am I doing something wrong?
>
> > > > > Thanks,
>
> > > > > Tito
>
> > > > > --
> > > > > Linux User #387870
> > > > > .
> > > > >  _/_õ|__|
> > > > > ..º[ .-.___.-._| . . . .
> > > > > .__( o)__( o).:___
>
> --
> Linux User #387870
> .
>  _/_õ|__|
> ..º[ .-.___.-._| . . . .
> .__( o)__( o).:___
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:20041] Re: Can response.flash have different colors?

2009-04-19 Thread mdipierro

We can do this:

warn { background-color: yellow; color: black; padding: 5px; }
.info { background-color: green; color: white; padding: 5px; }
.error { background-color: red; color: white; padding: 5px; }
 .flash { margin: 0 auto; text-align: center; clear: both; border: 1px
#00; background-color: #FF5C1F; color: white; margin-top: 0.0em;
margin-bottom: 1.0em; padding-top: 1.0em; padding-bottom: 1.0em;
cursor: pointer; }

def index():
response.flash=DIV("Hello World",_class='info')
return dict()

But it looks ugly. Mind that it has to work decently even if one does

def index():
response.flash="Hello World"
return dict()

Any advice?

Massimo

On 19 Apr, 12:00, Iceberg  wrote:
> Glad to have a happy ending of this story. :-)
>
> On Apr19, 11:25pm, mdipierro  wrote:
>
> > yes we can do that. I can include a warn, info and error in different
> > colors.
>
> > Massimo
>
> > On Apr 19, 10:07 am, Yarko Tymciurak  wrote:
>
> > > this seems like a nice approach...  one that separates concerns between
> > > controller and view, and yet leaves things out of web2py, that is all to 
> > > the
> > > application...
> > > Does it make sense to support this kind of convention by having default
> > > classes in CSS?
>
> > > On Sun, Apr 19, 2009 at 10:04 AM, mdipierro  
> > > wrote:
>
> > > > BTW... one can also do
> > > > response.flash=DIV("this is a message",_class="warn")
> > > > and then declare a class "warn" in the CSS.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:20042] writable = False. Is it an bug?

2009-04-19 Thread Jose

I believe that in the version 1.61.1 the property "writable", in the
SQLField, is working badly.
Can Alguién check it?

Regards
Jose
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:20043] writable = False. Is it an bug?

2009-04-19 Thread Jose

I believe that in the version 1.61.1 the property "writable", in the
SQLField, is working badly.
Can anybody check it?

Regards
Jose
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:20044] Re: writable = False. Is it an bug?

2009-04-19 Thread mdipierro

Works for me. Can you give an example of code, what you expect and
what it does instead?

Massimo

On 19 Apr, 20:03, Jose  wrote:
> I believe that in the version 1.61.1 the property "writable", in the
> SQLField, is working badly.
> Can anybody check it?
>
> Regards
> Jose
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:20045] benchmarks

2009-04-19 Thread mdipierro

Is the author of this here?

http://www.nabble.com/GSP,-Gstring-are-very-SLOW---just-see-my-results-td23121257.html

Did you record any numbers we can publish?

Massimo
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:20046] Re: writable = False. Is it an bug?

2009-04-19 Thread Jose



On 20 abr, 01:30, mdipierro  wrote:
> Works for me. Can you give an example of code, what you expect and
> what it does instead?

Simply something that two days ago it was working now well does not do
it.

db.define_table('mytable',
SQLField('field_1', 'string'),
SQLField('field_2', 'string'),
...
SQLField('field_n', 'boolean', writable=False),
)

When I create the form with SQLFORM, it shows me the label of the
field in the first column and None in the second.

As I said, two days ago (v.: 1.60 or 1.61 I do not remember) this
field was not appearing, that it is since I hope that it works.

I tried this in windows and in freebsd.

Jose


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:20047] Re: writable = False. Is it an bug?

2009-04-19 Thread mdipierro

This is not a bug but it was a bug before.

If you want the field editable

 SQLField('field_n', 'boolean', writable=True),

If you want the field to appear readonly

 SQLField('field_n', 'boolean', writable=False, readable=True,
default=True),

(it will show the default value, in your case None because default is
no set)

If you do not want the field to appear at all (what you want)

 SQLField('field_n', 'boolean', writable=False,
readable=False),

Massimo


On 19 Apr, 20:58, Jose  wrote:
> On 20 abr, 01:30, mdipierro  wrote:
>
> > Works for me. Can you give an example of code, what you expect and
> > what it does instead?
>
> Simply something that two days ago it was working now well does not do
> it.
>
> db.define_table('mytable',
>         SQLField('field_1', 'string'),
>         SQLField('field_2', 'string'),
>         ...
>         SQLField('field_n', 'boolean', writable=False),
>         )
>
> When I create the form with SQLFORM, it shows me the label of the
> field in the first column and None in the second.
>
> As I said, two days ago (v.: 1.60 or 1.61 I do not remember) this
> field was not appearing, that it is since I hope that it works.
>
> I tried this in windows and in freebsd.
>
> Jose
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:20048] web2py 1.61.2 is out

2009-04-19 Thread mdipierro

No major changes except:
- Includes change in default form names.
- Fixes some typos
- Pack all now also cleans up errors and sessions

Please give it a try.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:20049] Re: writable = False. Is it an bug?

2009-04-19 Thread Jose



On 20 abr, 02:04, mdipierro  wrote:
> This is not a bug but it was a bug before.

When?

In the last video only it uses writable=False, but not readable=False.

The same thing in dojo.pdf

Jose
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:20050] Re: writable = False. Is it an bug?

2009-04-19 Thread mdipierro

OK. It may be seen as a change of behavior but don't you agree it is
better now? Technically it does not break backward compatibility since
it does not break existing apps.

Massimo

On 19 Apr, 21:22, Jose  wrote:
> On 20 abr, 02:04, mdipierro  wrote:
>
> > This is not a bug but it was a bug before.
>
> When?
>
> In the last video only it uses writable=False, but not readable=False.
>
> The same thing in dojo.pdf
>
> Jose
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:20051] Re: Auth issue resolved....

2009-04-19 Thread mdipierro

yes there was a typo in the documentation. It should now be fixed.

On 19 Apr, 12:40, Jason Brower  wrote:
> It seems there is a typo.
> There should be no : at the end of decorators.
> Thanks,
> Jason Brower
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:20052] Re: writable = False. Is it an bug?

2009-04-19 Thread Jose



On 20 abr, 02:32, mdipierro  wrote:
> OK. It may be seen as a change of behavior but don't you agree it is
> better now? Technically it does not break backward compatibility since
> it does not break existing apps.
>
> Massimo

Thank you, it is clear.



Regards
Jose
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:20053] Re: writable = False. Is it an bug?

2009-04-19 Thread Iceberg

Did not know that before. But this design is really good! Wow!

However, as always, I suggest this useful comments can be appeared in
build-in doc such as http://www.web2py.com/examples/default/dal

On Apr20, 10:04am, mdipierro  wrote:
> This is not a bug but it was a bug before.
>
> If you want the field editable
>
>          SQLField('field_n', 'boolean', writable=True),
>
> If you want the field to appear readonly
>
>          SQLField('field_n', 'boolean', writable=False, readable=True,
> default=True),
>
> (it will show the default value, in your case None because default is
> no set)
>
> If you do not want the field to appear at all (what you want)
>
>          SQLField('field_n', 'boolean', writable=False,
> readable=False),
>
> Massimo

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:20054] Re: web2py 1.61.2 is out

2009-04-19 Thread Iceberg

"Pack all now also cleans up errors and sessions" works as
expected. :-)  By the way, you lost a fix to a minor, minor bug: when
trying to "cleanup" admin, now a ticket is issued (at least on Windows
XP). In my previous patch, I also wrap try...except outside os.unlink
(session_files)

On Apr20, 10:15am, mdipierro  wrote:
> No major changes except:
> - Includes change in default form names.
> - Fixes some typos
> - Pack all now also cleans up errors and sessions
>
> Please give it a try.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:20055] Re: Can response.flash have different colors?

2009-04-19 Thread Iceberg

I tried it on Chrome. That's ugly because the default "flash" div
orange box is bigger than "info", "warn" and "error". So a quick and
dirty hack would be making them has same size.

How about these?

.warn { background-color: yellow; color: black; padding: 5px; }
.info { background-color: #E5FFE5;/*light green*/ color: black;
padding: 5px; }
.error { background-color: red; color: white; padding: 5px; }
.flash { margin: 0 auto; text-align: center; clear: both; border: 1px
#00; background-color: #FF5C1F; color: white;
/* margin-top: 0.0em; margin-bottom: 1.0em; padding-top: 1.0em;
padding-bottom: 1.0em; */
cursor: pointer; }


On Apr20, 7:54am, mdipierro  wrote:
> We can do this:
>
> warn { background-color: yellow; color: black; padding: 5px; }
> .info { background-color: green; color: white; padding: 5px; }
> .error { background-color: red; color: white; padding: 5px; }
>  .flash { margin: 0 auto; text-align: center; clear: both; border: 1px
> #00; background-color: #FF5C1F; color: white; margin-top: 0.0em;
> margin-bottom: 1.0em; padding-top: 1.0em; padding-bottom: 1.0em;
> cursor: pointer; }
>
> def index():
>     response.flash=DIV("Hello World",_class='info')
>     return dict()
>
> But it looks ugly. Mind that it has to work decently even if one does
>
> def index():
>     response.flash="Hello World"
>     return dict()
>
> Any advice?
>
> Massimo
>
> On 19 Apr, 12:00, Iceberg  wrote:
>
> > Glad to have a happy ending of this story. :-)
>
> > On Apr19, 11:25pm, mdipierro  wrote:
>
> > > yes we can do that. I can include a warn, info and error in different
> > > colors.
>
> > > Massimo
>
> > > On Apr 19, 10:07 am, Yarko Tymciurak  wrote:
>
> > > > this seems like a nice approach...  one that separates concerns between
> > > > controller and view, and yet leaves things out of web2py, that is all 
> > > > to the
> > > > application...
> > > > Does it make sense to support this kind of convention by having default
> > > > classes in CSS?
>
> > > > On Sun, Apr 19, 2009 at 10:04 AM, mdipierro  
> > > > wrote:
>
> > > > > BTW... one can also do
> > > > > response.flash=DIV("this is a message",_class="warn")
> > > > > and then declare a class "warn" in the CSS.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:20056] if..else not working

2009-04-19 Thread annet

In the following function, the idea is to select a club's data based
on the id in request.args. Then if the club's status is 0 (the field
is of type string) the function should redirect to an other
application, else the address and nfa data should be selected from the
database and returned to the details view.


def details():
id=request.args[0]
club=db(db.bedrijf.id==id).select(db.bedrijf.ALL)
if club[0].bedrijf.status=='0':
redirect(URL(a='site',c='default',f='index',args=id))
else:
address=db((db.adres.bedrijf==id)&
(db.adres.adressoort=='Vestigingsadres')).select()
nfas=db((db.bedrijfnfa.bedrijf==id)&
(db.bedrijfnfa.nfatype==db.nfatype.id))\
.select
(db.bedrijfnfa.nfatype,db.bedrijfnfa.adres,db.nfatype.nfatype,orderby=db.bedrijfnfa.nfatype)
if not club and address and nfas: redirect(URL
(r=request,f='byplace'))
return dict(club=club[0],address=address[0],nfas=nfas)


This function is not working, the error references the if statement, I
have been tinkering with it, but then, even though the status of a
club is not 0 the function redirects.

What am I doing wrong?


Best regards,

Annet.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:20057] Changing links on SQLTABLE

2009-04-19 Thread weheh

I know this issue has been kicked around alot already and I've
searched the posts for the answer, but I haven't been able to figure
out the way to do the following.

I'm using SQLTABLE with a linkto attribute, which creates a link on
the id field. I would prefer to hide the ID field and move the same id
link to one or more of the other SQLTABLE fields. I've tried doing
this with a lambda function but I can't seem to get it to work. Does
anyone have an example of this, please? Thx.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:20058] Re: Changing links on SQLTABLE

2009-04-19 Thread SergeyPo

It's my specialty in this forum to give link to a thread for SQLTABLE
personalizing.
SQLTTABLE looks like one of the biggest attractors of the whole
web2py, so some effort for extra features and documentation is
required.
Lambda function example and another home-made method is described
here: 
http://groups.google.com/group/web2py/browse_thread/thread/a0c789cccafe8014/f1f96197a13cfeb7?show_docid=f1f96197a13cfeb7

On Apr 20, 10:39 am, weheh  wrote:
> I know this issue has been kicked around alot already and I've
> searched the posts for the answer, but I haven't been able to figure
> out the way to do the following.
>
> I'm using SQLTABLE with a linkto attribute, which creates a link on
> the id field. I would prefer to hide the ID field and move the same id
> link to one or more of the other SQLTABLE fields. I've tried doing
> this with a lambda function but I can't seem to get it to work. Does
> anyone have an example of this, please? Thx.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---