[web2py] menu and drop down menu

2012-05-30 Thread Annet
In a view site/menu.html I have the following code to generate a menu with 
drop down menus.


  
{{for _name,_active,_link in session.site_menu:}}
  {{if session['%sDropdown' % _name]:}}

  {{=_name}}
  
  
  {{for _name,_active,_link in session['%sDropdown' % _name]:}}

  {{=_name}}

  {{pass}}
  

  {{else:}}

  {{=_name}}

  {{pass}}
{{pass}}
  



Whether or not a menu item has a drop down menu depends on database queries 
stored in session:

session.site_menu=[
['Home',request.controller=='site' and 
request.function=='index',URL('site','index',args=session.id)]]
if session.whq:

session.site_menu.append(['Whq',request.controller=='whq',URL('whq','index',args=session.id)])
session.WhqDropdown=[]
if session.whq.who_we_are:
session.WhqDropdown.append(['Wie we 
zijn',request.function=='whoWeAre',\
URL('whq','whoWeAre',args=session.id)])
if session.whq.what_we_do:
session.WhqDropdown.append(['Wat we 
doen',request.function=='whatWeDo',\
URL('whq','whatWeDo',args=session.id)])
if session.whq.how_we_work:
session.WhqDropdown.append(['Hoe we 
werken',request.function=='howWeWork',\
URL('whq','howWeWork',args=session.id)])
if session.whq.where_we_are:
session.WhqDropdown.append(['Waar we 
zitten',request.function=='whereWeAre',\
URL('whq','whereWeAre',args=session.id)])
if session.cal:

session.site_menu.append(['Agenda',request.controller=='calendar',URL('calendar','index',args=session.id)])
session.AgendaDropdown=[]
if session.cal.opening_hours:

session.AgendaDropdown.append(['Openingstijden',request.function=='openingHours',\
URL('calendar','openingHours',args=session.id)])
if session.cal.event_list:
session.AgendaDropdown.append(['Event 
list',request.function=='eventList',\
URL('calendar','eventList',args=session.id)])
if session.cal.timetable:

session.AgendaDropdown.append(['Lesrooster',request.function=='timetable',\
URL('calendar','timetable',args=session.id)])
if session.cal.course_table:

session.AgendaDropdown.append(['Cursusrooster',request.function=='courseTable',\
URL('calendar','courseTable',args=session.id)])
return None

What the code in the view should generate is:


  
Home
  
  
Whq

  
  
Agenda

  



What it does generate is:


  
Home
  
  
Whq

  
  
  
  
## ul with no class name

  Agenda
   

Re: [web2py] Help requested with jquery, bootstrap.modal and grid

2012-05-30 Thread Johann Spies
On Wednesday, 30 May 2012 19:07:06 UTC+2, pbreit wrote:
>
> I think opening a Bootstrap modal should be much easier:
> http://twitter.github.com/bootstrap/javascript.html#modals
>
>
> In a simple situation, yes it is easy.  I know that link and have used it 
in a case where there is one clickable DOM which, when clicked, will call 
up a modal.  In such a case I will put a LOAD in the target DIV which 
contains all the particulars needed to produce the content.

Now I am trying to use the bootstrap modal here where more than one row in 
a grid can contain the trigger (a 'represented' link)  to call up a modal 
window showing the result of a further query based on that row. 

That is what I have been trying to do in my code posted above.

Regards
Johann 



Re: [web2py] Re: recognizing web2py restart

2012-05-30 Thread David McKeone
Warning: I'm still new to python and web2py so this may be wacky, but...

Could you make a cached method with side-effects and an infinite expiry? 
 Since RAM would always be cleared on a restart it would theoretically only 
ever be run on cold start.

first_time = False
def first_start_check():
global first_time; first_time = True
return True

cache.ram('startup', lambda: first_start_check(), time_expire=None)
if first_time == True:
print "It's the first time!"


On Thursday, May 31, 2012 5:28:21 AM UTC+1, Jonathan Lundell wrote:
>
> On May 30, 2012, at 7:13 PM, Massimo Di Pierro wrote:
>
> you can make a cron job in admin @reboot
>
>
> It'd have to be soft cron, yes? And it wouldn't run until after my app 
> services its first request after restart, if I remember my soft cron logic 
> aright.
>
>
> On Wednesday, 30 May 2012 21:10:13 UTC-5, Jonathan Lundell wrote:
>>
>> I've got an application that uses memcached. I'd like to recognize when 
>> web2py gets restarted (mod_wsgi, fwiw) so I can flush my cache. No doubt I 
>> can figure something out, but I'm sure I must be missing something obvious. 
>> (My motivation: in my development environment, I sometimes blow away my 
>> database when installing and starting a new copy of the app, and things get 
>> confused when the cache is still holding data from the earlier run.)
>
>
>
>

Re: [web2py] Re: How to does post in RESTful

2012-05-30 Thread Sanjeet Roy
Can you help me with the example of this code with user authentication by
which i can get the user email which are given in web2py book :-


@request.restful()
def api():
response.view = 'generic.json'
def GET(tablename,id):
if not tablename=='person': raise HTTP(400)
return dict(person = db.person(id))
def POST(tablename,**fields):
if not tablename=='person': raise HTTP(400)
return db.person.validate_and_insert(**fields)
return locals()




On Thu, May 31, 2012 at 11:22 AM, Sanjeet Roy wrote:

> Anthony i tried the following code it is showing method not allowed when i
> want to access :-
>
> @auth.requires_login()
> @request.restful()
> def get_project():
> proj=[]
> projid=[]
> for row in
> db(db.assign.employee==auth.user.email).select(db.assign.ALL):
> for row1 in db(db.project.id==row.project).select(db.project.ALL):
> projid.append(row1.id)
> proj.append(row1.name)
> return dict(proj=proj,projid=projid)
>
>
> On Thu, May 31, 2012 at 10:52 AM, Anthony  wrote:
>
>> Are you saying you want to be able to login via a curl request? For that,
>> you'll probably have to enable basic authentication:
>> http://web2py.com/books/default/chapter/29/9#Access-Control-and-Basic-Authentication.
>> Once logged in, the user record should be available in auth.user.
>>
>> Anthony
>>
>>
>> On Thursday, May 31, 2012 12:36:08 AM UTC-4, Sanjeet Roy wrote:
>>>
>>> Hii Anthony
>>> I am able to POST and insert the data in to the database can you help me
>>> to get the user email who will be authenticated and i will get the data
>>> from the database which are associated with the particular user.
>>> example:-
>>> curl -u a...@gmail.com "http:127.0.0.1:8080/myapp/**
>>> api/getdata/proj/id/1/acty
>>> "
>>>
>>> I get the information of the proj by using his id by following code but
>>> how i get the user information who are loged-in.
>>>
>>> @auth.requires_login()
>>> @request.restful()
>>> def getdata():
>>> def GET(*args,**vars):
>>> patterns = "auto"
>>> parser = db.parse_as_rest(patterns,**args,vars)
>>> if parser.status == 200:
>>> return dict(content=parser.response)
>>> else:
>>> raise HTTP(parser.status,parser.**error)
>>> return locals()
>>>
>>>
>>>
>>> On Wed, May 30, 2012 at 9:51 AM, Sanjeet Roy wrote:
>>>
 Thanks Anthony now i got it and i am able to post the request by using
 the CURL


 On Wed, May 30, 2012 at 8:23 AM, Anthony  wrote:

> If you want to make a POST 
> request,
> you need some way to send the post data from a client. The client could be
> a browser, in which case you can send post data by submitting a form or by
> sending an Ajax POST request. The client could be another server, in which
> case, you can use something like urllib2.urlopen() in Python (
> http://docs.python.org/**library/urllib2.html)
> or the Linux curl command-line utility (http://www.yilmazhuseyin.com/*
> *blog/dev/curl-tutorial-**examples-usage/).
> You cannot make a POST request by simply visiting a URL in a browser --
> that will only result in a GET request.
>
> What exactly are you trying to do? How are you intending to make
> requests to this API?
>
> Anthony
>
>
> On Tuesday, May 29, 2012 10:29:06 PM UTC-4, Sanjeet Roy wrote:
>>
>> Hi Anthony actually i didn't get you i want ipost the data something
>> like that which are given in the following link :-
>>
>> http://www.mail-archive.com/**we**b...@googlegroups.com/**msg70275**
>> .html
>>
>> http://vimeo.com/21133657
>>
>> http://www.reddit.com/r/**progra**mming/comments/g5hxq/**web2py_**
>> trunk_has_a_new_**restful_api_**that_writes_db/**c1l2ykg
>>
>>
>> On Wed, May 30, 2012 at 1:09 AM, Anthony  wrote:
>>
>>> You could submit the post request via a form on the page, with the
>>> form's action set to the get_person URL, or you could submit via Ajax,
>>> possibly using jQuery.post() (see http://api.jquery.com/**jQu**
>>> ery.post/ ).
>>>
>>> Anthony
>>>
>>>
>>> On Tuesday, May 29, 2012 3:01:09 PM UTC-4, Sanjeet Roy wrote:

 Hii Anthony i have the following in my db:-

 db.define_table('person',**Field('name'),Field('**birthdate','*
 *da**te'))
 db.define_table('dog',Field('**name'),Field('owner',db.**
 person),Field('info','text'))

>>>

[web2py] Re: Pointing labels to input elements

2012-05-30 Thread Cédric Mayer
http://www.web2py.com/books/default/chapter/29/7#CSS-conventions should 
answer your request.

Le mercredi 30 mai 2012 03:32:16 UTC+2, James O'Neill a écrit :
>
> How do I get the generated ID for an input element when using 
> form.custom.widget.fieldname? I need to populate the FOR attribute on the 
> label element.
>


[web2py] deploy into GAE with python27

2012-05-30 Thread Ramkrishan Bhatt
How to deploy since GAE supported 27. i am getting error too many tables, 
what is that ?

[web2py] Re: tutorial code: recipes modifying it without success

2012-05-30 Thread Cédric Mayer
In the above controller, you refers to the variable request.vars.category, 
which refers to a POST or GET variable named "category"
So in your link you should have the same variable:
{{=A("recipes",_href=URL('recipes',vars=dict(*category*=
)))}}
You then replace  with a known category id.

Le mercredi 30 mai 2012 16:23:37 UTC+2, BlueShadow a écrit :
>
> Hi I think I took this code from one of massimos tutorial videos:
>
> def recipes():
> try:
> failtrial=int(request.vars.category)
> rows=db(db.recipes.category==request.vars.category).select(orderby
> =~db.recipes.submitted)
> except:
> rows=db().select(db.recipes.ALL, orderby=~db.recipes.submitted)
> 
> 
> form=SQLFORM(db.recipes,fields=['category'])
> return dict(form=form,recipes=rows)
>
>
>
> It displays (with the view file of course) a list of all recipes and a 
> form where you can choose a category if you choose one it desplays only the 
> ones from that category.
> I tried to modify it a little I like to add the functionallity to display 
> all recipes from a category but get there with a link.
> I thought this would be pretty easy just 
> use this line: {{=A("recipes",_href=URL(r=request,f='recipes',vars=dict(id=
> category.id)))}}
> but of course this doesn't work I tried a second try except block  with id=
> request.vars.id
> but that messes all up.
> Thanks for your help guys 
>


Re: [web2py] Re: How to does post in RESTful

2012-05-30 Thread Sanjeet Roy
Anthony i tried the following code it is showing method not allowed when i
want to access :-

@auth.requires_login()
@request.restful()
def get_project():
proj=[]
projid=[]
for row in
db(db.assign.employee==auth.user.email).select(db.assign.ALL):
for row1 in db(db.project.id==row.project).select(db.project.ALL):
projid.append(row1.id)
proj.append(row1.name)
return dict(proj=proj,projid=projid)

On Thu, May 31, 2012 at 10:52 AM, Anthony  wrote:

> Are you saying you want to be able to login via a curl request? For that,
> you'll probably have to enable basic authentication:
> http://web2py.com/books/default/chapter/29/9#Access-Control-and-Basic-Authentication.
> Once logged in, the user record should be available in auth.user.
>
> Anthony
>
>
> On Thursday, May 31, 2012 12:36:08 AM UTC-4, Sanjeet Roy wrote:
>>
>> Hii Anthony
>> I am able to POST and insert the data in to the database can you help me
>> to get the user email who will be authenticated and i will get the data
>> from the database which are associated with the particular user.
>> example:-
>> curl -u a...@gmail.com "http:127.0.0.1:8080/myapp/**
>> api/getdata/proj/id/1/acty
>> "
>>
>> I get the information of the proj by using his id by following code but
>> how i get the user information who are loged-in.
>>
>> @auth.requires_login()
>> @request.restful()
>> def getdata():
>> def GET(*args,**vars):
>> patterns = "auto"
>> parser = db.parse_as_rest(patterns,**args,vars)
>> if parser.status == 200:
>> return dict(content=parser.response)
>> else:
>> raise HTTP(parser.status,parser.**error)
>> return locals()
>>
>>
>>
>> On Wed, May 30, 2012 at 9:51 AM, Sanjeet Roy wrote:
>>
>>> Thanks Anthony now i got it and i am able to post the request by using
>>> the CURL
>>>
>>>
>>> On Wed, May 30, 2012 at 8:23 AM, Anthony  wrote:
>>>
 If you want to make a POST 
 request,
 you need some way to send the post data from a client. The client could be
 a browser, in which case you can send post data by submitting a form or by
 sending an Ajax POST request. The client could be another server, in which
 case, you can use something like urllib2.urlopen() in Python (
 http://docs.python.org/**library/urllib2.html)
 or the Linux curl command-line utility (http://www.yilmazhuseyin.com/**
 blog/dev/curl-tutorial-**examples-usage/).
 You cannot make a POST request by simply visiting a URL in a browser --
 that will only result in a GET request.

 What exactly are you trying to do? How are you intending to make
 requests to this API?

 Anthony


 On Tuesday, May 29, 2012 10:29:06 PM UTC-4, Sanjeet Roy wrote:
>
> Hi Anthony actually i didn't get you i want ipost the data something
> like that which are given in the following link :-
>
> http://www.mail-archive.com/**we**b...@googlegroups.com/**msg70275**
> .html
>
> http://vimeo.com/21133657
>
> http://www.reddit.com/r/**progra**mming/comments/g5hxq/**web2py_**
> trunk_has_a_new_**restful_api_**that_writes_db/**c1l2ykg
>
>
> On Wed, May 30, 2012 at 1:09 AM, Anthony  wrote:
>
>> You could submit the post request via a form on the page, with the
>> form's action set to the get_person URL, or you could submit via Ajax,
>> possibly using jQuery.post() (see http://api.jquery.com/**jQu**
>> ery.post/ ).
>>
>> Anthony
>>
>>
>> On Tuesday, May 29, 2012 3:01:09 PM UTC-4, Sanjeet Roy wrote:
>>>
>>> Hii Anthony i have the following in my db:-
>>>
>>> db.define_table('person',**Field('name'),Field('**birthdate','**
>>> da**te'))
>>> db.define_table('dog',Field('**name'),Field('owner',db.**person)
>>> ,Field('info','text'))
>>>
>>> and api.py is my controller :-
>>>
>>> @request.restful()
>>> def get_person():
>>> def GET(id):
>>> person = db.person(id)
>>> return person.as_dict() if person else None
>>> def POST(owner,name,info):
>>> return db.dog.validate_and_insert(**own
>>> er=owner,name=name,info=**info)
>>> return locals()
>>>
>>
> How can i post and insert the data in to the table dog which are given
> above .
>
> like that :-
>
>  curl -i -d 
> "info=aInfo&name=aName&owner=**7**4"http://localhost:8000/**restfu**l/api/manage_dog
>  

[web2py] Re: Validator for self reference field not referring to itself

2012-05-30 Thread Cédric Mayer
1) You may have problems if you open your application in another language:
Field('gender', requires= IS_IN_SET([T('Male'), T('Female')], 
zero=T('choose one'))),
should be
Field('gender', requires= IS_IN_SET([('Male',T('Male')), 
('Female',T('Female'))], zero=T('choose one'))),

2) The requirement over "father" or "mother" may be broader that you can 
think of (maybe the father should not also be one of the person's 
descendant (-: )
3) The problem with a custom validator is that it takes only one argument, 
which is the given value.
4) What you can do is to check this restriction after form processing:
form = SQLFORM(db.person, record, deletable=True)
form.process(...)
if form.accepted and form.vars.id == record.father:
form.errors['father'] = T('This person cannot be his own father...')
form.accepted = False
(do the same for mother)
if form.accepted:
...


Le mercredi 30 mai 2012 14:22:32 UTC+2, lcamara a écrit :
>
> Hey,
>
> I'm trying to validate some things on a self reference field, among them 
> that a reference field on a table does not refer to the record where it is.
>
> For instance,
>
> db.define_table('person',
> Field('name', length=256, unique=True, requires=IS_NOT_EMPTY()),
> Field('gender', requires= IS_IN_SET([T('Male'), T('Female')], 
> zero=T('choose one'))),
> Field('father', 'reference person'),
> Field('mother', 'reference person'),
> format = '%(name)s'
> )
>
> db.person.father.requires = IS_EMPTY_OR(IS_IN_DB(db(db.person.gender == 
> 'Male'), db.person.id, '%(name)s', zero=T('choose one'))) 
> db.person.mother.requires = IS_EMPTY_OR(IS_IN_DB(db(db.person.gender == 
> 'Female'), db.person.id, '%(name)s', zero=T('choose one')))
>
> So in addition to the gender restriction (yeah I know it's not always 
> true, this is just an example), I'd like to add the restriction that a 
> person cannot be it's own father or mother.
> Basically what I want is something like an IS_NOT_SELF or something.
>
> Any tips on how to go about this?
>


Re: [web2py] Re: How to does post in RESTful

2012-05-30 Thread Anthony
Are you saying you want to be able to login via a curl request? For that, 
you'll probably have to enable basic authentication: 
http://web2py.com/books/default/chapter/29/9#Access-Control-and-Basic-Authentication.
 
Once logged in, the user record should be available in auth.user.

Anthony

On Thursday, May 31, 2012 12:36:08 AM UTC-4, Sanjeet Roy wrote:
>
> Hii Anthony
> I am able to POST and insert the data in to the database can you help me 
> to get the user email who will be authenticated and i will get the data 
> from the database which are associated with the particular user.
> example:-
> curl -u a...@gmail.com "http:
> 127.0.0.1:8080/myapp/api/getdata/proj/id/1/acty"
>
> I get the information of the proj by using his id by following code but 
> how i get the user information who are loged-in.
>
> @auth.requires_login()
> @request.restful()
> def getdata():
> def GET(*args,**vars): 
> patterns = "auto"
> parser = db.parse_as_rest(patterns,args,vars)
> if parser.status == 200:
> return dict(content=parser.response)
> else:
> raise HTTP(parser.status,parser.error)
> return locals()
>
>
>
> On Wed, May 30, 2012 at 9:51 AM, Sanjeet Roy wrote:
>
>> Thanks Anthony now i got it and i am able to post the request by using 
>> the CURL
>>
>>
>> On Wed, May 30, 2012 at 8:23 AM, Anthony  wrote:
>>
>>> If you want to make a POST 
>>> request, 
>>> you need some way to send the post data from a client. The client could be 
>>> a browser, in which case you can send post data by submitting a form or by 
>>> sending an Ajax POST request. The client could be another server, in which 
>>> case, you can use something like urllib2.urlopen() in Python (
>>> http://docs.python.org/library/urllib2.html) or the Linux curlcommand-line 
>>> utility (
>>> http://www.yilmazhuseyin.com/blog/dev/curl-tutorial-examples-usage/). 
>>> You cannot make a POST request by simply visiting a URL in a browser -- 
>>> that will only result in a GET request.
>>>
>>> What exactly are you trying to do? How are you intending to make 
>>> requests to this API?
>>>
>>> Anthony
>>>
>>>
>>> On Tuesday, May 29, 2012 10:29:06 PM UTC-4, Sanjeet Roy wrote:

 Hi Anthony actually i didn't get you i want ipost the data something 
 like that which are given in the following link :-

 http://www.mail-archive.com/**web2py@googlegroups.com/**msg70275.html

 http://vimeo.com/21133657

 http://www.reddit.com/r/**programming/comments/g5hxq/**
 web2py_trunk_has_a_new_**restful_api_that_writes_db/**c1l2ykg


 On Wed, May 30, 2012 at 1:09 AM, Anthony  wrote:

> You could submit the post request via a form on the page, with the 
> form's action set to the get_person URL, or you could submit via Ajax, 
> possibly using jQuery.post() (see 
> http://api.jquery.com/**jQuery.post/
> ).
>
> Anthony
>
>
> On Tuesday, May 29, 2012 3:01:09 PM UTC-4, Sanjeet Roy wrote:
>>
>> Hii Anthony i have the following in my db:-
>>
>> db.define_table('person',**Field**('name'),Field('**birthdate','**
>> date'))
>> db.define_table('dog',Field('**n**ame'),Field('owner',db.**person)**
>> ,Field('info','text'))
>>
>> and api.py is my controller :-
>>
>> @request.restful()
>> def get_person():
>> def GET(id):
>> person = db.person(id)
>> return person.as_dict() if person else None
>> def POST(owner,name,info):
>> return db.dog.validate_and_insert(**own**
>> er=owner,name=name,info=**info)
>> return locals()
>>
>
 How can i post and insert the data in to the table dog which are given 
 above . 

 like that :-

  curl -i -d 
 "info=aInfo&name=aName&owner=**74"http://localhost:8000/**restful/api/manage_dog
  


 which are given in the above link.

  
>>
>

[web2py] Re: mydomain.com/#!/ detect and redirect

2012-05-30 Thread Annet
Thank you all for your replies. Problem solved!

Kind regards,

Annet


Re: [web2py] Re: How to does post in RESTful

2012-05-30 Thread Sanjeet Roy
Hii Anthony
I am able to POST and insert the data in to the database can you help me to
get the user email who will be authenticated and i will get the data from
the database which are associated with the particular user.
example:-
curl -u a...@gmail.com "http:127.0.0.1:8080/myapp/api/getdata/proj/id/1/acty"

I get the information of the proj by using his id by following code but how
i get the user information who are loged-in.

@auth.requires_login()
@request.restful()
def getdata():
def GET(*args,**vars):
patterns = "auto"
parser = db.parse_as_rest(patterns,args,vars)
if parser.status == 200:
return dict(content=parser.response)
else:
raise HTTP(parser.status,parser.error)
return locals()



On Wed, May 30, 2012 at 9:51 AM, Sanjeet Roy wrote:

> Thanks Anthony now i got it and i am able to post the request by using the
> CURL
>
>
> On Wed, May 30, 2012 at 8:23 AM, Anthony  wrote:
>
>> If you want to make a POST 
>> request,
>> you need some way to send the post data from a client. The client could be
>> a browser, in which case you can send post data by submitting a form or by
>> sending an Ajax POST request. The client could be another server, in which
>> case, you can use something like urllib2.urlopen() in Python (
>> http://docs.python.org/library/urllib2.html) or the Linux curlcommand-line 
>> utility (
>> http://www.yilmazhuseyin.com/blog/dev/curl-tutorial-examples-usage/).
>> You cannot make a POST request by simply visiting a URL in a browser --
>> that will only result in a GET request.
>>
>> What exactly are you trying to do? How are you intending to make requests
>> to this API?
>>
>> Anthony
>>
>>
>> On Tuesday, May 29, 2012 10:29:06 PM UTC-4, Sanjeet Roy wrote:
>>>
>>> Hi Anthony actually i didn't get you i want ipost the data something
>>> like that which are given in the following link :-
>>>
>>> http://www.mail-archive.com/**web2py@googlegroups.com/**msg70275.html
>>>
>>> http://vimeo.com/21133657
>>>
>>> http://www.reddit.com/r/**programming/comments/g5hxq/**
>>> web2py_trunk_has_a_new_**restful_api_that_writes_db/**c1l2ykg
>>>
>>>
>>> On Wed, May 30, 2012 at 1:09 AM, Anthony  wrote:
>>>
 You could submit the post request via a form on the page, with the
 form's action set to the get_person URL, or you could submit via Ajax,
 possibly using jQuery.post() (see 
 http://api.jquery.com/**jQuery.post/
 ).

 Anthony


 On Tuesday, May 29, 2012 3:01:09 PM UTC-4, Sanjeet Roy wrote:
>
> Hii Anthony i have the following in my db:-
>
> db.define_table('person',**Field**('name'),Field('**birthdate','**
> date'))
> db.define_table('dog',Field('**n**ame'),Field('owner',db.**person)**
> ,Field('info','text'))
>
> and api.py is my controller :-
>
> @request.restful()
> def get_person():
> def GET(id):
> person = db.person(id)
> return person.as_dict() if person else None
> def POST(owner,name,info):
> return db.dog.validate_and_insert(**own**
> er=owner,name=name,info=**info)
> return locals()
>

>>> How can i post and insert the data in to the table dog which are given
>>> above .
>>>
>>> like that :-
>>>
>>>  curl -i -d 
>>> "info=aInfo&name=aName&owner=**74"http://localhost:8000/**restful/api/manage_dog
>>>  
>>>
>>>
>>> which are given in the above link.
>>>
>>>
>


Re: [web2py] Re: recognizing web2py restart

2012-05-30 Thread Jonathan Lundell
On May 30, 2012, at 7:13 PM, Massimo Di Pierro wrote:
> you can make a cron job in admin @reboot

It'd have to be soft cron, yes? And it wouldn't run until after my app services 
its first request after restart, if I remember my soft cron logic aright.

> 
> On Wednesday, 30 May 2012 21:10:13 UTC-5, Jonathan Lundell wrote:
> I've got an application that uses memcached. I'd like to recognize when 
> web2py gets restarted (mod_wsgi, fwiw) so I can flush my cache. No doubt I 
> can figure something out, but I'm sure I must be missing something obvious. 
> (My motivation: in my development environment, I sometimes blow away my 
> database when installing and starting a new copy of the app, and things get 
> confused when the cache is still holding data from the earlier run.)




Re: [web2py] cool new wysiwyg editor

2012-05-30 Thread Anthony
On Wednesday, May 30, 2012 5:16:56 PM UTC-4, Vasile Ermicioi wrote:
>
> about redactorjs 
>
> http://redactorjs.com/download/ 
>
> You are *free* to use Redactor for your personal or non-profit website 
> projects. 
> You can get the author's permission to use Redactor for commercial 
> websites by paying a fee.
>

It's not too expensive, though -- only $18.50 USD.

Anthony 


[web2py] Re: Filter select options

2012-05-30 Thread Anthony
Note, the default IS_IN_DB validator for a reference field also sets the 
label argument of the validator to be the _format attribute of the 
referenced table (so the select will show a more descriptive field or set 
of fields from the referenced table rather than just the record number). If 
you're overriding the default validator, you'll need to explicitly specify 
the label argument as well. Assuming the reference is to the auth_user 
table, something like:

db.table.field.requires = IS_IN_DB(db(query), 'auth_user.id', 
db.auth_user._format)

If you don't like the default auth_user format, you can specify a custom 
format (e.g., '%(last_name)s, %(first_name)s').

Anthony

On Wednesday, May 30, 2012 6:41:58 PM UTC-4, Rod Watkins wrote:
>
> RTM, eh. I didn't think to look at the IS_IN_DB validator for this. In 
> fact, I didn't even have one as I was relying on the default. Thanks!!
>
> On Wednesday, 30 May 2012 13:55:35 UTC-7, Niphlod wrote:
>>
>> IS_IN_DB takes also a queryset .
>> Directly from http://web2py.com/books/default/chapter/29/7
>>
>> query = (db.table.field == 'xyz') #in practice 'xyz' would be a variable
>> db.table.field.requires=IS_IN_DB(db(query),)
>>
>>
>> put that before calling SQLFORM and voilà.
>>
>>
>> Il giorno mercoledì 30 maggio 2012 22:47:33 UTC+2, Rod Watkins ha scritto:
>>>
>>> Hello everyone,
>>>
>>> I have a quick question.
>>>
>>> I am using the SQLFORM tool and creating a form using the generated 
>>> custom widgets. One part of the form allows a one to choose a user from a 
>>> select list (the table has a reference to auth_user). I'd like to limit the 
>>> options shown in the select list to only those users who are a member  of a 
>>> specific group. Is there a way to apply a filter to restrict the users 
>>> added to the select widget?? 
>>>
>>> Rod
>>>
>>

[web2py] simple pulldown list behaving like a multi-list

2012-05-30 Thread weheh
I have a field named category:
db.define_table('mytab',
Field('categ', db.categ, label=T('Category'),
default=12,
requires=IS_IN_DB(db, 'categ.id', '%(name)s', zero=None),
),

I create a dynamic form for this field, whose value is submitted by ajax:
form = SQLFORM.factory(db.mytab, record=db.mytab[id])
form.element('select#no_table_categ')['_onchange'] = (
'ajax("%s",["categ"],":eval");' % URL(c='mycontroller', 
f='cb_update_categ'))

and the form's category field is rendered by form.custom.widget.categ.

I get a pulldown menu of categories, as desired. This is not rendered as a 
multi-list, nor is a multi-list desired. So far, so good. 

However, upon change, what gets passed to the cb_update_categ() action is 
not a single value but a list of values. This is not expected. Only 1 value 
is expected.

Can anyone explain why this would be happening?



Re: [web2py] replacing router.example.py or routes.example.py

2012-05-30 Thread Anthony

>
> From what you are saying *router.py* shouldn't be there or is obsolete  
> I am using the system for the first time I was assume it was there for a 
> reason.
>

web2py does not come with a router.py file. If you have one, you (or 
someone else) must have put it there.

Anthony 


Re: [web2py] replacing router.example.py or routes.example.py

2012-05-30 Thread Anthony

>
> You want to pick which router to use, and copy its example file to 
> routes.py. The name router.example.py is misleading in that respect, and 
> there's been some discussion of changing the names, but it's embedded in a 
> lot of documentation, so it has some inertia.
>

I've been lobbying to change the name for a while. Massimo wants to wait 
until the next edition of the book (I suppose in the Fall), since the 
current edition refers to router.example.py. We'll probably forget and then 
have to wait another year. ;-)

Anthony


[web2py] Re: GrooverWiki seems to be broken

2012-05-30 Thread Adi
thanks Massimo for this tip... 

I used the blob field to store AES encrypted Credit Card, and everything 
worked fine to store it but when I was reading records from the table I was 
getting this error: 
File 
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/base64.py",
 
line 76, in b64decode
TypeError: Incorrect padding

Once I changed the field from blob to text the problem went away... 


On Wednesday, September 21, 2011 1:21:38 PM UTC-4, Massimo Di Pierro wrote:
>
> I suspect you store something into a text field than changed the type 
> to blob. web2py expects blob data to be store b64encoded. If it was 
> stored when the field was a text, it was not encoded. 
>
> On Sep 21, 11:12 am, Guy Nesher  wrote: 
> > sqlite, is that an issue ? 
> > 
> > On Sep 21, 4:55 pm, Massimo Di Pierro  
> > wrote: 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > > which db server? 
> > 
> > > On Sep 21, 7:19 am, Guy Nesher  wrote: 
> > 
> > > > Just tried to do a fresh install of GrooverWiki, the install works 
> > > > fine but when I try to run it I get the following error : 
> > 
> > > > Traceback (most recent call last): 
> > > >   File "/var/web2py/gluon/restricted.py", line 192, in restricted 
> > > > exec ccode in environment 
> > > >   File "/var/web2py/applications/wiki/controllers/default.py", line 
> > > > 148, in  
> > > >   File "/var/web2py/gluon/globals.py", line 145, in  
> > > > self._caller = lambda f: f() 
> > > >   File "/var/web2py/applications/wiki/controllers/default.py", line 
> > > > 11, in show_page 
> > > > curr_page=db().select(db.WikiPage.ALL)[0] 
> > > >   File "/var/web2py/gluon/dal.py", line 5481, in select 
> > > > return self.db._adapter.select(self.query,fields,attributes) 
> > > >   File "/var/web2py/gluon/dal.py", line 1192, in select 
> > > > return self.parse(rows,self._colnames) 
> > > >   File "/var/web2py/gluon/dal.py", line 1421, in parse 
> > > > colset[fieldname] = base64.b64decode(str(value)) 
> > > >   File "/usr/lib/python2.6/base64.py", line 76, in b64decode 
> > > > raise TypeError(msg) 
> > > > TypeError: Incorrect padding 
> > 
> > > > I'm sure its something really silly, but I just can't figure what.



Re: [web2py] replacing router.example.py or routes.example.py

2012-05-30 Thread Horus
understood!

On Wednesday, May 30, 2012 10:13:43 PM UTC-4, Jonathan Lundell wrote:
>
> On May 30, 2012, at 7:08 PM, Horus wrote:
>
> I have attached a screenshot to show you what i am seeing. 
>
> I  started python 4 weeks ago and web2py for the last 2 so this 
> is completely new to me.
> I downloaded a windows copy in this copy there are the two 
> files I mentioned
>
> I got it to work after restarting web2py as you had pointed out
>
> From what you are saying *router.py* shouldn't be there or is obsolete  
> I am using the system for the first time I was assume it was there for a 
> reason.
>
>
> There are two flavors of the routing logic. The older and more general one 
> is a regex-based pattern-matching router, and it has an example in 
> routes.example.py. There's a newer parametric router that's much easier 
> to configure, but not quite as general. It has an example in 
> router.example.py. 
>
> You want to pick which router to use, and copy its example file to 
> routes.py. The name router.example.py is misleading in that respect, and 
> there's been some discussion of changing the names, but it's embedded in a 
> lot of documentation, so it has some inertia.
>


Re: [web2py] Re: recognizing web2py restart

2012-05-30 Thread Jonathan Lundell
On May 30, 2012, at 7:13 PM, Massimo Di Pierro wrote:
> you can make a cron job in admin @reboot

I'll look at that, thanks. 

> 
> On Wednesday, 30 May 2012 21:10:13 UTC-5, Jonathan Lundell wrote:
> I've got an application that uses memcached. I'd like to recognize when 
> web2py gets restarted (mod_wsgi, fwiw) so I can flush my cache. No doubt I 
> can figure something out, but I'm sure I must be missing something obvious. 
> (My motivation: in my development environment, I sometimes blow away my 
> database when installing and starting a new copy of the app, and things get 
> confused when the cache is still holding data from the earlier run.)




Re: [web2py] replacing router.example.py or routes.example.py

2012-05-30 Thread Jonathan Lundell
On May 30, 2012, at 7:08 PM, Horus wrote:
> I have attached a screenshot to show you what i am seeing. 
> 
> I  started python 4 weeks ago and web2py for the last 2 so this is completely 
> new to me.
> I downloaded a windows copy in this copy there are the two files I mentioned
> 
> I got it to work after restarting web2py as you had pointed out
> 
> From what you are saying router.py shouldn't be there or is obsolete  
> I am using the system for the first time I was assume it was there for a 
> reason.

There are two flavors of the routing logic. The older and more general one is a 
regex-based pattern-matching router, and it has an example in 
routes.example.py. There's a newer parametric router that's much easier to 
configure, but not quite as general. It has an example in router.example.py. 

You want to pick which router to use, and copy its example file to routes.py. 
The name router.example.py is misleading in that respect, and there's been some 
discussion of changing the names, but it's embedded in a lot of documentation, 
so it has some inertia.

[web2py] Re: recognizing web2py restart

2012-05-30 Thread Massimo Di Pierro
you can make a cron job in admin @reboot

On Wednesday, 30 May 2012 21:10:13 UTC-5, Jonathan Lundell wrote:
>
> I've got an application that uses memcached. I'd like to recognize when 
> web2py gets restarted (mod_wsgi, fwiw) so I can flush my cache. No doubt I 
> can figure something out, but I'm sure I must be missing something obvious. 
> (My motivation: in my development environment, I sometimes blow away my 
> database when installing and starting a new copy of the app, and things get 
> confused when the cache is still holding data from the earlier run.)



[web2py] Re: Web2Py + library.zip

2012-05-30 Thread Massimo Di Pierro
You must be using the binary distribution. If you use the source 
distribution there is a web2py/gluon/ folder.

On Wednesday, 30 May 2012 20:00:32 UTC-5, Horus wrote:
>
> I have been going through the book and I have been seeing gluon imports.
> Don't say this is crazy but is Web2Py Pulling from this library.zip, this 
> is where the gluon import are coming from?



[web2py] recognizing web2py restart

2012-05-30 Thread Jonathan Lundell
I've got an application that uses memcached. I'd like to recognize when web2py 
gets restarted (mod_wsgi, fwiw) so I can flush my cache. No doubt I can figure 
something out, but I'm sure I must be missing something obvious. (My 
motivation: in my development environment, I sometimes blow away my database 
when installing and starting a new copy of the app, and things get confused 
when the cache is still holding data from the earlier run.)

Re: [web2py] replacing router.example.py or routes.example.py

2012-05-30 Thread Jonathan Lundell
On May 30, 2012, at 6:20 PM, Horus wrote:
> Additionally, if routes.py is the main file what is the purpose of router.py?

There is no router.py. router.example.py gets renamed to routes.py.

> 
> On Wednesday, May 30, 2012 9:07:40 PM UTC-4, Jonathan Lundell wrote:
> On May 30, 2012, at 5:56 PM, Horus wrote:
>> #1 I am assuming that when you replace  router.example.py or 
>> routes.example.py with  router.py or routes.py, respectively, in the base 
>> folder they should take over?
> 
> No, always routes.py.
> 
>> #2 Can they be added to app folder? if they are added will they take 
>> precedence ?
> 
> There needs to be a routes.py at the web2py root, necessary to route to an 
> app. Then there can be additional copies in the app folder that will override 
> for that app.




Re: [web2py] replacing router.example.py or routes.example.py

2012-05-30 Thread Jonathan Lundell
On May 30, 2012, at 6:13 PM, Horus wrote:
> I removed the .example from routes.example.py to make it routes.py, changed 
> the values but noting happened?

You need to reload the routing information. The easiest way is to restart 
web2py, though you can also do it through the admin app.

> On Wednesday, May 30, 2012 9:07:40 PM UTC-4, Jonathan Lundell wrote:
> On May 30, 2012, at 5:56 PM, Horus wrote:
>> #1 I am assuming that when you replace  router.example.py or 
>> routes.example.py with  router.py or routes.py, respectively, in the base 
>> folder they should take over?
> 
> No, always routes.py.
> 
>> #2 Can they be added to app folder? if they are added will they take 
>> precedence ?
> 
> There needs to be a routes.py at the web2py root, necessary to route to an 
> app. Then there can be additional copies in the app folder that will override 
> for that app.




Re: [web2py] replacing router.example.py or routes.example.py

2012-05-30 Thread Horus

Additionally, if routes.py is the main file what is the purpose of 
router.py?

On Wednesday, May 30, 2012 9:07:40 PM UTC-4, Jonathan Lundell wrote:
>
> On May 30, 2012, at 5:56 PM, Horus wrote:
>
> #1 I am assuming that when you replace  router.example.py or 
> routes.example.py with  router.py or routes.py, respectively, in the base 
> folder they should take over?
>
>
> No, always routes.py.
>
> #2 Can they be added to app folder? if they are added will they take 
> precedence ?
>
>
> There needs to be a routes.py at the web2py root, necessary to route to an 
> app. Then there can be additional copies in the app folder that will 
> override for that app.
>


Re: [web2py] replacing router.example.py or routes.example.py

2012-05-30 Thread Horus
I removed the .example from routes.example.py to make it routes.py, changed 
the values but noting happened?


On Wednesday, May 30, 2012 9:07:40 PM UTC-4, Jonathan Lundell wrote:
>
> On May 30, 2012, at 5:56 PM, Horus wrote:
>
> #1 I am assuming that when you replace  router.example.py or 
> routes.example.py with  router.py or routes.py, respectively, in the base 
> folder they should take over?
>
>
> No, always routes.py.
>
> #2 Can they be added to app folder? if they are added will they take 
> precedence ?
>
>
> There needs to be a routes.py at the web2py root, necessary to route to an 
> app. Then there can be additional copies in the app folder that will 
> override for that app.
>


Re: [web2py] replacing router.example.py or routes.example.py

2012-05-30 Thread Jonathan Lundell
On May 30, 2012, at 5:56 PM, Horus wrote:
> #1 I am assuming that when you replace  router.example.py or 
> routes.example.py with  router.py or routes.py, respectively, in the base 
> folder they should take over?

No, always routes.py.

> #2 Can they be added to app folder? if they are added will they take 
> precedence ?

There needs to be a routes.py at the web2py root, necessary to route to an app. 
Then there can be additional copies in the app folder that will override for 
that app.

[web2py] Web2Py + library.zip

2012-05-30 Thread Horus
I have been going through the book and I have been seeing gluon imports.
Don't say this is crazy but is Web2Py Pulling from this library.zip, this 
is where the gluon import are coming from?

[web2py] replacing router.example.py or routes.example.py

2012-05-30 Thread Horus
#1 I am assuming that when you replace  router.example.py or 
routes.example.py with  router.py or routes.py, respectively, in the base 
folder they should take over?
#2 Can they be added to app folder? if they are added will they take 
precedence ?

I am not finding a lot about this online

[web2py] Re: Welcome app / AddToAny integration question

2012-05-30 Thread Massimo Di Pierro
Good point. I found it useful. We can remove it.

On Wednesday, 30 May 2012 19:15:02 UTC-5, pbreit wrote:
>
> Agree. I constantly mouse-over it accidentally and can't imagine ever 
> actually using it.
>
> On Wednesday, May 30, 2012 3:03:09 PM UTC-7, Omi Chiba wrote:
>>
>> I was thinking the same. It's a little bit annoying.
>>
>> On Wednesday, May 30, 2012 4:22:02 PM UTC-5, Chris May wrote:
>>>
>>> More of a curiosity on my part, but why does web2py promote AddToAny (by 
>>> automatically including it with every new application)?
>>>
>>> Sure, it's easy enough to remove, but why is it in there in the first 
>>> place?
>>>
>>

[web2py] Re: Welcome app / AddToAny integration question

2012-05-30 Thread pbreit
Agree. I constantly mouse-over it accidentally and can't imagine ever 
actually using it.

On Wednesday, May 30, 2012 3:03:09 PM UTC-7, Omi Chiba wrote:
>
> I was thinking the same. It's a little bit annoying.
>
> On Wednesday, May 30, 2012 4:22:02 PM UTC-5, Chris May wrote:
>>
>> More of a curiosity on my part, but why does web2py promote AddToAny (by 
>> automatically including it with every new application)?
>>
>> Sure, it's easy enough to remove, but why is it in there in the first 
>> place?
>>
>

[web2py] Re: Anyone using BootSwatch with new web2py layout

2012-05-30 Thread Paolo Caruccio
Andrew,

we aren't changing bootstrap.css, but only bootswatch.css. This last file 
is necessary to override some css rules from web2py.css incompatible with 
bootstrap.css

Please, try a bootswatch theme and let me know if you see any error.
   

Il giorno giovedì 31 maggio 2012 00:36:51 UTC+2, Andrew ha scritto:
>
> Thanks LightDot,
> I thought it may have been a feature, so just my opinion, I think the non 
> button look was better.   It looks more consistent with the other links in 
> the navbar, and other Bootstrap menus.
>
> So, do we keep the buttons, or change it back ?  
>
> With regards to Paolo's reply below, I don't mind changing the layout 
> file, but we shouldn't change the bootstrap.css (in my opinion).  You then 
> lose the ability to simply swap it out for another bootswatch's css file.
>
> Keep up the good work, it's looking great and I can't wait for 2.0 !
>
>
>
> On Wednesday, May 30, 2012 11:56:33 PM UTC+12, LightDot wrote:
>>
>> I believe this is an unrelated change, a case of "it's not a bug, it's a 
>> feature"... It defaults to look like buttons in all browsers now.
>>
>> You could change this back, of course, or even propose to web2py to have 
>> the old defaults back...
>>
>> Regards
>>
>> On Wednesday, May 30, 2012 7:42:07 AM UTC+2, Andrew wrote:
>>>
>>> Thanks Paolo,
>>> The layout is back to normal.  However the Login set of links are 
>>> looking like buttons, rather than the background being the same as the 
>>> navbar.  This is the same in the two browsers I'm looking at (IE7 and 
>>> Firefox).
>>>
>>> I prefer the way it looked in firefox.  Does it need to be a set 
>>> background to work ?
>>>
>>>
>>>
>>>
>>> On Tuesday, May 29, 2012 7:33:50 AM UTC+12, Paolo Caruccio wrote:

 Andrew,

 I, just now, proposed a patch through issue tracker (
 http://code.google.com/p/web2py/issues/detail?id=824) that should 
 resolve the problems with IE7 noted by you. Moreover the auth_navbar is 
 more compliant with bootstrap (check the image). I tested the new welcome 
 layout replacing the default web2py bootstrap.min.css with some from 
 bootswatch and it seems work good now. 

>>>

[web2py] Re: Web2py and XMPP

2012-05-30 Thread Román Torres
We are doing something similar to a social network with multiple plataforms 
(encyclopedia, dictionary, forums, rol system and so much more, all this 
multilanguage). And now we need to create a chat. 
A chat similar to Facebooks chat or Google Talk and mixed with IRC... 
Chatrooms, private (person 2 person) chat and group chat is what we need.

I tried with websockets, but my boss told me that he prefers to use 
Jabber/XMPP, and now Im investigating how it works.
Now I just can do a simple client, but I need help with the server and the 
web2py integration.
Thats all. I cannot find simple documentation, and for that reason I need 
help.

Thanks for all.

El miércoles, 30 de mayo de 2012 00:49:56 UTC+2, Román Torres escribió:
>
> Hi everybody.
>
> Im on a big project, and now I need to do a chat on web2py (with python 
> and XMPP). I cant find any documentation or reference to understand it.
>
> I need some help to know how I do my own server (without installing things 
> like Apache if its possible, because my web2py page is working with 
> Rocket), how to do my own client.
>
> Can anyone guide me a bit?
>
> Thanks.
>


[web2py] Re: Filter select options

2012-05-30 Thread Rod Watkins
RTM, eh. I didn't think to look at the IS_IN_DB validator for this. In 
fact, I didn't even have one as I was relying on the default. Thanks!!

On Wednesday, 30 May 2012 13:55:35 UTC-7, Niphlod wrote:
>
> IS_IN_DB takes also a queryset .
> Directly from http://web2py.com/books/default/chapter/29/7
>
> query = (db.table.field == 'xyz') #in practice 'xyz' would be a variable
> db.table.field.requires=IS_IN_DB(db(query),)
>
>
> put that before calling SQLFORM and voilà.
>
>
> Il giorno mercoledì 30 maggio 2012 22:47:33 UTC+2, Rod Watkins ha scritto:
>>
>> Hello everyone,
>>
>> I have a quick question.
>>
>> I am using the SQLFORM tool and creating a form using the generated 
>> custom widgets. One part of the form allows a one to choose a user from a 
>> select list (the table has a reference to auth_user). I'd like to limit the 
>> options shown in the select list to only those users who are a member  of a 
>> specific group. Is there a way to apply a filter to restrict the users 
>> added to the select widget?? 
>>
>> Rod
>>
>

[web2py] Re: Deploy issue - Apache on Windows - Unable to import driver

2012-05-30 Thread Andrew
No, 32 bit.   XP (would you believe, It's a work computer !).


On Thursday, May 31, 2012 2:09:40 AM UTC+12, Omi Chiba wrote:
>
> Are you using 64bit environment ?
> I remember I got the error when I tried with python 64bit or something. If 
> you are using 64bit, try 32bit and it should work.  
>
> On Wednesday, May 30, 2012 12:57:03 AM UTC-5, Andrew wrote:
>>
>> The Uniform Server option looks very interesting, as does the newer 
>> apache version (I'm trying both).
>>
>> I'm now stuck with the same issue with both Uniform Server and straight 
>> Apache, which is when starting apache or running Uniform "Apache Syntax 
>> Check":
>> Syntax error on line 197 of .../httpd.conf:  Cannot load 
>> /modules/mod_wsgi.so into server.
>>
>> Line 197 is LoadModule wsgi_module modules/mod_wsgi.so
>>
>>
>> I've downloaded the right files (I think) and followed the instructions.  
>> It is in the right spot.   This issue is readily found on various forums so 
>> I am now downloading the source code and attempting to recompile 
>> mod_wsgi.so.  Don't know why but there is an issue when Python is installed 
>> in a non standard path - not sure if that is my issue, but I'll soon find 
>> out.
>>
>>
>> On Wednesday, May 30, 2012 1:37:58 AM UTC+12, Omi Chiba wrote:
>>>
>>> Brian,
>>>
>>> Thank you for the info ! I also added the information on my blog.
>>>
>>> On Friday, May 25, 2012 7:32:23 PM UTC-5, Brian M wrote:

 Yep, got burned by this when setting up a new server last month. The 
 problem is covered in the pyodbc issue tracker here -  
 http://code.google.com/p/pyodbc/issues/detail?id=126 I ended up 
 grabbing a build from  http://www.apachelounge.com/download/additional/ 
 and 
 then all was good.

 On Friday, May 25, 2012 12:08:59 AM UTC-5, Andrew wrote:
>
> Oh, Just found this post, which was linked in Omi Chiba's original 
> Blog post:
> https://groups.google.com/forum/?fromgroups#!topic/web2py/EM5Q3yOz63M
>
> From dlypka:
> The root cause is that the Distribution Windows Build of Apache 2.2 is 
> built with msvcr71.dll which is the C++ runtime dll 
> for Visual Studio 2003!!! But, most recent builds of python .pyd files 
> which link to C/C++ code, are built with msvcr90.dll which is the one 
> from Visual Studio 2008.
>
> Summary:   There is an issue running pyodbc with apache2.2 on 
> Windows.   
> Solution:  Build Apache yourself with Visual Studio 2008, or use IIS.
>
> Oh well.  
>
>
> On Friday, May 25, 2012 4:54:23 PM UTC+12, Andrew wrote:
>>
>> It is installed and the app has been working fine with the Rocket 
>> http server.  It's just the apache one that doesn't.   Unless I need to 
>> install it again in the apache context ? 
>>
>> On Friday, May 25, 2012 4:05:27 PM UTC+12, Massimo Di Pierro wrote:
>>>
>>> You need to install pyodbc
>>>
>>> On Thursday, 24 May 2012 19:41:21 UTC-5, Andrew wrote:

 Hello,
 I'm in the process of running web2py on Apache for the first time.  
 I found some excellent tutorials on this, such as: 
 http://ochiba77.blogspot.co.nz/2011/10/how-to-setup-web2py-apache-wsgi.html,
  
 and also Martin Mulone's Blog site.  Thanks for sharing the knowledge 
 (BTW, 
 I think it makes sense to include this in the book - Deployment 
 recipes).

 With a minimal amount of fuss I was able to get the Welcome app to 
 come up.  I then pointed to an existing app that connects to a SQL 
 Server 
 database, and I get the error:
 File "E:\TWLApps\web2py\gluon\dal.py", line 2600, in __init__
 raise RuntimeError, "Unable to import driver"
 RuntimeError: Unable to import driver

 *I stopped Apache and started the normal "python web2py.py "  
 and my MSSQL app works fine !*

 So, something with my apache config is stopping web2py finding, or 
 loading the (pyodbc?) driver - I think !.
 I've searched the forum and web but I haven't found this particular 
 issue. Any pointers would be appreciated.

 Thanks
 Andrew W

>>>

[web2py] Re: Anyone using BootSwatch with new web2py layout

2012-05-30 Thread Andrew
Thanks LightDot,
I thought it may have been a feature, so just my opinion, I think the non 
button look was better.   It looks more consistent with the other links in 
the navbar, and other Bootstrap menus.

So, do we keep the buttons, or change it back ?  

With regards to Paolo's reply below, I don't mind changing the layout file, 
but we shouldn't change the bootstrap.css (in my opinion).  You then lose 
the ability to simply swap it out for another bootswatch's css file.

Keep up the good work, it's looking great and I can't wait for 2.0 !



On Wednesday, May 30, 2012 11:56:33 PM UTC+12, LightDot wrote:
>
> I believe this is an unrelated change, a case of "it's not a bug, it's a 
> feature"... It defaults to look like buttons in all browsers now.
>
> You could change this back, of course, or even propose to web2py to have 
> the old defaults back...
>
> Regards
>
> On Wednesday, May 30, 2012 7:42:07 AM UTC+2, Andrew wrote:
>>
>> Thanks Paolo,
>> The layout is back to normal.  However the Login set of links are looking 
>> like buttons, rather than the background being the same as the navbar.  
>> This is the same in the two browsers I'm looking at (IE7 and Firefox).
>>
>> I prefer the way it looked in firefox.  Does it need to be a set 
>> background to work ?
>>
>>
>>
>>
>> On Tuesday, May 29, 2012 7:33:50 AM UTC+12, Paolo Caruccio wrote:
>>>
>>> Andrew,
>>>
>>> I, just now, proposed a patch through issue tracker (
>>> http://code.google.com/p/web2py/issues/detail?id=824) that should 
>>> resolve the problems with IE7 noted by you. Moreover the auth_navbar is 
>>> more compliant with bootstrap (check the image). I tested the new welcome 
>>> layout replacing the default web2py bootstrap.min.css with some from 
>>> bootswatch and it seems work good now. 
>>>
>>

Re: [web2py] Suggestions for multiple files upload in form

2012-05-30 Thread Paolo Caruccio
Richard,

I saw your email in the discussion regarding bootswatch, but I want to 
answer here for competence.

Multiupload is a my old project. The object of the toy app was demonstrate 
the usage of multiupload control. It wasn't a complete application.

Your intentions, however, are interesting. I will take a look at your code 
and I will try to find a solution.


Il giorno mercoledì 30 maggio 2012 16:15:09 UTC+2, Richard ha scritto:
>
> Hello Paolo,
>
> Pretty nice!
>
> Did you implement the update of the records also?
>
> Is it a straight and easy task or it becomes trickier to implement than 
> the rest of the app??
>
> Richard
>
> On Sat, Oct 29, 2011 at 6:21 PM, Paolo Caruccio <
> paolo.carucci...@gmail.com> wrote:
>
>> Bruno,
>>
>> thanks.
>>
>> What do you think about the upload mechanism? Can it be translate in a 
>> web2py widget? or is it better to use a different javascript/jquery library?
>>
>> Regards.
>>
>> Paolo
>>
>
>

[web2py] Re: Welcome app / AddToAny integration question

2012-05-30 Thread Omi Chiba
I was thinking the same. It's a little bit annoying.

On Wednesday, May 30, 2012 4:22:02 PM UTC-5, Chris May wrote:
>
> More of a curiosity on my part, but why does web2py promote AddToAny (by 
> automatically including it with every new application)?
>
> Sure, it's easy enough to remove, but why is it in there in the first 
> place?
>


Re: [web2py] cool new wysiwyg editor

2012-05-30 Thread Vasile Ermicioi
about this http://xing.github.com/wysihtml5/

bad UI look on  ie 8, even it says that is supported,
a lot of functionality missing compared to redactorjs (no tables, no
background color, no file upload, very simple link and image inserting, and
so on )

do they have a roadmap of what will be supported?


[web2py] Wildcard in domain mapping route?

2012-05-30 Thread pbreit
Is it possible to wildcard the sub-domain of a domain mapping route?

Ex: domains = {"*.myserver.com": "myapp"}


[web2py] Welcome app / AddToAny integration question

2012-05-30 Thread Chris May
More of a curiosity on my part, but why does web2py promote AddToAny (by 
automatically including it with every new application)?

Sure, it's easy enough to remove, but why is it in there in the first place?


Re: [web2py] cool new wysiwyg editor

2012-05-30 Thread Vasile Ermicioi
about redactorjs

http://redactorjs.com/download/

You are *free* to use Redactor for your personal or non-profit website
projects.
You can get the author's permission to use Redactor for commercial websites
by paying a fee.


Re: [web2py] minimalist file based workflow engine

2012-05-30 Thread Bruno Rocha
Excelent! I will try that to solve the session and errors cleaning and the
notification system for Movuca.

On Wed, May 30, 2012 at 1:00 PM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> https://github.com/mdipierro/workflow
>
> I could use some feedback about this. Should it be included in scripts/?
> It can be used to deleted old errors, expired sessions, setup automatic
> emails. etc.
>
> It is intentionally very minimalist.
>



-- 

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


[web2py] Re: Filter select options

2012-05-30 Thread Niphlod
IS_IN_DB takes also a queryset .
Directly from http://web2py.com/books/default/chapter/29/7

query = (db.table.field == 'xyz') #in practice 'xyz' would be a variable
db.table.field.requires=IS_IN_DB(db(query),)


put that before calling SQLFORM and voilà.


Il giorno mercoledì 30 maggio 2012 22:47:33 UTC+2, Rod Watkins ha scritto:
>
> Hello everyone,
>
> I have a quick question.
>
> I am using the SQLFORM tool and creating a form using the generated custom 
> widgets. One part of the form allows a one to choose a user from a select 
> list (the table has a reference to auth_user). I'd like to limit the 
> options shown in the select list to only those users who are a member  of a 
> specific group. Is there a way to apply a filter to restrict the users 
> added to the select widget?? 
>
> Rod
>


[web2py] Re: minimalist file based workflow engine

2012-05-30 Thread Niphlod
uhm, maybe only for python and ruby 
And let me add that this level of "conciseness" isn't for everybody: I 
noticed that the no of lines of my programs get smaller every month, but I 
still can't write down such minimal (yet understandable) code ...
This is one of the reason I like to hang on web2py-users . just today 
Anthony gave me a lesson 
(https://groups.google.com/d/msg/web2py/aXZsrDMchUw/p-s_ptIvgbMJ) :P 

Il giorno mercoledì 30 maggio 2012 21:56:10 UTC+2, Massimo Di Pierro ha 
scritto:
>
> Isn't that the case for every code?
>
> In my experience if the source is longer then the docs, the code is not 
> worth using.
>
> Massimo
>
> On Wednesday, 30 May 2012 14:03:46 UTC-5, Niphlod wrote:
>>
>> I'm amazed that the docs explaining features is perhaps longer than the 
>> actual code executing it
>> IMHO it deserves inclusion in scripts/... 5 KB against 6,5 to trash 
>> sessions, 9,6 to install on fedora..
>>
>>
>> Il giorno mercoledì 30 maggio 2012 18:00:26 UTC+2, Massimo Di Pierro ha 
>> scritto:
>>>
>>> https://github.com/mdipierro/workflow
>>>
>>> I could use some feedback about this. Should it be included in scripts/? 
>>> It can be used to deleted old errors, expired sessions, setup automatic 
>>> emails. etc.
>>>
>>> It is intentionally very minimalist. 
>>>
>>

Re: [web2py] cool new wysiwyg editor

2012-05-30 Thread Marco Tulio Cicero de M. Porto
http://xing.github.com/wysihtml5/

Another one...

2012/5/29 Marco Tulio Cicero de M. Porto 

> That or they mean that they'll never do it.
>
>
> 2012/5/28 Massimo Di Pierro 
>
>>
>>
>> On Monday, 28 May 2012 17:51:02 UTC-5, Vasile Ermicioi wrote:
>>>
>>> and no font name, font size
>>
>>
>> That's a plus. It should he handled by css.
>>
>>
>>>
>>> I will wait a few  releases until they will conquer the world
>>> http://redactorjs.com/**roadmap/ 
>>>
>>
>> Why does "conquer world" come before "module for drupal"? Must be really
>> difficult to make a module for Drupal.
>>
>
>
>
> --
> []'s
> Marco Tulio
>



-- 
[]'s
Marco Tulio


[web2py] Filter select options

2012-05-30 Thread Rod Watkins
Hello everyone,

I have a quick question.

I am using the SQLFORM tool and creating a form using the generated custom 
widgets. One part of the form allows a one to choose a user from a select 
list (the table has a reference to auth_user). I'd like to limit the 
options shown in the select list to only those users who are a member  of a 
specific group. Is there a way to apply a filter to restrict the users 
added to the select widget?? 

Rod


Re: [web2py] Re: Anyone using BootSwatch with new web2py layout

2012-05-30 Thread Richard Vézina
Hey Paolo!

Funny I was on this thread because a search in gmail and I am just workin
to improve your multiupload app.

I am creating the update form actually I have been able to insert the
values of the record for the f_trip table, but I struggle for the data from
the f_photo table that need to be formated correctly for the jquery
plugins...

I think I am doing a kind of monkey patch actually just to make it works
like this :

def trip_update():
# only SQLFORM.factory tested
form=SQLFORM.factory(db.t_trip, db.t_photos)
for row in db(db.t_trip.id == request.args(0)).select(db.t_trip.ALL):
for f in db.t_trip.fields:
form.vars[f]=row[f]
i = 0
for row in db(db.t_photos.f_trip_ref ==
request.args(0)).select(db.t_photos.ALL):
#for f in db.t_photos.fields:
#f_photo_0:CONTENT_OF_f_title
#form.vars['f_photo_'+str(i)+':'+row.f_title]=row # don't works
need data under this form :
#xtest1
# So here trying to return to the view the jQuery code that will
append the multiple LI required
response.js="jQuery('ul.mw_list').append()"
#LI(_title='couleurs (1).png', A('x', _href='javascript:void(0);',
_class='mw_delItem', _title='remove this file'),
I(B(EM(_class='mw_file-ext-png'))), SPAN('test1'))
# I and B helpers don't exist I think.

#LI(A('x', _href='javascript:void(0);', _class='mw_delItem',
_title='remove this file'),
''+EM(_class='mw_file-ext-png')+'', SPAN('test1'),
_title='couleurs (1).png') # Don't work...

if form.accepts(request, session, onvalidation=lambda
form:check(form)): # Is it possible to use onvalidation with form.process()
syntax ?
trip_id =
db.t_trip.update_record(**db.t_trip._filter_fields(form.vars))
nfiles = 0
for var in request.vars:
if var.startswith('f_photo') and request.vars[var] != '':
uploaded = request.vars[var]
if isinstance(uploaded,list):
# files uploaded through input with "multiple"
attribute set on true
counter=0
for element in uploaded:
counter += 1
nfiles += 1
file_title = element.name.split(":")[-1] # TODO:
could this be made better?
 # I mean,
the title must be appended to element's name
 # or is
there another way?
db.t_photos.insert(
f_trip_ref=trip_id,
f_title=file_title+" ("+str(counter)+")" if
file_title!="" else file_title,

f_photo=db.t_photos.f_photo.store(element.file,element.filename))
else:
# only one file uploaded
element = request.vars[var]
nfiles += 1
db.t_photos.insert(
f_trip_ref=trip_id,
f_title=element.name.split(":")[-1],

f_photo=db.t_photos.f_photo.store(element.file,element.filename))

session.flash = T('%s photo%s uploaded'%(nfiles, 's' if nfiles>1
else ''))
redirect(URL('trip_read'))

if isinstance(form,FORM):
# hide f_title form's row. Is there a better way to accomplish it?
del form[0][3]

return dict(form=form)

So almost realtime coding here... Do you have a better idea than returning
the f_photo entries under the format used by the javascript plugins ??

Richard


On Wed, May 30, 2012 at 4:05 PM, Paolo Caruccio
wrote:

> Andrew,
>
> it's simple go back to old auth_navbar.
>
> In views/layout.html comment this jquery code:
>
> jQuery('.auth_navbar').each(function(){
> jQuery(this)
>  .addClass('btn-group')
>  .children('a').addClass('btn')
> });
>
> and change the  in this way (note separators):
>
> {{='auth' in globals() and auth.navbar(separators=(' ','
> | ',''))}}
>
> At least add below 2 rows to bottom of static/css/bootswatch.css:
>
> #navbar{
> padding-top:9px;
> }
> #navbar .auth_navbar, #navbar .auth_navbar a{
>  color:inherit;
>  //color:expression(this.parentNode.currentStyle['color']); /* ie7
> doesn't support inherit */
> }
>
> Please, let me know if it works.
>
> Il giorno mercoledì 30 maggio 2012 07:42:07 UTC+2, Andrew ha scritto:
>
>> Thanks Paolo,
>> The layout is back to normal.  However the Login set of links are looking
>> like buttons, rather than the background being the same as the navbar.
>> This is the same in the two browsers I'm looking at (IE7 and Firefox).
>>
>> I prefer the way it looked in firefox.  Does it need to be a set
>> background to work ?
>>
>>
>>
>>
>> On Tuesday, May 29, 2012 7:33:50 AM UTC+12, Paolo Caruccio wrote:
>>>
>>> Andrew,
>>>
>>> I, just now, proposed a patch through issue tracker (
>>> http://code.google.com/p/**web2py/issues/detail?id=824

[web2py] Re: Anyone using BootSwatch with new web2py layout

2012-05-30 Thread Paolo Caruccio
Andrew,

it's simple go back to old auth_navbar.

In views/layout.html comment this jquery code:

jQuery('.auth_navbar').each(function(){
jQuery(this)
 .addClass('btn-group')
 .children('a').addClass('btn')
});

and change the  in this way (note separators):

{{='auth' in globals() and auth.navbar(separators=(' ',' | 
',''))}}

At least add below 2 rows to bottom of static/css/bootswatch.css:

#navbar{
padding-top:9px;
}
#navbar .auth_navbar, #navbar .auth_navbar a{
 color:inherit;
 //color:expression(this.parentNode.currentStyle['color']); /* ie7 doesn't 
support inherit */
}

Please, let me know if it works.

Il giorno mercoledì 30 maggio 2012 07:42:07 UTC+2, Andrew ha scritto:
>
> Thanks Paolo,
> The layout is back to normal.  However the Login set of links are looking 
> like buttons, rather than the background being the same as the navbar.  
> This is the same in the two browsers I'm looking at (IE7 and Firefox).
>
> I prefer the way it looked in firefox.  Does it need to be a set 
> background to work ?
>
>
>
>
> On Tuesday, May 29, 2012 7:33:50 AM UTC+12, Paolo Caruccio wrote:
>>
>> Andrew,
>>
>> I, just now, proposed a patch through issue tracker (
>> http://code.google.com/p/web2py/issues/detail?id=824) that should 
>> resolve the problems with IE7 noted by you. Moreover the auth_navbar is 
>> more compliant with bootstrap (check the image). I tested the new welcome 
>> layout replacing the default web2py bootstrap.min.css with some from 
>> bootswatch and it seems work good now. 
>>
>

Re: [web2py] Re: minimalist file based workflow engine

2012-05-30 Thread Michele Comitini
+1
This is perfect for managing repeated task

A file observer, task dispatcher/scheduler with a cool syntax!

mic

2012/5/30 Niphlod :
> I'm amazed that the docs explaining features is perhaps longer than the
> actual code executing it
> IMHO it deserves inclusion in scripts/... 5 KB against 6,5 to trash
> sessions, 9,6 to install on fedora..
>
>
> Il giorno mercoledì 30 maggio 2012 18:00:26 UTC+2, Massimo Di Pierro ha
> scritto:
>>
>> https://github.com/mdipierro/workflow
>>
>> I could use some feedback about this. Should it be included in scripts/?
>> It can be used to deleted old errors, expired sessions, setup automatic
>> emails. etc.
>>
>> It is intentionally very minimalist.


[web2py] Re: minimalist file based workflow engine

2012-05-30 Thread Massimo Di Pierro
Isn't that the case for every code?

In my experience if the source is longer then the docs, the code is not 
worth using.

Massimo

On Wednesday, 30 May 2012 14:03:46 UTC-5, Niphlod wrote:
>
> I'm amazed that the docs explaining features is perhaps longer than the 
> actual code executing it
> IMHO it deserves inclusion in scripts/... 5 KB against 6,5 to trash 
> sessions, 9,6 to install on fedora..
>
>
> Il giorno mercoledì 30 maggio 2012 18:00:26 UTC+2, Massimo Di Pierro ha 
> scritto:
>>
>> https://github.com/mdipierro/workflow
>>
>> I could use some feedback about this. Should it be included in scripts/? 
>> It can be used to deleted old errors, expired sessions, setup automatic 
>> emails. etc.
>>
>> It is intentionally very minimalist. 
>>
>

[web2py] Re: minimalist file based workflow engine

2012-05-30 Thread Niphlod
I'm amazed that the docs explaining features is perhaps longer than the 
actual code executing it
IMHO it deserves inclusion in scripts/... 5 KB against 6,5 to trash 
sessions, 9,6 to install on fedora..


Il giorno mercoledì 30 maggio 2012 18:00:26 UTC+2, Massimo Di Pierro ha 
scritto:
>
> https://github.com/mdipierro/workflow
>
> I could use some feedback about this. Should it be included in scripts/? 
> It can be used to deleted old errors, expired sessions, setup automatic 
> emails. etc.
>
> It is intentionally very minimalist. 
>


Re: [web2py] Re: try: for-loop

2012-05-30 Thread Niphlod
I am astonished... I missed this in almost 3 years of python development :D

I genuinely repent and knee before you, Anthony 

Niphlod

Il giorno mercoledì 30 maggio 2012 18:11:32 UTC+2, Anthony ha scritto:
>
> On Wednesday, May 30, 2012 11:59:13 AM UTC-4, Niphlod wrote:
>>
>> uhm, depends if he uses lists and articles is = [], there will be a 
>> problem.
>
>
> What problem? An empty list evaluates to False.
>
> Anthony 
>


[web2py] Re: alternates to pyjamas/pyjs?

2012-05-30 Thread Stefaan Himpe



solved some of the issues...time to get crackin'!


Glad to hear it :)

I have found the "inspect element" tool in chromium to be very valuable 
in diagnosing trouble with my application.





Re: [web2py] Re: Integrate PHP project with web2py

2012-05-30 Thread José Ricardo Borba
First: What database you are looking for? PHPmyadmin is only for MySQL. For
PostgreSQL exist the PHPpgadmin at sourceforge.
Second: If your database exists, you can access through the right admin
interface (above), with your user and pass.
Now you can create your database dictionary.

So, the DAL can do the hard work when you create your DB for your w2p app.

Regards,

José Ricardo Borba
Porto Alegre - RS

2012/5/30 Bill Thayer 

> You could also have web2py and php
>> share a database system like PostgreSQL.
>>
>
> Hello Allen,
>
> This remark is interesting. I've been working hard for 2 days trying to
> get phpMyAdmin to run with web2py but I am having difficulties. Do I need
> two different servers to run PHP and web2py? My need is to create a
> database dictionary for documenting my database.
>
> -Bill
>
> On Monday, January 23, 2012 6:54:43 AM UTC-6, Alan Etkin wrote:
>>
>> What kind of inclusion are you looking for? I suppose the most obvious
>> way is to append a php app to a web2py view trough AJAX. For
>> interaction perhaps it is possible to use web2py's XML and JSON views
>>
>>> and RPC calls between applications. You could also have web2py and php
>>> share a database system like PostgreSQL.
>>>
>>
>> On 23 ene, 05:52, ganesh waghmare  wrote:
>> > Hi all,
>> >
>> > I have devloped a web2py site and I want to include chat application
>> > into it which is implemented in php. How can I include this php in
>> > web2py.
>> >
>> > Thanks..
>
>
> On Monday, January 23, 2012 6:54:43 AM UTC-6, Alan Etkin wrote:
>>
>> What kind of inclusion are you looking for? I suppose the most obvious
>> way is to append a php app to a web2py view trough AJAX. For
>> interaction perhaps it is possible to use web2py's XML and JSON views
>> and RPC calls between applications. You could also have web2py and php
>> share a database system like PostgreSQL.
>>
>> On 23 ene, 05:52, ganesh waghmare  wrote:
>> > Hi all,
>> >
>> > I have devloped a web2py site and I want to include chat application
>> > into it which is implemented in php. How can I include this php in
>> > web2py.
>> >
>> > Thanks..
>
>


-- 
José Ricardo Borba

UFRGS - Instituto de Física
L3FNano - 43173 room 101
Lab:55-51-3308-6457 / Office: 55-51-3308-6530
Mobile:55-51-8184-7649 / Fax:   55-51-3308-7286


[web2py] Re: Integrate PHP project with web2py

2012-05-30 Thread LightDot


On Wednesday, May 30, 2012 6:16:21 PM UTC+2, Bill Thayer wrote:
>
> You could also have web2py and php 
>> share a database system like PostgreSQL. 
>>
>
> Hello Allen,
>
> This remark is interesting. I've been working hard for 2 days trying to 
> get phpMyAdmin to run with web2py but I am having difficulties. Do I need 
> two different servers to run PHP and web2py? My need is to create a 
> database dictionary for documenting my database.
>
> -Bill
>
 
If you're using something like apache or nginx, one is enough.

Regards


Re: [web2py] mydomain.com/#!/ detect and redirect

2012-05-30 Thread Jonathan Lundell
On May 30, 2012, at 10:16 AM, Jonathan Lundell wrote:
> On May 30, 2012, at 9:37 AM, Annet wrote:
>> ... in router.example.py? In my case default_application = 'init', 
>> default_controller = 'default' and default_function = 'index'  What do you 
>> mean by 'and specify the list of available functions in the default router' 
>> . My application contains 15 controllers and almost 100 functions, do I have 
>> to list them all in functions = '' or do I have to just list the functions 
>> in default_controller = 'default', controllers = 'DEFAULT',
> 
> Just the functions in the default controller.

...though somewhat recently we added the ability to specify functions as a 
dictionary, with controller names as keys, so you *can* specify function lists 
for as many controllers as you care to. For ease of maintenance, you'd want to 
keep that to a minimum.

That's in the trunk; not sure if it's in the stable build.

Re: [web2py] mydomain.com/#!/ detect and redirect

2012-05-30 Thread Jonathan Lundell
On May 30, 2012, at 9:57 AM, pbreit wrote:
> If you have your routes set up with a default app and default controller, you 
> could do something simple like:
> 
> def u():
> row = db(db.auth_user.shortname==request.args(0)).select().first()
> return dict(row=row)
> 
> Which should support URLs like:
> 
> http://www.myserver.com/u/johnsmith
> 

Notice that a URL like this can be implemented in two ways, with 'u' as a 
controller or as a function in the default controller.

If u is a controller, then this URL would invoke its default function (so its 
functions would have to be listed), and the function name should be chosen so 
that it isn't likely to be a user name (that is, don't make the function name 
johnsmith...). Making u a function is the default controller is more 
straightforward, I think.

Re: [web2py] mydomain.com/#!/ detect and redirect

2012-05-30 Thread Jonathan Lundell
On May 30, 2012, at 9:37 AM, Annet wrote:
> ... in router.example.py? In my case default_application = 'init', 
> default_controller = 'default' and default_function = 'index'  What do you 
> mean by 'and specify the list of available functions in the default router' . 
> My application contains 15 controllers and almost 100 functions, do I have to 
> list them all in functions = '' or do I have to just list the functions in 
> default_controller = 'default', controllers = 'DEFAULT',

Just the functions in the default controller.

[web2py] Validator for self reference field not referring to itself

2012-05-30 Thread lcamara
Hey,

I'm trying to validate some things on a self reference field, among them 
that a reference field on a table does not refer to the record where it is.

For instance,

db.define_table('person',
Field('name', length=256, unique=True, requires=IS_NOT_EMPTY()),
Field('gender', requires= IS_IN_SET([T('Male'), T('Female')], 
zero=T('choose one'))),
Field('father', 'reference person'),
Field('mother', 'reference person'),
format = '%(name)s'
)

db.person.father.requires = IS_EMPTY_OR(IS_IN_DB(db(db.person.gender == 
'Male'), db.person.id, '%(name)s', zero=T('choose one'))) 
db.person.mother.requires = IS_EMPTY_OR(IS_IN_DB(db(db.person.gender == 
'Female'), db.person.id, '%(name)s', zero=T('choose one')))

So in addition to the gender restriction (yeah I know it's not always true, 
this is just an example), I'd like to add the restriction that a person 
cannot be it's own father or mother.
Basically what I want is something like an IS_NOT_SELF or something.

Any tips on how to go about this?


Re: [web2py] Help requested with jquery, bootstrap.modal and grid

2012-05-30 Thread pbreit
I think opening a Bootstrap modal should be much easier:
http://twitter.github.com/bootstrap/javascript.html#modals


On Wednesday, May 30, 2012 6:16:11 AM UTC-7, Johann Spies wrote:
>
> On 30 May 2012 12:59, R. Osinga  wrote:
>
>> beats me...
>>
>> I have determined that it is unrelated to this code.  I see it elsewhere 
> in the app also.
>  
>
>> but for some other improvement,
>>
>> $(document).ready(function() {
>>  $('a[href*="Alternative"]').a**ttr('data-toggle','modal').a**ttr(
>> 'data-target','#alt');
>> });
>>
>> Thanks again.
>  
> This function is now doing it's job and the dom is marked as requested.  
> But the result bypasses the modal-part.  I suspect that I will have to find 
> another way to trigger the modal-function of bootstrap for example just a 
> clickable element.  I do not (yet) know how to pass the correct variable 
> from the row to the modal function in such a case.
>
> I have now
>
>  data-target="#alt">Alternative name(s)
>
> in the grid
>
> and I have changed my jquery script to:
>
>
> 
> $(document).ready(function() {
> $('#merkmy').attr({
> 'data-toggle': 'modal',
> 'data-target': '#alt'
>
> });
>
>
> $("a[data-toggle=modal]").click(function() {
> event.preventDefault();
> target = $(this).attr('data-target');
> url = $(this).attr('href');
> $(target).load(url);
>
> return false;
> });
> });
> 
>
> But when I click on the link, it calls up the normal page with the data - 
> no modal.
>
> I still have a lot to learn about jquery! 
>
> Regards
> Johann
> -- 
> Because experiencing your loyal love is better than life itself, 
> my lips will praise you.  (Psalm 63:3)
>
>

[web2py] Re: anonymous login / temporary user login / non-user authentication

2012-05-30 Thread pbreit
I suspect there's a reason you're not just using regular accounts but that 
would definitely be my suggestion.'


On Wednesday, May 30, 2012 8:59:03 AM UTC-7, Liam wrote:
>
> Just some clarification. In the solution I'm trying to implement, I need 
> to make sure that only the person who entered the reviewer code can view 
> the data; much like user login but anonymous. Because it is anonymous and 
> there is no entry in db.auth_user, I think the decorator 
> @auth.requires_login() is now insufficient. However, I believe 
> authentication mechanism would be highly similar if not identical.
>
> On Wednesday, May 30, 2012 5:55:06 PM UTC+2, Liam wrote:
>>
>> Hi LightDot,
>>
>> Thanks for the quick reply. 
>>
>> The user is able to perform analyses on data that they've uploaded to the 
>> site. When they wish to publish an article in a journal based on the 
>> analyses, they need to allow reviewers to see the data generated by the 
>> analyses along with the initial data the analyses were based upon. The 
>> reviewers should be able to view the user's data without having to register 
>> at the site. If the article is accepted by the journal, then the user data 
>> used and created by their published analyses will become publicly available.
>>
>> The solution I've come up with is to have the user generate a "reviewer 
>> code", which is not necessarily encrypted, and provides the journal editor 
>> the code along with the manuscript they submit. The reviewers then get this 
>> code with the manuscript. In a special section on the site, the reviewers 
>> can enter the code and will then be able to browse the necessary data. If 
>> the publication is accepted, then the user is able to publish all the data, 
>> which is now accessible to the public. I guess at this point it doesn't 
>> matter if the reviewer code can still be used.
>>
>> Cheers,
>> Liam
>>
>> On Wednesday, May 30, 2012 3:01:14 PM UTC+2, LightDot wrote:
>>>
>>> So, this would be a one time password that expires? And this data that 
>>> the user views is generated on the fly and also discarded later?
>>>
>>> On Wednesday, May 30, 2012 9:09:31 AM UTC+2, Liam wrote:

 Dear all,

 I'm looking for a way to allow non-users of my application to login 
 given a password (generated by a user) so they can view some of the user's 
 data. Does anyone know if web2py readily supports this? Or perhaps someone 
 has an idea on how to implement it.

 Regards,
 Liam



[web2py] Re: mydomain.com/#!/ detect and redirect

2012-05-30 Thread pbreit
The "hashbang" ("#!") is for a very specific purpose where your whole page 
is coded in JavaScript. It was sort of popularized by Twitter who is 
actually now abandoning it. I'm not sure why you would want to use it.

If you have your routes set up with a default app and default controller, 
you could do something simple like:

def u():
row = db(db.auth_user.shortname==request.args(0)).select().first()
return dict(row=row)

Which should support URLs like:

http://www.myserver.com/u/johnsmith





On Wednesday, May 30, 2012 9:37:13 AM UTC-7, Annet wrote:
>
> Hi Anthony,
>
> I read the relevant part of the book: 
> http://www.web2py.com/books/default/chapter/29/4?search=url+rewrite#Parameter-based-systemand
>  had a look at 
> router.example.py file, I am not sure I completely understand the 
> solution you provided me with.
>
> If you use the parameter-based rewrite system to set a default app, 
>> controller, and function and specify the list of available functions in the 
>> default router
>
>
> By default router you mean this:
>
> #  The built-in default router supplies default values (undefined members 
> are None):
> #
> # default_router = dict(
> # default_application = 'init',
> # applications = 'ALL',
> # default_controller = 'default',
> # controllers = 'DEFAULT',
> # default_function = 'index',
> # functions = None,
> # default_language = None,
> # languages = None,
> # root_static = ['favicon.ico', 'robots.txt'],
> # domains = None,
> # map_hyphen = False,
> # acfe_match = r'\w+$',  # legal app/ctlr/fcn/ext
> # file_match = r'(\w+[-=./]?)+$',# legal file (path) name
> # args_match = r'([\w@ -]+[=.]?)+$', # legal arg in args
> # )
>
> ... in router.example.py? In my case default_application = 'init', 
> default_controller = 'default' and default_function = 'index'  What do you 
> mean by 'and specify the list of available functions in the default router' 
> . My application contains 15 controllers and almost 100 functions, do I 
> have to list them all in functions = '' or do I have to just list the 
> functions in default_controller = 'default', controllers = 'DEFAULT',
>
>  
>
>> then in http://yourdomain.com/code/shortname, code and shortname will be 
>> interpreted as request.args[1:2], with the request being routed to the 
>> default app, controller, and function.
>
>
> In my case init/default/index which implies that in the index function I 
> have to do something like:
>
>
> def index():
> if request.args(0)==code:
> 
> row=db(db.auth_user.shortname==request.args(1)).select(db.auth_user.nodeID).first()
> 
> account=db(db.NodeAccount.nodeID==row.nodeID).select(db.NodeAccount.accountID).first()
> if account.accountID==BASICACCOUNTID:
> redirect(URL('vcard',args=row.nodeID))
> elif account.accountID==ADVANCEDACCOUNTID:
> redirect(URL('site','index',args=row.nodeID))
> elif account.accountID==HUBACCOUNTID:
> redirect(URL('hub','index',args=row.nodeID))
> else:
> return dict()
>
>
> Kind regards,
>
> Annet
> 
>


[web2py] Re: mydomain.com/#!/ detect and redirect

2012-05-30 Thread Anthony

>
> ... in router.example.py? In my case default_application = 'init', 
> default_controller = 'default' and default_function = 'index'  What do you 
> mean by 'and specify the list of available functions in the default router' 
> . My application contains 15 controllers and almost 100 functions, do I 
> have to list them all in functions = '' or do I have to just list the 
> functions in default_controller = 'default', controllers = 'DEFAULT',
>

Instead of

functions=None,

do

functions=['index', 'func1', 'func2']  # list all the functions in the 
default controller

When the router sees /code/shortname, it will know "code" is not a 
controller and also not one of the functions in the default controller, and 
it will therefore assume it is an arg.
 

> then in http://yourdomain.com/code/shortname, code and shortname will be 
>> interpreted as request.args[1:2], with the request being routed to the 
>> default app, controller, and function.
>
>
> In my case init/default/index which implies that in the index function I 
> have to do something like:
>
>
> def index():
> if request.args(0)==code:
> 
> row=db(db.auth_user.shortname==request.args(1)).select(db.auth_user.nodeID).first()
> 
> account=db(db.NodeAccount.nodeID==row.nodeID).select(db.NodeAccount.accountID).first()
> if account.accountID==BASICACCOUNTID:
> redirect(URL('vcard',args=row.nodeID))
> elif account.accountID==ADVANCEDACCOUNTID:
> redirect(URL('site','index',args=row.nodeID))
> elif account.accountID==HUBACCOUNTID:
> redirect(URL('hub','index',args=row.nodeID))
> else:
> return dict()
>

Yes, though technically you don't have to do it in the index function. 
Instead, in a model file, you could do:

if request.controller == 'default' and request.function == 'index' andrequest
.args(0) == 'code':
[check the db and do a redirect]

Anthony 


Re: [web2py] Re: alternates to pyjamas/pyjs?

2012-05-30 Thread Larry G. Wapnitsky

solved some of the issues...time to get crackin'!


On 5/30/2012 12:01 PM, stefaan wrote:
I cannot help much with the hulahop (that's needed for pyjd only, 
which i haven't used myself).
I normally compile on the command line, using the pyjsbuild tool found 
inside the pyjamas/bin folder,

and test inside the browser.







[web2py] Re: mydomain.com/#!/ detect and redirect

2012-05-30 Thread Annet
Hi Anthony,

I read the relevant part of the book: 
http://www.web2py.com/books/default/chapter/29/4?search=url+rewrite#Parameter-based-system
 
and had a look at router.example.py file, I am not sure I completely 
understand the solution you provided me with.

If you use the parameter-based rewrite system to set a default app, 
> controller, and function and specify the list of available functions in the 
> default router


By default router you mean this:

#  The built-in default router supplies default values (undefined members 
are None):
#
# default_router = dict(
# default_application = 'init',
# applications = 'ALL',
# default_controller = 'default',
# controllers = 'DEFAULT',
# default_function = 'index',
# functions = None,
# default_language = None,
# languages = None,
# root_static = ['favicon.ico', 'robots.txt'],
# domains = None,
# map_hyphen = False,
# acfe_match = r'\w+$',  # legal app/ctlr/fcn/ext
# file_match = r'(\w+[-=./]?)+$',# legal file (path) name
# args_match = r'([\w@ -]+[=.]?)+$', # legal arg in args
# )

... in router.example.py? In my case default_application = 'init', 
default_controller = 'default' and default_function = 'index'  What do you 
mean by 'and specify the list of available functions in the default router' 
. My application contains 15 controllers and almost 100 functions, do I 
have to list them all in functions = '' or do I have to just list the 
functions in default_controller = 'default', controllers = 'DEFAULT',

 

> then in http://yourdomain.com/code/shortname, code and shortname will be 
> interpreted as request.args[1:2], with the request being routed to the 
> default app, controller, and function.


In my case init/default/index which implies that in the index function I 
have to do something like:


def index():
if request.args(0)==code:

row=db(db.auth_user.shortname==request.args(1)).select(db.auth_user.nodeID).first()

account=db(db.NodeAccount.nodeID==row.nodeID).select(db.NodeAccount.accountID).first()
if account.accountID==BASICACCOUNTID:
redirect(URL('vcard',args=row.nodeID))
elif account.accountID==ADVANCEDACCOUNTID:
redirect(URL('site','index',args=row.nodeID))
elif account.accountID==HUBACCOUNTID:
redirect(URL('hub','index',args=row.nodeID))
else:
return dict()


Kind regards,

Annet



[web2py] Re: Integrate PHP project with web2py

2012-05-30 Thread Bill Thayer

>
> You could also have web2py and php 
> share a database system like PostgreSQL. 
>

Hello Allen,

This remark is interesting. I've been working hard for 2 days trying to get 
phpMyAdmin to run with web2py but I am having difficulties. Do I need two 
different servers to run PHP and web2py? My need is to create a database 
dictionary for documenting my database.

-Bill
 
On Monday, January 23, 2012 6:54:43 AM UTC-6, Alan Etkin wrote:
>
> What kind of inclusion are you looking for? I suppose the most obvious 
> way is to append a php app to a web2py view trough AJAX. For 
> interaction perhaps it is possible to use web2py's XML and JSON views 
>
>> and RPC calls between applications. You could also have web2py and php 
>> share a database system like PostgreSQL. 
>>
>
> On 23 ene, 05:52, ganesh waghmare  wrote: 
> > Hi all, 
> > 
> > I have devloped a web2py site and I want to include chat application 
> > into it which is implemented in php. How can I include this php in 
> > web2py. 
> > 
> > Thanks..


On Monday, January 23, 2012 6:54:43 AM UTC-6, Alan Etkin wrote:
>
> What kind of inclusion are you looking for? I suppose the most obvious 
> way is to append a php app to a web2py view trough AJAX. For 
> interaction perhaps it is possible to use web2py's XML and JSON views 
> and RPC calls between applications. You could also have web2py and php 
> share a database system like PostgreSQL. 
>
> On 23 ene, 05:52, ganesh waghmare  wrote: 
> > Hi all, 
> > 
> > I have devloped a web2py site and I want to include chat application 
> > into it which is implemented in php. How can I include this php in 
> > web2py. 
> > 
> > Thanks..



Re: [web2py] Re: try: for-loop

2012-05-30 Thread Anthony
On Wednesday, May 30, 2012 11:59:13 AM UTC-4, Niphlod wrote:
>
> uhm, depends if he uses lists and articles is = [], there will be a 
> problem.


What problem? An empty list evaluates to False.

Anthony 


Re: [web2py] Re: alternates to pyjamas/pyjs?

2012-05-30 Thread stefaan
I cannot help much with the hulahop (that's needed for pyjd only, which i 
haven't used myself).
I normally compile on the command line, using the pyjsbuild tool found 
inside the pyjamas/bin folder, 
and test inside the browser.




[web2py] minimalist file based workflow engine

2012-05-30 Thread Massimo Di Pierro
https://github.com/mdipierro/workflow

I could use some feedback about this. Should it be included in scripts/? It 
can be used to deleted old errors, expired sessions, setup automatic 
emails. etc.

It is intentionally very minimalist. 


Re: [web2py] Re: try: for-loop

2012-05-30 Thread Niphlod
uhm, depends if he uses lists and articles is = [], there will be a 
problem.
Anyway, under some circumstances you're right.

Il giorno mercoledì 30 maggio 2012 17:11:33 UTC+2, rochacbruno ha scritto:
>
> len(articles) is not necessary
>
> {{if articles:}}
> display whatever you want in a for loop
> {{else:}}
> display your static message
> {{pass}}
>
> On Wed, May 30, 2012 at 12:04 PM, Niphlod  wrote:
>
>> {{if articles and len(articles)>0:}}
>> display whatever you want in a for loop
>> {{else:}}
>> display your static message
>> {{pass}}
>>
>
>
>
> -- 
>
> Bruno Rocha
> [http://rochacbruno.com.br]
>
>

[web2py] Re: anonymous login / temporary user login / non-user authentication

2012-05-30 Thread Liam
Just some clarification. In the solution I'm trying to implement, I need to 
make sure that only the person who entered the reviewer code can view the 
data; much like user login but anonymous. Because it is anonymous and there 
is no entry in db.auth_user, I think the decorator @auth.requires_login() 
is now insufficient. However, I believe authentication mechanism would be 
highly similar if not identical.

On Wednesday, May 30, 2012 5:55:06 PM UTC+2, Liam wrote:
>
> Hi LightDot,
>
> Thanks for the quick reply. 
>
> The user is able to perform analyses on data that they've uploaded to the 
> site. When they wish to publish an article in a journal based on the 
> analyses, they need to allow reviewers to see the data generated by the 
> analyses along with the initial data the analyses were based upon. The 
> reviewers should be able to view the user's data without having to register 
> at the site. If the article is accepted by the journal, then the user data 
> used and created by their published analyses will become publicly available.
>
> The solution I've come up with is to have the user generate a "reviewer 
> code", which is not necessarily encrypted, and provides the journal editor 
> the code along with the manuscript they submit. The reviewers then get this 
> code with the manuscript. In a special section on the site, the reviewers 
> can enter the code and will then be able to browse the necessary data. If 
> the publication is accepted, then the user is able to publish all the data, 
> which is now accessible to the public. I guess at this point it doesn't 
> matter if the reviewer code can still be used.
>
> Cheers,
> Liam
>
> On Wednesday, May 30, 2012 3:01:14 PM UTC+2, LightDot wrote:
>>
>> So, this would be a one time password that expires? And this data that 
>> the user views is generated on the fly and also discarded later?
>>
>> On Wednesday, May 30, 2012 9:09:31 AM UTC+2, Liam wrote:
>>>
>>> Dear all,
>>>
>>> I'm looking for a way to allow non-users of my application to login 
>>> given a password (generated by a user) so they can view some of the user's 
>>> data. Does anyone know if web2py readily supports this? Or perhaps someone 
>>> has an idea on how to implement it.
>>>
>>> Regards,
>>> Liam
>>>
>>>

[web2py] Re: anonymous login / temporary user login / non-user authentication

2012-05-30 Thread Liam
Hi LightDot,

Thanks for the quick reply. 

The user is able to perform analyses on data that they've uploaded to the 
site. When they wish to publish an article in a journal based on the 
analyses, they need to allow reviewers to see the data generated by the 
analyses along with the initial data the analyses were based upon. The 
reviewers should be able to view the user's data without having to register 
at the site. If the article is accepted by the journal, then the user data 
used and created by their published analyses will become publicly available.

The solution I've come up with is to have the user generate a "reviewer 
code", which is not necessarily encrypted, and provides the journal editor 
the code along with the manuscript they submit. The reviewers then get this 
code with the manuscript. In a special section on the site, the reviewers 
can enter the code and will then be able to browse the necessary data. If 
the publication is accepted, then the user is able to publish all the data, 
which is now accessible to the public. I guess at this point it doesn't 
matter if the reviewer code can still be used.

Cheers,
Liam

On Wednesday, May 30, 2012 3:01:14 PM UTC+2, LightDot wrote:
>
> So, this would be a one time password that expires? And this data that the 
> user views is generated on the fly and also discarded later?
>
> On Wednesday, May 30, 2012 9:09:31 AM UTC+2, Liam wrote:
>>
>> Dear all,
>>
>> I'm looking for a way to allow non-users of my application to login given 
>> a password (generated by a user) so they can view some of the user's data. 
>> Does anyone know if web2py readily supports this? Or perhaps someone has an 
>> idea on how to implement it.
>>
>> Regards,
>> Liam
>>
>>

[web2py] Re: alternates to pyjamas/pyjs?

2012-05-30 Thread stefaan
Or maybe I misread your question, and you were really asking about pyjd ?
I haven't used it, so I don't know... so far debugging the application was 
easy enough by dumping debug information onto the bottom of my page.



Re: [web2py] Re: alternates to pyjamas/pyjs?

2012-05-30 Thread Larry G. Wapnitsky

stefaan-

As I just posted on the pyjs group (with a stupid typo :)):

pyjs was installed from git.

1)  hulahop doesn't work.
2)  error message when running the following:

['/home/lwapnitsky/workspace/pyjamas/eclipse_build.py', '-d', '-I 
/home/lwapnitsky/workspace/pyjamas', 'test.py']

Traceback (most recent call last):
  File "/home/lwapnitsky/workspace/pyjamas/eclipse_build.py", line 109, 
in 

_run_translator()
  File "/home/lwapnitsky/workspace/pyjamas/eclipse_build.py", line 89, 
in _run_translator

pyjs = _return_pyjs()
  File "/home/lwapnitsky/workspace/pyjamas/eclipse_build.py", line 83, 
in _return_pyjs

import pyjs.browser
  File "/usr/local/lib/python2.7/dist-packages/pyjs/browser.py", line 
8, in 

from pyjs import linker
  File "/usr/local/lib/python2.7/dist-packages/pyjs/linker.py", line 7, 
in 

from pyjs import translator
  File "/usr/local/lib/python2.7/dist-packages/pyjs/translator.py", 
line 15, in 

from translator_proto import *
  File 
"/usr/local/lib/python2.7/dist-packages/pyjs/translator_proto.py", line 
37, in 

import pycompiler as compiler
ImportError: No module named pycompiler

Shouldn't pycompiler just be compiler?

On 5/30/2012 11:43 AM, stefaan wrote:



> Are there any good alternatives to using pyjamas/pyjs or learning 
JavaScript from scratch?


What problems are you having? I've been using a recent version of 
pyjamas without problem.
(Of course with the recent "hijack" of the project by some disgruntled 
people there may be other reasons to look for alternatives :) )


As I found out by trial and error, the explanation in the web2py book 
refers to pyjamas 0.5-something and the view shown there is outdated.

Here's the summary of how I got it to work:

* Put the YourAppName.py in the static folder of your web2py application
* After compiling the YourAppName.py file to YourAppName.js, in the 
output folder, you will find a YourAppName.html file, which contains
the boilerplate code required in your web2py view (this is a one-time 
copy paste operation from generated code to your web2py view).
The boilerplate code no longer exactly matches the code as shown in 
the web2py book.


One thing that took me a while to figure out was the importance of 
including the exact




tag, with the correct values for the name and content attribute as 
found in the output/YourAppName.html file.

Without this tag, the pyjamas application would refuse to start.






[web2py] Re: alternates to pyjamas/pyjs?

2012-05-30 Thread stefaan


> Are there any good alternatives to using pyjamas/pyjs or learning 
JavaScript from scratch? 

What problems are you having? I've been using a recent version of pyjamas 
without problem.
(Of course with the recent "hijack" of the project by some disgruntled 
people there may be other reasons to look for alternatives :) )

As I found out by trial and error, the explanation in the web2py book 
refers to pyjamas 0.5-something and the view shown there is outdated. 
Here's the summary of how I got it to work:

* Put the YourAppName.py in the static folder of your web2py application
* After compiling the YourAppName.py file to YourAppName.js, in the output 
folder, you will find a YourAppName.html file, which contains 
the boilerplate code required in your web2py view (this is a one-time copy 
paste operation from generated code to your web2py view). 
The boilerplate code no longer exactly matches the code as shown in the 
web2py book. 

One thing that took me a while to figure out was the importance of 
including the exact



tag, with the correct values for the name and content attribute as found in 
the output/YourAppName.html file.
Without this tag, the pyjamas application would refuse to start.



[web2py] Re: try: for-loop

2012-05-30 Thread BlueShadow
thats even more elegant^^

Am Mittwoch, 30. Mai 2012 17:04:16 UTC+2 schrieb Niphlod:
>
>  you're overcomplicating a small issue
>
> {{if articles and len(articles)>0:}}
> display whatever you want in a for loop
> {{else:}}
> display your static message
> {{pass}}
>
> Il giorno mercoledì 30 maggio 2012 16:44:22 UTC+2, BlueShadow ha scritto:
>>
>> I tried it too and for some weird reason it works.
>> The missing doublepoint you spotted is in my complete code on my server^^
>> what I really want to do is: diyplaying a database entry in a table.
>> this entry varies from no entries to about 10.
>> I didn't account for the no entries part but I got a bunch of error 
>> messages in my log which result from this for loop which is going through 
>> the entries Titles if there are none it still requests the tile and crashes
>> so
>> this is more close to my code:
>>
>> 
>> {{for z in articles:}}
>> {{=z.Title}} 
>> {{=A(z.Title,_href=URL(r=request,f='article',vars=dict(id=
>> z.id)))}}
>> {{pass}}
>> <\table>
>> Now what I want is to skip this loop and display a static message if 
>> there are no articles
>>
>>
>>
>> Am Mittwoch, 30. Mai 2012 16:19:32 UTC+2 schrieb Niphlod:btw, this works 
>> perfectly as intended
>>
>> trying to do 1/0
>> {{try:}}
>> {{for a in range(15):}}
>> {{=1/0}}
>> {{pass}}
>> {{except:}}
>> can't divide by 0
>> {{pass}}
>>
>> Il giorno mercoledì 30 maggio 2012 16:15:10 UTC+2, Niphlod ha scritto:
>> didn't test it, but I spot a missing : after "for x in db.test"
>>
>>
>> Il giorno mercoledì 30 maggio 2012 16:08:10 UTC+2, BlueShadow ha 
>> scritto:Hi I like to put a for-loop in a try except clause in an html file.
>> My problem is that the pass from the for loop terminates the try block.
>> {{try:}}
>> {{for x in db.test}}
>> {{=x.title}}
>> {{pass}}
>> {{except:}}
>> no database entries
>> {{pass}}
>>
>>

Re: [web2py] Re: try: for-loop

2012-05-30 Thread Bruno Rocha
len(articles) is not necessary

{{if articles:}}
display whatever you want in a for loop
{{else:}}
display your static message
{{pass}}

On Wed, May 30, 2012 at 12:04 PM, Niphlod  wrote:

> {{if articles and len(articles)>0:}}
> display whatever you want in a for loop
> {{else:}}
> display your static message
> {{pass}}
>



-- 

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


[web2py] Re: try: for-loop

2012-05-30 Thread BlueShadow
OK it obviously has nothing to do with the for loop in try except because 
the for loop finishes when there are no entries in articles. But some basic 
understanding of python should have told me the solution^^
thats what works if anyone is interested:
{{try:}}
{{print article[0].title}}
{{empty=0}}
{{except:}}
{{empty=1}}
{{pass}}
{{if empty==0}}
#for loop
{{else:}}
static message
{{pass}}


[web2py] Re: try: for-loop

2012-05-30 Thread Niphlod
 you're overcomplicating a small issue

{{if articles and len(articles)>0:}}
display whatever you want in a for loop
{{else:}}
display your static message
{{pass}}

Il giorno mercoledì 30 maggio 2012 16:44:22 UTC+2, BlueShadow ha scritto:
>
> I tried it too and for some weird reason it works.
> The missing doublepoint you spotted is in my complete code on my server^^
> what I really want to do is: diyplaying a database entry in a table.
> this entry varies from no entries to about 10.
> I didn't account for the no entries part but I got a bunch of error 
> messages in my log which result from this for loop which is going through 
> the entries Titles if there are none it still requests the tile and crashes
> so
> this is more close to my code:
>
> 
> {{for z in articles:}}
> {{=z.Title}} 
> {{=A(z.Title,_href=URL(r=request,f='article',vars=dict(id=
> z.id)))}}
> {{pass}}
> <\table>
> Now what I want is to skip this loop and display a static message if there 
> are no articles
>
>
>
> Am Mittwoch, 30. Mai 2012 16:19:32 UTC+2 schrieb Niphlod:btw, this works 
> perfectly as intended
>
> trying to do 1/0
> {{try:}}
> {{for a in range(15):}}
> {{=1/0}}
> {{pass}}
> {{except:}}
> can't divide by 0
> {{pass}}
>
> Il giorno mercoledì 30 maggio 2012 16:15:10 UTC+2, Niphlod ha scritto:
> didn't test it, but I spot a missing : after "for x in db.test"
>
>
> Il giorno mercoledì 30 maggio 2012 16:08:10 UTC+2, BlueShadow ha 
> scritto:Hi I like to put a for-loop in a try except clause in an html file.
> My problem is that the pass from the for loop terminates the try block.
> {{try:}}
> {{for x in db.test}}
> {{=x.title}}
> {{pass}}
> {{except:}}
> no database entries
> {{pass}}
>
>

[web2py] alternates to pyjamas/pyjs?

2012-05-30 Thread Larry Wapnitsky
Are there any good alternatives to using pyjamas/pyjs or learning 
JavaScript from scratch?  I've tried installing pyjamas/pyjs on a few of my 
Debian systems (thank G-d for virtual machines), but can't seem to get it 
to run in development.  I've tried from source and followed a ton of 
information on getting it to run on Ubuntu, but no luck.

Thanks,
Larry


[web2py] Re: try: for-loop

2012-05-30 Thread BlueShadow
OK I did some further testing and I'm pretty stupid some basic 
understanding of python would tell me that the for loop finishes without a 
problem if there are no elements in it. 
{{try:}}
{{print articlesformovie[0]}}
{{noarticles=0}}
{{except:}}
{{noarticles=1}}
Es sind bisher keine Artikel zu diesem Film 
geschrieben worden.

{{if noarticles==0:}}
{{for z in articles:}}
{{=z.Title}} 
{{=A(z.Title,_href=URL(r=request,f='article',vars=dict(id=
z.id)))}}
{{pass}}
{{pass}}


[web2py] Re: try: for-loop

2012-05-30 Thread BlueShadow
I tried it too and for some weird reason it works.
The missing doublepoint you spotted is in my complete code on my server^^
what I really want to do is: diyplaying a database entry in a table.
this entry varies from no entries to about 10.
I didn't account for the no entries part but I got a bunch of error 
messages in my log which result from this for loop which is going through 
the entries Titles if there are none it still requests the tile and crashes
so
this is more close to my code:


{{for z in articles:}}
{{=z.Title}} 
{{=A(z.Title,_href=URL(r=request,f='article',vars=dict(id=z.id)))}}

{{pass}}
<\table>
Now what I want is to skip this loop and display a static message if there 
are no articles



Am Mittwoch, 30. Mai 2012 16:19:32 UTC+2 schrieb Niphlod:btw, this works 
perfectly as intended

trying to do 1/0
{{try:}}
{{for a in range(15):}}
{{=1/0}}
{{pass}}
{{except:}}
can't divide by 0
{{pass}}

Il giorno mercoledì 30 maggio 2012 16:15:10 UTC+2, Niphlod ha scritto:
didn't test it, but I spot a missing : after "for x in db.test"


Il giorno mercoledì 30 maggio 2012 16:08:10 UTC+2, BlueShadow ha scritto:Hi 
I like to put a for-loop in a try except clause in an html file.
My problem is that the pass from the for loop terminates the try block.
{{try:}}
{{for x in db.test}}
{{=x.title}}
{{pass}}
{{except:}}
no database entries
{{pass}}



[web2py] tutorial code: recipes modifying it without success

2012-05-30 Thread BlueShadow
Hi I think I took this code from one of massimos tutorial videos:

def recipes():
try:
failtrial=int(request.vars.category)
rows=db(db.recipes.category==request.vars.category).select(orderby=~
db.recipes.submitted)
except:
rows=db().select(db.recipes.ALL, orderby=~db.recipes.submitted)


form=SQLFORM(db.recipes,fields=['category'])
return dict(form=form,recipes=rows)



It displays (with the view file of course) a list of all recipes and a form 
where you can choose a category if you choose one it desplays only the ones 
from that category.
I tried to modify it a little I like to add the functionallity to display 
all recipes from a category but get there with a link.
I thought this would be pretty easy just 
use this line: 
{{=A("recipes",_href=URL(r=request,f='recipes',vars=dict(id=category.id)))}}
but of course this doesn't work I tried a second try except block  with 
id=request.vars.id
but that messes all up.
Thanks for your help guys 


[web2py] Re: try: for-loop

2012-05-30 Thread Niphlod
btw, this works perfectly as intended

trying to do 1/0
{{try:}}
{{for a in range(15):}}
{{=1/0}}
{{pass}}
{{except:}}
can't divide by 0
{{pass}}

Il giorno mercoledì 30 maggio 2012 16:15:10 UTC+2, Niphlod ha scritto:
>
>
> didn't test it, but I spot a missing : after "for x in db.test"
>
>
> Il giorno mercoledì 30 maggio 2012 16:08:10 UTC+2, BlueShadow ha scritto:
>>
>> Hi I like to put a for-loop in a try except clause in an html file.
>> My problem is that the pass from the for loop terminates the try block.
>> {{try:}}
>> {{for x in db.test}}
>> {{=x.title}}
>> {{pass}}
>> {{except:}}
>> no database entries
>> {{pass}}
>>
>>
>>

Re: [web2py] Suggestions for multiple files upload in form

2012-05-30 Thread Richard Vézina
Hello Paolo,

Pretty nice!

Did you implement the update of the records also?

Is it a straight and easy task or it becomes trickier to implement than the
rest of the app??

Richard

On Sat, Oct 29, 2011 at 6:21 PM, Paolo Caruccio
wrote:

> Bruno,
>
> thanks.
>
> What do you think about the upload mechanism? Can it be translate in a
> web2py widget? or is it better to use a different javascript/jquery library?
>
> Regards.
>
> Paolo
>


[web2py] Re: try: for-loop

2012-05-30 Thread Niphlod

didn't test it, but I spot a missing : after "for x in db.test"


Il giorno mercoledì 30 maggio 2012 16:08:10 UTC+2, BlueShadow ha scritto:
>
> Hi I like to put a for-loop in a try except clause in an html file.
> My problem is that the pass from the for loop terminates the try block.
> {{try:}}
> {{for x in db.test}}
> {{=x.title}}
> {{pass}}
> {{except:}}
> no database entries
> {{pass}}
>
>
>

Re: [web2py] try: for-loop

2012-05-30 Thread Bruno Rocha
I think you should not do this, do this kinf of logic on controller, model
or module.

On Wed, May 30, 2012 at 11:08 AM, BlueShadow  wrote:

> Hi I like to put a for-loop in a try except clause in an html file.
> My problem is that the pass from the for loop terminates the try block.
> {{try:}}
> {{for x in db.test}}
> {{=x.title}}
> {{pass}}
> {{except:}}
> no database entries
> {{pass}}
>
>
>


-- 

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


[web2py] Re: Deploy issue - Apache on Windows - Unable to import driver

2012-05-30 Thread Omi Chiba
Are you using 64bit environment ?
I remember I got the error when I tried with python 64bit or something. If 
you are using 64bit, try 32bit and it should work.  

On Wednesday, May 30, 2012 12:57:03 AM UTC-5, Andrew wrote:
>
> The Uniform Server option looks very interesting, as does the newer apache 
> version (I'm trying both).
>
> I'm now stuck with the same issue with both Uniform Server and straight 
> Apache, which is when starting apache or running Uniform "Apache Syntax 
> Check":
> Syntax error on line 197 of .../httpd.conf:  Cannot load 
> /modules/mod_wsgi.so into server.
>
> Line 197 is LoadModule wsgi_module modules/mod_wsgi.so
>
>
> I've downloaded the right files (I think) and followed the instructions.  
> It is in the right spot.   This issue is readily found on various forums so 
> I am now downloading the source code and attempting to recompile 
> mod_wsgi.so.  Don't know why but there is an issue when Python is installed 
> in a non standard path - not sure if that is my issue, but I'll soon find 
> out.
>
>
> On Wednesday, May 30, 2012 1:37:58 AM UTC+12, Omi Chiba wrote:
>>
>> Brian,
>>
>> Thank you for the info ! I also added the information on my blog.
>>
>> On Friday, May 25, 2012 7:32:23 PM UTC-5, Brian M wrote:
>>>
>>> Yep, got burned by this when setting up a new server last month. The 
>>> problem is covered in the pyodbc issue tracker here -  
>>> http://code.google.com/p/pyodbc/issues/detail?id=126 I ended up 
>>> grabbing a build from  http://www.apachelounge.com/download/additional/ and 
>>> then all was good.
>>>
>>> On Friday, May 25, 2012 12:08:59 AM UTC-5, Andrew wrote:

 Oh, Just found this post, which was linked in Omi Chiba's original Blog 
 post:
 https://groups.google.com/forum/?fromgroups#!topic/web2py/EM5Q3yOz63M

 From dlypka:
 The root cause is that the Distribution Windows Build of Apache 2.2 is 
 built with msvcr71.dll which is the C++ runtime dll 
 for Visual Studio 2003!!! But, most recent builds of python .pyd files 
 which link to C/C++ code, are built with msvcr90.dll which is the one 
 from Visual Studio 2008.

 Summary:   There is an issue running pyodbc with apache2.2 on 
 Windows.   
 Solution:  Build Apache yourself with Visual Studio 2008, or use IIS.

 Oh well.  


 On Friday, May 25, 2012 4:54:23 PM UTC+12, Andrew wrote:
>
> It is installed and the app has been working fine with the Rocket http 
> server.  It's just the apache one that doesn't.   Unless I need to 
> install 
> it again in the apache context ? 
>
> On Friday, May 25, 2012 4:05:27 PM UTC+12, Massimo Di Pierro wrote:
>>
>> You need to install pyodbc
>>
>> On Thursday, 24 May 2012 19:41:21 UTC-5, Andrew wrote:
>>>
>>> Hello,
>>> I'm in the process of running web2py on Apache for the first time.  
>>> I found some excellent tutorials on this, such as: 
>>> http://ochiba77.blogspot.co.nz/2011/10/how-to-setup-web2py-apache-wsgi.html,
>>>  
>>> and also Martin Mulone's Blog site.  Thanks for sharing the knowledge 
>>> (BTW, 
>>> I think it makes sense to include this in the book - Deployment 
>>> recipes).
>>>
>>> With a minimal amount of fuss I was able to get the Welcome app to 
>>> come up.  I then pointed to an existing app that connects to a SQL 
>>> Server 
>>> database, and I get the error:
>>> File "E:\TWLApps\web2py\gluon\dal.py", line 2600, in __init__
>>> raise RuntimeError, "Unable to import driver"
>>> RuntimeError: Unable to import driver
>>>
>>> *I stopped Apache and started the normal "python web2py.py "  
>>> and my MSSQL app works fine !*
>>>
>>> So, something with my apache config is stopping web2py finding, or 
>>> loading the (pyodbc?) driver - I think !.
>>> I've searched the forum and web but I haven't found this particular 
>>> issue. Any pointers would be appreciated.
>>>
>>> Thanks
>>> Andrew W
>>>
>>

[web2py] try: for-loop

2012-05-30 Thread BlueShadow
Hi I like to put a for-loop in a try except clause in an html file.
My problem is that the pass from the for loop terminates the try block.
{{try:}}
{{for x in db.test}}
{{=x.title}}
{{pass}}
{{except:}}
no database entries
{{pass}}




[web2py] Re: mydomain.com/#!/ detect and redirect

2012-05-30 Thread Anthony
If you use the parameter-based rewrite system to set a default app, 
controller, and function and specify the list of available functions in the 
default router, then in http://yourdomain.com/code/shortname, code and 
shortname will be interpreted as request.args[1:2], with the request being 
routed to the default app, controller, and function.

Anthony

On Wednesday, May 30, 2012 1:20:00 AM UTC-4, Annet wrote:
>
> Hi Anthony,
>
> Thanks for your reply. I considered a similar solution, but stranded on 
> the idea that the code replacing the '...' in the url are in place of the 
> application name. Isn't that right?
>
>  I thought of catching the code in place of the '...' in the routes.py 
> file in the web2py base folder, but I couldn't figure out how to rewrite 
> the url.
>
>
> Best regards,
>
> Annet.
>


[web2py] Re: form.insert slow when inserting many elements

2012-05-30 Thread Anthony
I think form.insert just does a regular Python list insertion (plus two 
other trivial function calls). Can you show the form.insert code as well as 
your alternative list code?

Anthony

On Wednesday, May 30, 2012 8:12:39 AM UTC-4, DanielB wrote:
>
> Hi,
>
> I have a custom form that has a dynamic size with a for-loop that inserts 
> checkboxes into the form. 
> This works fine in small numbers, but when I increase the number of 
> checkboxes inserted I noticed the page takes longer and longer to load. 
> (obviously it's going to take longer but it's not linear)
>
> It seems that the form.insert code loops through all previous components 
> as well, is this by design and needed?
>
> If I don't use the form.insert and just use a list that I handle myself 
> it's much faster, but uglier and more code than if I could use form.insert.
>
> thankful for answers
>
> /Daniel
>


Re: [web2py] combine Autocomplete widget and SELECT_OR_ADD_OPTION widget

2012-05-30 Thread Johann Spies
On 30 May 2012 14:44, Richard Vézina  wrote:

> Maybe it related to this :
> https://groups.google.com/forum/?fromgroups#!topic/web2py/MzAUt73M_4w
>

In my own apps I have stoped using the autocomplete widget since I
discovered it gave problems on IE-browsers (something confirmed by some
other users on the list).

Since then I have used the suggest-widget as a replacement that works well.

Regards
Johann

-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)


Re: [web2py] Help requested with jquery, bootstrap.modal and grid

2012-05-30 Thread Johann Spies
On 30 May 2012 12:59, R. Osinga  wrote:

> beats me...
>
> I have determined that it is unrelated to this code.  I see it elsewhere
in the app also.


> but for some other improvement,
>
> $(document).ready(function() {
>  $('a[href*="Alternative"]').a**ttr('data-toggle','modal').a**ttr(
> 'data-target','#alt');
> });
>
> Thanks again.

This function is now doing it's job and the dom is marked as requested.
But the result bypasses the modal-part.  I suspect that I will have to find
another way to trigger the modal-function of bootstrap for example just a
clickable element.  I do not (yet) know how to pass the correct variable
from the row to the modal function in such a case.

I have now

Alternative name(s)

in the grid

and I have changed my jquery script to:



$(document).ready(function() {
$('#merkmy').attr({
'data-toggle': 'modal',
'data-target': '#alt'
});


$("a[data-toggle=modal]").click(function() {
event.preventDefault();
target = $(this).attr('data-target');
url = $(this).attr('href');
$(target).load(url);
return false;
});
});


But when I click on the link, it calls up the normal page with the data -
no modal.

I still have a lot to learn about jquery!

Regards
Johann
-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)


[web2py] Re: anonymous login / temporary user login / non-user authentication

2012-05-30 Thread LightDot
So, this would be a one time password that expires? And this data that the 
user views is generated on the fly and also discarded later?

On Wednesday, May 30, 2012 9:09:31 AM UTC+2, Liam wrote:
>
> Dear all,
>
> I'm looking for a way to allow non-users of my application to login given 
> a password (generated by a user) so they can view some of the user's data. 
> Does anyone know if web2py readily supports this? Or perhaps someone has an 
> idea on how to implement it.
>
> Regards,
> Liam
>
>

Re: [web2py] combine Autocomplete widget and SELECT_OR_ADD_OPTION widget

2012-05-30 Thread Richard Vézina
Maybe it related to this :
https://groups.google.com/forum/?fromgroups#!topic/web2py/MzAUt73M_4w

Richard

On Wed, May 30, 2012 at 8:41 AM, Richard Vézina  wrote:

> Ok, about the issue with update, it looks that it comes from
> AutocompleteWidget itself because replacing the widget with the default
> web2py 1.99.4 autocomplete widget and I still get the issue :
>
> #widget = AutocompleteWidgetSelectOrAddOption(request,
> db.table2.table2field1,
> #id_field=db.table2.id, limitby=(0,10), min_length=2,
> #form_title=T('Add new table2 item'), controller="tables",
> #function="add_table2_item", button_text = T('Add new')),
> widget = AutocompleteWidget(request, db.table2.table2field1,
> id_field=db.table2.id, limitby=(0,10), min_length=2),
>
> Strange that I don't get this issue with my own app, but since my own app
> is base on a very old welcome app from web2py 1.6X.X maybe that evolve
> differently that the rest of web2py it could come from template or other
> internal app element and not from web2py itself.
>
> Richard
>
>
> On Tue, May 29, 2012 at 3:44 PM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> Can't link the app too big (thanks to google 4 meg max :( )...
>>
>> Ask me in private I will send you the app directly.
>>
>> Richard
>>
>>
>> On Tue, May 29, 2012 at 3:40 PM, Richard Vézina <
>> ml.richard.vez...@gmail.com> wrote:
>>
>>> Hello,
>>>
>>> Here a demo app, hope it will help for now... It the best I can do now.
>>>
>>>  Try to understand it carefully, if you can make works the slice about
>>> SelectOrAddOption, you will be able to adapt
>>> my AutocompleteWidgetSelectOrAddOption to your needs. So follow the slice
>>> tutorial carefully and transpose to the need widget. Only the part about
>>> *"add" function* that you don't initialize same way, you just pass
>>> everything to the widget like this :
>>> AutocompleteWidgetSelectOrAddOption(request, db.table2.table2field1,
>>> id_field=db.table2.id, limitby=(0,10), min_length=2,
>>> form_title=T('Add new table2 item'), controller="tables",
>>> *function="add_table2_item"*, button_text = T('Add new'))
>>>
>>> There is only one error I can't get rid of is that Add Option trigger a
>>> not belong field error on update form... I don't have this error in my own
>>> app so I should be minor, I will try to find why it not working. I thought
>>> that it could be because of similar name between table so I rename form
>>> field1 to table1field1 and table2field1, not working neither. Will try to
>>> find the origin of the issue.
>>>
>>> NOTE : It base on Autocomplete available in web2py 1.99.4 and it should
>>> works (except the error I am talking about) with web2py 1.99.4.
>>>
>>> TODO : Look for change that Manuele did to autocomplete widget and use
>>> this version of the widget to merge the SelectOrAddOption.
>>>
>>> Richard
>>>
>>>
>>> On Tue, May 29, 2012 at 1:19 PM, Richard Vézina <
>>> ml.richard.vez...@gmail.com> wrote:
>>>
 Ok, I will work on this to allow possible user to have access to this
 ressource.

 I will clean the code a bit and write a tutorial step by step with the
 element to adapt to your context.

 Give me a couples of hours.

 Richard


 On Tue, May 29, 2012 at 6:44 AM, Johann Spies 
 wrote:

> On 25 April 2012 23:48, Richard Vézina wrote:
>
>
>
>> Hope it works for you Johann.
>>
>
> Unfortunately I did not have any success with this recipe.  I can get
> the select_or_add widget working but not this one.
>
> Thanks for your trouble anyhow.
>
> Regards
> Johann
> --
> Because experiencing your loyal love is better than life itself,
> my lips will praise you.  (Psalm 63:3)
>
>

>>>
>>
>


Re: [web2py] combine Autocomplete widget and SELECT_OR_ADD_OPTION widget

2012-05-30 Thread Richard Vézina
Ok, about the issue with update, it looks that it comes from
AutocompleteWidget itself because replacing the widget with the default
web2py 1.99.4 autocomplete widget and I still get the issue :

#widget = AutocompleteWidgetSelectOrAddOption(request,
db.table2.table2field1,
#id_field=db.table2.id, limitby=(0,10), min_length=2,
#form_title=T('Add new table2 item'), controller="tables",
#function="add_table2_item", button_text = T('Add new')),
widget = AutocompleteWidget(request, db.table2.table2field1,
id_field=db.table2.id, limitby=(0,10), min_length=2),

Strange that I don't get this issue with my own app, but since my own app
is base on a very old welcome app from web2py 1.6X.X maybe that evolve
differently that the rest of web2py it could come from template or other
internal app element and not from web2py itself.

Richard


On Tue, May 29, 2012 at 3:44 PM, Richard Vézina  wrote:

> Can't link the app too big (thanks to google 4 meg max :( )...
>
> Ask me in private I will send you the app directly.
>
> Richard
>
>
> On Tue, May 29, 2012 at 3:40 PM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> Hello,
>>
>> Here a demo app, hope it will help for now... It the best I can do now.
>>
>> Try to understand it carefully, if you can make works the slice about
>> SelectOrAddOption, you will be able to adapt
>> my AutocompleteWidgetSelectOrAddOption to your needs. So follow the slice
>> tutorial carefully and transpose to the need widget. Only the part about
>> *"add" function* that you don't initialize same way, you just pass
>> everything to the widget like this :
>> AutocompleteWidgetSelectOrAddOption(request, db.table2.table2field1,
>> id_field=db.table2.id, limitby=(0,10), min_length=2,
>> form_title=T('Add new table2 item'), controller="tables",
>> *function="add_table2_item"*, button_text = T('Add new'))
>>
>> There is only one error I can't get rid of is that Add Option trigger a
>> not belong field error on update form... I don't have this error in my own
>> app so I should be minor, I will try to find why it not working. I thought
>> that it could be because of similar name between table so I rename form
>> field1 to table1field1 and table2field1, not working neither. Will try to
>> find the origin of the issue.
>>
>> NOTE : It base on Autocomplete available in web2py 1.99.4 and it should
>> works (except the error I am talking about) with web2py 1.99.4.
>>
>> TODO : Look for change that Manuele did to autocomplete widget and use
>> this version of the widget to merge the SelectOrAddOption.
>>
>> Richard
>>
>>
>> On Tue, May 29, 2012 at 1:19 PM, Richard Vézina <
>> ml.richard.vez...@gmail.com> wrote:
>>
>>> Ok, I will work on this to allow possible user to have access to this
>>> ressource.
>>>
>>> I will clean the code a bit and write a tutorial step by step with the
>>> element to adapt to your context.
>>>
>>> Give me a couples of hours.
>>>
>>> Richard
>>>
>>>
>>> On Tue, May 29, 2012 at 6:44 AM, Johann Spies wrote:
>>>
 On 25 April 2012 23:48, Richard Vézina wrote:



> Hope it works for you Johann.
>

 Unfortunately I did not have any success with this recipe.  I can get
 the select_or_add widget working but not this one.

 Thanks for your trouble anyhow.

 Regards
 Johann
 --
 Because experiencing your loyal love is better than life itself,
 my lips will praise you.  (Psalm 63:3)


>>>
>>
>


  1   2   >