[web2py] REF: Finding if a date is between two date fields

2014-02-05 Thread Teddy Nyambe
I would like to find out how to achieve this comparison:

row = db(db.mytable.start_date < today < db.mytable.end_date).select()

I am getting this error:

Traceback (most recent call last):
  File
"/Users/teddyl/PycharmProjects/website/web2py/gluon/contrib/shell.py", line
234, in run
exec compiled in statement_module.__dict__
  File "", line 1, in 
TypeError: can't compare datetime.date to Field

But if I try:

row = db(db.mytable.start_date == today).select()

This comparison works, is there another way of doing it?

-- 
...
Teddy Lubasi Nyambe

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Dynamic IS_IN_SET

2014-02-05 Thread Johann Spies
I am trying to build a survey_app for researchers in were I work.  In the
past they gave me a Word document with the survey and I had to build a long
form in web2py.  Now I want them to build their own survey using this app.

In the original way of doing this the survey was one long form and in some
cases I used javascript to hide certain questions depending on particular
options selected in previous questions.

In the new app there will not be one long form, but the questions will be
shown one at a time.

I thought of handling the conditional show of questions in the following
way:

In the 'options'  table (and the IS_IN_SET part is wrong at the moment) I
have:

db.define_table('options',
Field('question_id', db.questions),
Field('option_number', requires = IS_NOT_EMPTY()),
Field('option', requires = IS_NOT_EMPTY()),
Field('dont_show_question', 'reference questions',
  requires = IS_IN_SET(lambda row:
questionlist(row.question_id

where the function question list does this:

def questionlist(question_id):
survey_id = db.questions[question_id]
query = db.questions.id != question_id & db.questions.survey_id ==
survey_id
questionlist = [(x.id, '%s %s' % (x.question_number,
x.question.question))
  for x in db(query).select(db.questions.id,

db.questions.question_number,

db.questions.question)]
return questionlist

My idea is that at the time of creating the researcher can specify which
question must be hidden when a particular option is chosen.

Then when the client answers the survey use the following tables:

db.define_table('answers',
Field('survey_id', db.survey),
Field('question_id', db.questions),
Field('answer', 'text',
  widget = advanced_editor),
Field('option', label = 'Option number'),
Field('sessionid', length=36,
  writable = False, default=lambda:str(uuid.uuid4(

db.define_table('dontshow',
Field('sessionid', length=36,
  requires = IS_NOT_EMPTY()),
Field('question_id', 'reference questions', requires =
  IS_IN_DB(db, 'questions.id', '%(question_number)s')))

The variable 'sessionid'  is created when a client starts the survey.

The second table gets its information when the client select an option
which utilizes the 'dont_show_question' field.  This is then used by the
controller to decide which questions not to show for this session.

If there is an easier way of doing this, I would like to learn from you.

Then also:  How do I correctly use the IS_IN_SET in the options table to
use the questionlist-function?

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

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Adding checkboxes to sqlform.factory and form validation based on another table

2014-02-05 Thread Apple Mason
If we have these simple models:

db.define_table('person', 
Field('name', 'string'))

db.define_table('common_allergies',
Field('name', 'string'))

The common_allergies is a table full of common allergies that people may 
have like 'peanuts' or 'bee stings'. This table is pre-populated by the 
system.

When a user fills out a form, the form asks two things: the person's name 
and the person's allergies.

The form for the person's name is a simple string text input. But the list 
of allergies the person can select needs to be checkboxes. 


I have something like this:

fields = []
allergies = db().select(db.common_allergies.ALL)

for allergy in allergies:
fields.append(Field('allergy', 'boolean', default=allergy.name))

form = SQLFORM.factory(db.person, *fields)

if form.process().accepted:
  # Check to make sure the list of values returned from the allergy 
checkboxes exist in the common_allergies table. If it doesn't exist, fail 
the form validation

  # If all checks went well, insert this person's data into respective 
database tables.

There are two problems with this:
 
  - The boolean fields 'allergy' only shows one checkbox, which is the last 
one in the list when I do {{=form.custom.widget.allergy}} in the view. How 
do I get back a list of allergies that have been checked by the user?

  - The value of the checkbox can be changed on the clientside and then 
submitted. How would I check against this and make sure that the submitted 
allergy values exist in the database table? Assuming I have a list returned 
to me, I could do something like this inside form.process().accepted:

if form.process().accepted:
 should_save = True
 for allergy in checked_allergies:
   check = db(db.common_allergies.name==allergy).select()
   if check.is_empty():
 # error the form
 should_save = False
   
 if should_save:
  # Save the user's data

But this seems a bit messy and complicated.

How would I generate the checkboxes for the common_allergies table and how 
would these checkbox values be validated against the database table to 
prevent client-side tampering?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: how to keep request when redirecting

2014-02-05 Thread Tim Richardson
redirect starts a new request.

I suppose your redirect URL can contain args and vars based on what comes 
in (see docs on the URL function), and then it would be up to the 
redirected controller to process them. In other words, you pass state in 
the URL. 
Your controller or view could use these get_vars or args to set form 
elements as you wish, or the view could embed those settings in javascript, 
which then takes effect on page load.

Another option is to use web2py's component. Instead of reloading the whole 
page and creating a new request, the submit actions refresh a component in 
the page which contains the grid or form which has the data you want to 
refresh. In this case, you never leave the page you are on. This looks 
better too, it's very smooth. Read the components chapter in the book. 




On Monday, 3 February 2014 04:21:44 UTC+11, aapaap wrote:
>
> hello, 
>
> I've a form with checkboxes and radiobuttons. 
> All the checkboxes and radioboxes are auto-commit, i.e. the have an 
> argument 
> onchange="this.form.submit()" 
>
> Now this works perfect, as soon as a button is changed, the page is 
> refreshed with a new selection from the database. 
>
> Now I've some other actions on this form, which are realized by a link. 
>
> This link points to a "controler" that does some action and then 
> redirects to the orginal form. 
> But now the settings of the checkboxes and radiobuttons is lost, 
> I assume the request and specially the "request.post_vars" ar lost. 
>
> The "controler" looks like : 
>
> @auth.requires_login() 
> def Block_Page(): 
>if auth.user.id in Beheerders and request.args : 
>  ID = request.args [0] 
>  db ( db.Knutsels.id == ID ).update ( Approved_Date = None ) 
>redirect ( URL ( Show_Knutselen )) 
>
> thanks, 
> Stef 
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Adding checkboxes to sqlform.factory and form validation based on another table

2014-02-05 Thread Apple Mason
 
 I forgot to highlight code samples in my last post. Sorry about that.



If we have these simple models:

db.define_table('person', 
Field('name', 'string'))

db.define_table('common_allergies',
Field('name', 'string'))



The common_allergies is a table full of common allergies that people may 
have like 'peanuts' or 'bee stings'. This table is pre-populated by the 
system.

When a user fills out a form, the form asks two things: the person's name 
and the person's allergies.

The form for the person's name is a simple string text input. But the list 
of allergies the person can select needs to be checkboxes. 


I have something like this:

fields = []
allergies = db().select(db.common_allergies.ALL)

for allergy in allergies:
fields.append(Field('allergy', 'boolean', default=allergy.name))

form = SQLFORM.factory(db.person, *fields)

if form.process().accepted:
  # Check to make sure the list of values returned from the allergy 
checkboxes exist in the common_allergies table. If it doesn't exist, fail 
the form validation

  # If all checks went well, insert this person's data into respective 
database tables.



There are two problems with this:
 
  - The boolean fields 'allergy' only shows one checkbox, which is the last 
one in the list when I do {{=form.custom.widget.allergy}} in the view. How 
do I get back a list of allergies that have been checked by the user?

  - The value of the checkbox can be changed on the clientside and then 
submitted. How would I check against this and make sure that the submitted 
allergy values exist in the database table? Assuming I have a list returned 
to me, I could do something like this inside form.process().accepted:

if form.process().accepted:
 should_save = True
 for allergy in checked_allergies:
   check = db(db.common_allergies.name==allergy).select()
   if check.is_empty():
 # error the form
 should_save = False
   
 if should_save:
  # Save the user's data



But this seems a bit messy and complicated.

How would I generate the checkboxes for the common_allergies table and how 
would these checkbox values be validated against the database table to 
prevent client-side tampering?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] REF: Finding if a date is between two date fields

2014-02-05 Thread Johann Spies
Try

query = db.mytable.start_date < today & db.mytable.end_date > today
row = db(query).select()

This works for me:

surveylist = [(x.id, x.name) for x in db(
(db.survey.startdate <= today)&
(db.survey.enddate >= today)).select(db.survey.id,
 db.survey.name)]


Regards
Johann



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

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] heads up if you localized your app and upgrade to version 2.8.2+

2014-02-05 Thread step
Just a heads up to those who localized their apps and upgrade to a recent 
web2py version - I noticed this change in upgrading from 2.6.4 to 2.8.2.
A number of error messages in file gluon/validators.py have changed by 
capitalizing the error message, e.g., 'value not in database' became 'Value 
not in database'.
You need to change your language files to match the new spelling otherwise 
non-localized messages will start popping up in your forms.
grep -E 'error_message ?=' gluon/validators.py


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] error postgresql with table new :S

2014-02-05 Thread Johann Spies
On 5 February 2014 06:35, Luis Díaz  wrote:


> ProgrammingError: permiso denegado a la relación denuncia
>
> Error snapshot
>
> (permiso denegado a la relación
> denuncia )--
>
>
>
Who is the owner of the database in Postgresql? And of table 'denuncia'?
Does user 'usuario'  have rights to that database?

The message is that Postgresql is refusing access.

Regards
Johann

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

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: sqlform.grid and links

2014-02-05 Thread Tim Richardson

auth_user is a table, not a database; is "info" a table as well, in the 
same database? 

What do you want to happen? Do you want to display a value from the info 
table, or do you want user to view/edit a record in the info table via 
clicking on a link?

There is smartgrid which adds some intelligence about tables with 
parent/child relationships. Have a look at this. 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] web2py mail

2014-02-05 Thread Jayadevan M
When I try to execute the email program, I get this error - 
 web2py - WARNING - Mail.send failure:[Errno 111] Connection refused
I think iptables on the machine where web2py is running is blocking the 
request. Which port should I open to let this through?
The code works on my m/c, which does not have iptables enabled.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: web2py mail

2014-02-05 Thread Jayadevan M
Yes. I stopped iptables and the program worked. Kindly let me know which 
port I should open.

On Wednesday, February 5, 2014 4:17:28 PM UTC+5:30, Jayadevan M wrote:
>
> When I try to execute the email program, I get this error - 
>  web2py - WARNING - Mail.send failure:[Errno 111] Connection refused
> I think iptables on the machine where web2py is running is blocking the 
> request. Which port should I open to let this through?
> The code works on my m/c, which does not have iptables enabled.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] heads up if you localized your app and upgrade to version 2.8.2+

2014-02-05 Thread Kiran Subbaraman
Will making the translator (T) use the messages in a case-insensitive 
manner eliminate the need to do this?
I am not sure what needs to be done here exactly, but am guessing it 
goes in here 
https://github.com/web2py/web2py/blob/7bc603f38053ec80cbce9f25c4413aae550c7b4f/gluon/languages.py, 
with look ups done for completely lower-cased messages?



Kiran Subbaraman
http://subbaraman.wordpress.com/about/

On Wed, 05-02-2014 3:24 PM, step wrote:
Just a heads up to those who localized their apps and upgrade to a 
recent web2py version - I noticed this change in upgrading from 2.6.4 
to 2.8.2.
A number of error messages in file gluon/validators.py have changed by 
capitalizing the error message, e.g., 'value not in database' became 
'Value not in database'.
You need to change your language files to match the new spelling 
otherwise non-localized messages will start popping up in your forms.

|
grep -E 'error_message ?='gluon/validators.py
|


--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google 
Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to web2py+unsubscr...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.


--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups "web2py-users" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: web2py mail

2014-02-05 Thread Jayadevan M
Answer was 587.
iptables -A OUTPUT -p tcp -m tcp --dport 587 -j ACCEPT


On Wednesday, February 5, 2014 4:26:38 PM UTC+5:30, Jayadevan M wrote:
>
> Yes. I stopped iptables and the program worked. Kindly let me know which 
> port I should open.
>
> On Wednesday, February 5, 2014 4:17:28 PM UTC+5:30, Jayadevan M wrote:
>>
>> When I try to execute the email program, I get this error - 
>>  web2py - WARNING - Mail.send failure:[Errno 111] Connection refused
>> I think iptables on the machine where web2py is running is blocking the 
>> request. Which port should I open to let this through?
>> The code works on my m/c, which does not have iptables enabled.
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: login_next and next var

2014-02-05 Thread Annet
Hi Jonathan,

Thanks for your reply.

It's a URL; it's just %-escaped because it's in a query string (vars).
>

 You're right, redirect(request.vars._next) does work.


Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] IS_IN_SET() value instead of key

2014-02-05 Thread Annet
In a table definition I have the following field and requirement:

Field('groupStatusID', type='integer', requires=IS_IN_SET([(1, 'Pending'), 
(2, 'Accepted'), (3, 'Blocked')]))


In a view I have:

{{=r.grp_membership.groupStatusID}}

Which displays a 1, 2 or 3. I wonder whether it is possible to display the 
value
instead of the key. Something like the IS_IN_DB() validator and represent.


Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] sessions2trash.py

2014-02-05 Thread Jayadevan M
I have set the sessions2trash  script in my web2py.ini (for uwsgi) like 
this - 

cron = 0 0 -1 -1 -1 python /var/www/web2py/web2py.py -Q -S myapp -M -R 
scripts/sessions2trash.py -A -o -v

My uwsgi.log says 

[uwsgi-cron] command "python /var/www/web2py/web2py.py -Q -S myapp -M -R 
scripts/sessions2trash.py -A -o -v" registered as cron task

I checked auth expiration settings also - 
>>> print auth.settings.expiration
3600

But session files are not getting deleted. What could be the reason?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] One big app vs. cooperating apps: thoughts? advice?

2014-02-05 Thread Cliff Kachinske
I want a web site something like this:

Home page mostly devoted to marketing.
Menu at the top of the home page has links to, for example, a demo, my 
blog, other marketing stuff and a login link.

By logging in the user will get access to live applications. The menu will 
change to reflect the available apps.

I can do this with a single big application or I can create cooperating 
applications.

Does anyone have thoughts on the pros and cons of each approach? All 
comments gladly accepted. 

Thank you,
Cliff Kachinske

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: sessions2trash.py

2014-02-05 Thread Niphlod
if you start it outside uwsgi, you'll see the verbose output (given you're 
passing -v as an option)

On Wednesday, February 5, 2014 2:26:04 PM UTC+1, Jayadevan M wrote:
>
> I have set the sessions2trash  script in my web2py.ini (for uwsgi) like 
> this - 
>
> cron = 0 0 -1 -1 -1 python /var/www/web2py/web2py.py -Q -S myapp -M -R 
> scripts/sessions2trash.py -A -o -v
>
> My uwsgi.log says 
>
> [uwsgi-cron] command "python /var/www/web2py/web2py.py -Q -S myapp -M -R 
> scripts/sessions2trash.py -A -o -v" registered as cron task
>
> I checked auth expiration settings also - 
> >>> print auth.settings.expiration
> 3600
>
> But session files are not getting deleted. What could be the reason?
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: sessions2trash.py

2014-02-05 Thread Jayadevan M


I did that and straced the process. Output says - 
strace -p 19227
Process 19227 attached - interrupt to quit
select(0, NULL, NULL, NULL, {37, 995138}) = 0 (Timeout)
gettimeofday({1391609487, 826517}, NULL) = 0
stat("/etc/localtime", {st_mode=S_IFREG|0644, st_size=3519, ...}) = 0
gettimeofday({1391609487, 827202}, NULL) = 0
stat("/etc/localtime", {st_mode=S_IFREG|0644, st_size=3519, ...}) = 0
open("applications/myapp/sessions", 
O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 4
getdents(4, /* 2 entries */, 32768) = 48
getdents(4, /* 0 entries */, 32768) = 0
close(4)= 0
select(0, NULL, NULL, NULL, {300, 0}

Command used was - 
 /var/www/web2py/web2py.py -Q -S myapp  -M -R scripts/sessions2trash.py   
--verbose

On Wednesday, February 5, 2014 7:07:38 PM UTC+5:30, Niphlod wrote:
>
> if you start it outside uwsgi, you'll see the verbose output (given you're 
> passing -v as an option)
>
> On Wednesday, February 5, 2014 2:26:04 PM UTC+1, Jayadevan M wrote:
>>
>> I have set the sessions2trash  script in my web2py.ini (for uwsgi) like 
>> this - 
>>
>> cron = 0 0 -1 -1 -1 python /var/www/web2py/web2py.py -Q -S myapp -M -R 
>> scripts/sessions2trash.py -A -o -v
>>
>> My uwsgi.log says 
>>
>> [uwsgi-cron] command "python /var/www/web2py/web2py.py -Q -S myapp -M -R 
>> scripts/sessions2trash.py -A -o -v" registered as cron task
>>
>> I checked auth expiration settings also - 
>> >>> print auth.settings.expiration
>> 3600
>>
>> But session files are not getting deleted. What could be the reason?
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Masking User Input

2014-02-05 Thread Greg Vaughan
Hi everyone,

Building a series of telemarketing and sales forms for a friends company to 
use. 

Looking to utilise an input mask such as the one mentioned in this post. 

https://groups.google.com/forum/#!searchin/web2py/form$20input$20mask$20jquery/web2py/zRt9whk6y68/3jqiiRII9QYJ
 


and wanted to check if there were any potential issues. Particularly in 
relation to Niphlod's comment in that post.

Is there any important reason that the jquery plugin mentioned could not be 
used?  

I am not looking for it to validate data (I use a regex to do that) but it 
is far preferable to guide the user to input correct data in the first 
place and a format mask is an aesthetically pleasing way to do this.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] How to upload file to copy.com?

2014-02-05 Thread Tiana A. Ralijaona
Hi everyone,

Is there a way for a web2py app to upload a file to www.copy.com (a file 
hosting provider) instead of uploading it to the server local file system ?

Thanks in advance,

Tiana R.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] emacs and web2py

2014-02-05 Thread François-Xavier Bois
Hi,
I would like to announce that web-mode.el, an emacs major mode for editing 
web templates, is now compatible with web2py templates.
web-mode.el is available on http://web-mode.org
Cheers

fxbois

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
<>

[web2py] How can you put computed fields in select statements and specifically groupby ?

2014-02-05 Thread artdijk
Consider the following query

rows = db(db.table).select(x,y groupby = x)

If x and y are table fields this obviously works.

Now consider

group = x/100

rows = db(db.table).select(group,y, groupby = group)

This also works nicely and will group into groups for each x with a value 
of x divided by 100, but is of little use.

However, the following fails:

group = math.floor(x/100) and throws the exception function doesn't have 
attribute type

The intent is to group numeric values into ranges, so I am trying to 
implement a  slightly more complex function which returns a range 
indicator, perhaps as a string (e.g. "100-200"), but in order to get that 
working first the simple case of using the result of a function needs to be 
solved.

In plain SQL calling a function is an option, perhaps it is a limitation of 
the DAL

thnx
Arthur

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Upload file to copy.com

2014-02-05 Thread Tiana A. Ralijaona
Hi everyone,

Is there a way for a web2py app, instead of uploading a file to the server 
local file system, to upload a file to a www.copy.com account?

Thanks in advance,

Tiana R.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] How-to: read-only resource for a few controllers, load once, read many

2014-02-05 Thread r . ryogesh

Hi,
I am using web2py v2.8.2.  My command line to launch web2py is "python 
web2py -i 0.0.0.0" .  I am using python 2.7.5
I have a fair sized dataset, takes about 10sec to load from the datafiles 
and perform some calc for lookup.

Code is something like this:
lookup_data = fn_datalookup(filespath)

I want to expose the lookup_data to a few controllers, but i want web2py to 
load it only once and make it available to controllers that make the 
request. Yes, global variable. Load once, read many as long as web2py is 
up. Reason is : I don't want to loose 10sec on every request that needs to 
work on this dataset.

I tried the following:
1. In a new model file: Call gets executed by all controllers, every time, 
i.e. 10sec loss on every request in the app. Not a recommended approach 
(based on documentation). Hence not good
 
2. In specific controllers: Takes 10sec to load on all valid calls, but 
still not good. I don't want to loose 10sec on all valid requests.

During web2py startup, can i load once and make it available as a global 
read-only? If yes, how?

If this has been answered before, please point to the post and i will 
gladly read and learn from the answered post. My search didn't yield the 
results.

Another problem:
I noticed that the memory usage(VSZ, RSS) keeps going up and never came 
down in both the above cases. i.e. every new call increased the memory 
usage. I waited for more than an hour (with no activity), still didn't come 
down
Web2py runs as a single process, doesn't spawn any new process on 
requests Where can i find documentation on how web2py allocates and 
deallocates resources and some best practices when working on long running 
processes, large datasets.

Thanks,
Yogesh

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Installing web2py

2014-02-05 Thread Rahul Choudhary
I am using a Chromebook which can run only web based applications. How can 
i use web2py for development? I cannot download and install. I am a student 
and I want to learn web development. Is there any way I can use web2py or 
any other framework?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] DAL Function in select

2014-02-05 Thread artdijk
How can we make this to work:

group = math.floor(x/25)

rows = db("table").select(group, y, groupby = group)

The above throws an exeption: funtion has no attribute type.

Ultimately we would like to group on a numeric value that is in a range. 
e.g. group the records for x >0 and <500 and for x >500 and <1000 etc.

Thnx
Arthur





-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] [Errno 21] Is a directory error while implementing Multiupload

2014-02-05 Thread Pawan Gupta
Hi

I am a newbie to web2py and I'm just learning. I am trying to implement 
Multiupload in my code as suggested on this 
thread https://groups.google.com/forum/#!topic/web2py/XpnUb2_MaRc

I am getting an error "*[Errno 21] is a directory*" while specifying the 
upload directory in my db.py model. I am stuck at this for many hours, can 
someone please help. I am copy pasting my table below. Below it is the 
table which works perfectly fine although the upload folder is the same. 

Any help of lead would be highly appreciated! Thanks a lot :)

db.define_table('newsfeed',
Field 
('body','text',represent=lambda
 text, row: XML 
(text.replace('\n', ''))),
Field 
('imFlag','boolean',readable=False,
 writable=False, default=False),
Field ('image', 
'upload', uploadfolder="../uploads/", notnull=False, # notnull=False is required
label=T ('Image'),
represent = lambda x, row: CAT 
(A 
(IMG 
(_src=URL 
('static','uploads/%s'%x),
 
_style='width:50px;height:50px;border:0;'),
   
_style='display:block;width:50px;height:50px;padding:3px;background:#fc0;text-decoration:none;',
   _title='click to 
enlarge',**{'_href':"#pic%s"%row.id,'_data-toggle':"modal"}),
   DIV 
(SPAN 
('%s 
[%s]'%(row.body,db.newsfeed.image.retrieve(x)[0])),TAG 
.BUTTON(XML 
('×'), _class="close", 

_style='display:block;margin:0 5px 9px 0;', **{'_data-dismiss':"modal"}),
DIV 
(IMG 
(_src=URL 
('static','uploads/%s'%x))),
_class="modal hide 
fade",
   _id="pic%s"%row.id,
   
_style="width:auto;height:auto;padding:5px;top:33%;"))
or ''
   ),
#Field('image', 'upload',uploadfolder="../uploads/"), 
Field 
('vidFlag','boolean',readable=False,
 writable=False, default=False),
Field 
('dmFlag','boolean',readable=False,
 writable=False, default=False),
Field 
('youtube_url','text', 
label='Video Link'),
Field ('share_with', 
requires = IS_IN_SET 
(["Everyone","Only my 
network", "Connections of Connections"], zero=T 
('Choose One'))),
#Field('thumbnail','upload', readable=False, writable=False),
Field ('created_by', 
'reference auth_user', readable=False, writable=False, default=auth.user_id),
Field ('created_on', 
'datetime',readable=False, writable=False, default=request 
.now),
Field 
('likes','integer',readable=False,
 writable=False, default=0))

At the same time the following code works perfectly fine:

db.define_table('newsfeed',
Field 
('body','text',represent=lambda
 text, row: XML 
(text.replace('\n', ''))),
Field 
('imFlag','boolean',readable=False,
 writable=False, default=False),
Field ('image', 
'upload',uploadfolder="../uploads/"), 
Field 
('vidFlag','boolean',readable=False,
 writable=False, default=False),
Field 
('dmFlag','boolean',readable=False,
 writable=False, default=False),
Field 


Re: [web2py] IS_IN_SET() value instead of key

2014-02-05 Thread Richard Vézina
What happen if you do this : IS_IN_SET([('Pending', 1), ('Accepted', 2),
('Blocked', 3)]))

??

Richard


On Wed, Feb 5, 2014 at 8:10 AM, Annet  wrote:

> In a table definition I have the following field and requirement:
>
> Field('groupStatusID', type='integer', requires=IS_IN_SET([(1, 'Pending'),
> (2, 'Accepted'), (3, 'Blocked')]))
>
>
> In a view I have:
>
> {{=r.grp_membership.groupStatusID}}
>
> Which displays a 1, 2 or 3. I wonder whether it is possible to display the
> value
> instead of the key. Something like the IS_IN_DB() validator and represent.
>
>
> Kind regards,
>
> Annet
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Installing web2py

2014-02-05 Thread Richard Vézina
You may try this :
https://groups.google.com/d/msg/web2py/dEdQh9tQR9g/_0JQM19IznsJ

Though I think the web2py instance get delete on day basis... But you can
just pack your app and go over the process again the next day...

:)

Richard


On Tue, Feb 4, 2014 at 1:13 PM, Rahul Choudhary  wrote:

> I am using a Chromebook which can run only web based applications. How can
> i use web2py for development? I cannot download and install. I am a student
> and I want to learn web development. Is there any way I can use web2py or
> any other framework?
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Installing web2py

2014-02-05 Thread Nico Zanferrari
You can simply use PythonAnywhere on https://www.pythonanywhere.com , which
is also covered in the official documentation (
http://web2py.com/books/default/chapter/29/13/deployment-recipes#Deploying-on-PythonAnywhere
)

As they say: "PythonAnywhere is a Python development and hosting
environment that displays in your web browser and runs on our servers.
They're already set up with everything you need. It's easy to use, fast,
and powerful. There's even a useful free plan.". You could be easy
developing with Web2py in few minutes!

Cheers,
Nico


2014-02-04 Rahul Choudhary :

> I am using a Chromebook which can run only web based applications. How can
> i use web2py for development? I cannot download and install. I am a student
> and I want to learn web development. Is there any way I can use web2py or
> any other framework?
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: emacs and web2py

2014-02-05 Thread Massimo Di Pierro
This is really nice. Thank you for posting it.

On Tuesday, 4 February 2014 15:22:14 UTC-6, François-Xavier Bois wrote:
>
> Hi,
> I would like to announce that web-mode.el, an emacs major mode for editing 
> web templates, is now compatible with web2py templates.
> web-mode.el is available on http://web-mode.org
> Cheers
>
> fxbois
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: How-to: read-only resource for a few controllers, load once, read many

2014-02-05 Thread Massimo Di Pierro
Are you doing any caching? Which OS?

On Tuesday, 4 February 2014 19:33:35 UTC-6, r.ry...@gmail.com wrote:
>
>
> Hi,
> I am using web2py v2.8.2.  My command line to launch web2py is "python 
> web2py -i 0.0.0.0" .  I am using python 2.7.5
> I have a fair sized dataset, takes about 10sec to load from the datafiles 
> and perform some calc for lookup.
>
> Code is something like this:
> lookup_data = fn_datalookup(filespath)
>
> I want to expose the lookup_data to a few controllers, but i want web2py 
> to load it only once and make it available to controllers that make the 
> request. Yes, global variable. Load once, read many as long as web2py is 
> up. Reason is : I don't want to loose 10sec on every request that needs to 
> work on this dataset.
>
> I tried the following:
> 1. In a new model file: Call gets executed by all controllers, every time, 
> i.e. 10sec loss on every request in the app. Not a recommended approach 
> (based on documentation). Hence not good
>  
> 2. In specific controllers: Takes 10sec to load on all valid calls, but 
> still not good. I don't want to loose 10sec on all valid requests.
>
> During web2py startup, can i load once and make it available as a global 
> read-only? If yes, how?
>
> If this has been answered before, please point to the post and i will 
> gladly read and learn from the answered post. My search didn't yield the 
> results.
>
> Another problem:
> I noticed that the memory usage(VSZ, RSS) keeps going up and never came 
> down in both the above cases. i.e. every new call increased the memory 
> usage. I waited for more than an hour (with no activity), still didn't come 
> down
> Web2py runs as a single process, doesn't spawn any new process on 
> requests Where can i find documentation on how web2py allocates and 
> deallocates resources and some best practices when working on long running 
> processes, large datasets.
>
> Thanks,
> Yogesh
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Started web2py - doesn't not offer to run on my local IP

2014-02-05 Thread Massimo Di Pierro
Python does not always detect your addresses. You should be fine if you 
choose 0.0.0.0.

On Tuesday, 4 February 2014 20:54:47 UTC-6, Jim S wrote:
>
> See attached screenshot.  ipconfig on my machine shows my IPv4 Address as 
> 192.168.125.112.
>
> But, web2py doesn't offer this as an IP to use for my testing.
>
> Can anyone tell me how to get my local IP available to use?  Need to test 
> with iPad
>
> -Jim
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: One big app vs. cooperating apps: thoughts? advice?

2014-02-05 Thread Massimo Di Pierro
You would make different applications if they are supposed to be deployed 
individually and independently. Else you make a single app with difference 
controllers. If paces are to be user reusable, call those controllers 
plugin_.

On Wednesday, 5 February 2014 07:26:48 UTC-6, Cliff Kachinske wrote:
>
> I want a web site something like this:
>
> Home page mostly devoted to marketing.
> Menu at the top of the home page has links to, for example, a demo, my 
> blog, other marketing stuff and a login link.
>
> By logging in the user will get access to live applications. The menu will 
> change to reflect the available apps.
>
> I can do this with a single big application or I can create cooperating 
> applications.
>
> Does anyone have thoughts on the pros and cons of each approach? All 
> comments gladly accepted. 
>
> Thank you,
> Cliff Kachinske
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] how to make complex dynamic form

2014-02-05 Thread Andrey K
Dear web2py members, 
I have a question for you.
I would like to make a dynamic form which looks like below picture (it is 
easier to represent my question as a sketch rather than wording).
The  form suppose to allow user to add tool with 1 or many parameters. Form 
should consist of:
tool name,
tool description(text) and 
as *many tool parameters* as user wants *dynamically.*

Each parameter consist of *4 properties*: 
 default 
value, 
 comment 
(as string), 
 help (as 
text), 
 data_type 
(as list:string). 

I would like to  save the form data into 3tables: db.tool and db.tool_param 
and tool_ax (see below: mytables)

I have been trying for several days to use following web2py UI elements: 
list:string, 
Field(IS_IN_SET([...],multiple=True), Field(SQLFORM.widgets.multiple.widget).
But I can't make exactly what I want. 

Can you please help me with this pazel? Any advice or suggestion - would be 
greatly appreciated!
I would like to make a dynamic form which looks like below picture (it is 
easier to represent my question as a sketch rather than wording).
The  form suppose to allow user to add tool with 1 or many parameters. Form 
should consist.
tool name,
tool description(text) and 
as *many tool parameters* as user wants *dynamically*, 
each parameter consist of *4 properties*: 
 default 
value, 
 comment 
(as string), 
 help (as 
text), 
 data_type 
(as list:string). 

I would like to  save the form data into 3tables: db.tool and db.tool_param 
and tool_ax (see below: mytables)


I have been trying for several days to use following web2py UI elements: 
list:string, 
Field(IS_IN_SET([...],multiple=True), Field(SQLFORM.widgets.multiple.widget).
But I can't make exactly what I want. 

Can you please help me with this pazel? Any advice or suggestion - would be 
greatly appreciated!


*mytables:*
db.define_table('*tool*',
Field('name', 'string'),
Field('description', 'text'))

tool - stores name and description of the tools

db.define_table('*tool_param*',
Field('tool', 'reference tool'),
Field('toolA1'),
Field('toolA2'),
Field('toolA3'),
Field('toolB1'),
Field('toolB2'),
Field('toolC1'))

*tool_param - *store parameters of the tool. Each field name is constracted 
like following: toolA_1 =db.tool.name +param#.
Except 'tool' - wich reference to db.tool.id

db.define_table(*'tool_ax*',
Field('tool', 'reference tool'),
Field('default_value', 'string')
Field('data_type', 'string'),
Field('comment', 'string'),
Field('help', 'text'))

*tool_ax** - *stores param properties

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] heads up if you localized your app and upgrade to version 2.8.2+

2014-02-05 Thread step
Maybe it would help in some cases, but I don't think it would work in a 
general sense. Some languages may rely on case-sensitivity to provide 
different translations of a sentence. If T() had an option to look up 
case-insensitively web2py devs would need to know all target languages 
before they could evaluate if it's safe to call such option on a sentence 
in the gluon code.
Mmm, maybe a global setting could work better than a new argument to T(). 
An app developer could set a global setting that affects the way T() looks 
up its translation keys for gluon and all other modules/application files.

On Wednesday, February 5, 2014 12:00:11 PM UTC+1, Kiran Subbaraman wrote:
>
>  Will making the translator (T) use the messages in a case-insensitive 
> manner eliminate the need to do this?
> I am not sure what needs to be done here exactly, but am guessing it goes 
> in here 
> https://github.com/web2py/web2py/blob/7bc603f38053ec80cbce9f25c4413aae550c7b4f/gluon/languages.py,
>  
> with look ups done for completely lower-cased messages?
>
> 
> Kiran Subbaramanhttp://subbaraman.wordpress.com/about/
>
> On Wed, 05-02-2014 3:24 PM, step wrote:
>  
> Just a heads up to those who localized their apps and upgrade to a recent 
> web2py version - I noticed this change in upgrading from 2.6.4 to 2.8.2.
> A number of error messages in file gluon/validators.py have changed by 
> capitalizing the error message, e.g., 'value not in database' became 'Value 
> not in database'.
> You need to change your language files to match the new spelling otherwise 
> non-localized messages will start popping up in your forms.
>  grep -E 'error_message ?=' gluon/validators.py
>  
>
>  -- 
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> --- 
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to web2py+un...@googlegroups.com .
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>  

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: Started web2py - doesn't not offer to run on my local IP

2014-02-05 Thread Jim Steil
Thanks Massimo.  Will give it a run tonight.


On Wed, Feb 5, 2014 at 8:55 AM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> Python does not always detect your addresses. You should be fine if you
> choose 0.0.0.0.
>
>
> On Tuesday, 4 February 2014 20:54:47 UTC-6, Jim S wrote:
>>
>> See attached screenshot.  ipconfig on my machine shows my IPv4 Address as
>> 192.168.125.112.
>>
>> But, web2py doesn't offer this as an IP to use for my testing.
>>
>> Can anyone tell me how to get my local IP available to use?  Need to test
>> with iPad
>>
>> -Jim
>>
>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/EMXWyxoZ3Vg/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] HTML Input (POST) field

2014-02-05 Thread Austin Taylor
This is driving me insane!! I've been trying to create an input field for a 
user to type in an IP address.

I then want to assign their input to a variable, run it through my IP 
checks and return the result from our SQL database.

In a nutshell, how can I assign their input to a variable (I'm thinking 
request.vars??) and then run it through a series of checks under 
myapp/controllers and return the result.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: One big app vs. cooperating apps: thoughts? advice?

2014-02-05 Thread Cliff Kachinske
Thank you.

On Wednesday, February 5, 2014 9:58:21 AM UTC-5, Massimo Di Pierro wrote:
>
> You would make different applications if they are supposed to be deployed 
> individually and independently. Else you make a single app with difference 
> controllers. If paces are to be user reusable, call those controllers 
> plugin_.
>
> On Wednesday, 5 February 2014 07:26:48 UTC-6, Cliff Kachinske wrote:
>>
>> I want a web site something like this:
>>
>> Home page mostly devoted to marketing.
>> Menu at the top of the home page has links to, for example, a demo, my 
>> blog, other marketing stuff and a login link.
>>
>> By logging in the user will get access to live applications. The menu 
>> will change to reflect the available apps.
>>
>> I can do this with a single big application or I can create cooperating 
>> applications.
>>
>> Does anyone have thoughts on the pros and cons of each approach? All 
>> comments gladly accepted. 
>>
>> Thank you,
>> Cliff Kachinske
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Use of Upper- and Lower case in table and field definitions

2014-02-05 Thread ArtDijk

LS,
We noticed issues with Upper and Lower case field and table defintions. It 
looks that when we use web2py in combination with postgres all table and 
field names must be in lowercase. 
Is it correct that when using postgres and table and field definitions must 
be in lowercase ?
Is this also true for e.g. MySQL ?
Is there some document that explains when or how to use upper and lower 
case in table and field names ?

Thank you
Arthur

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: how to make complex dynamic form

2014-02-05 Thread Cliff Kachinske
JQuery would work for the dynamic form.

On form submission you would have to manually validate the fields added by 
JQuery. It's not difficult, but you must remember to do it.

On Wednesday, February 5, 2014 10:11:51 AM UTC-5, Andrey K wrote:
>
> Dear web2py members, 
> I have a question for you.
> I would like to make a dynamic form which looks like below picture (it is 
> easier to represent my question as a sketch rather than wording).
> The  form suppose to allow user to add tool with 1 or many parameters. 
> Form should consist of:
> tool name,
> tool description(text) and 
> as *many tool parameters* as user wants *dynamically.*
>
> Each parameter consist of *4 properties*: 
>  default 
> value, 
>  comment 
> (as string), 
>  help (as 
> text), 
>  data_type 
> (as list:string). 
>
> I would like to  save the form data into 3tables: db.tool and 
> db.tool_param and tool_ax (see below: mytables)
>
> I have been trying for several days to use following web2py UI elements: 
> list:string, 
> Field(IS_IN_SET([...],multiple=True), Field(SQLFORM.widgets.multiple.widget).
> But I can't make exactly what I want. 
>
> Can you please help me with this pazel? Any advice or suggestion - would 
> be greatly appreciated!
> I would like to make a dynamic form which looks like below picture (it is 
> easier to represent my question as a sketch rather than wording).
> The  form suppose to allow user to add tool with 1 or many parameters. 
> Form should consist.
> tool name,
> tool description(text) and 
> as *many tool parameters* as user wants *dynamically*, 
> each parameter consist of *4 properties*: 
>  default 
> value, 
>  comment 
> (as string), 
>  help (as 
> text), 
>  data_type 
> (as list:string). 
>
> I would like to  save the form data into 3tables: db.tool and 
> db.tool_param and tool_ax (see below: mytables)
>
>
> I have been trying for several days to use following web2py UI elements: 
> list:string, 
> Field(IS_IN_SET([...],multiple=True), Field(SQLFORM.widgets.multiple.widget).
> But I can't make exactly what I want. 
>
> Can you please help me with this pazel? Any advice or suggestion - would 
> be greatly appreciated!
>
>
> 
> *mytables:*
> db.define_table('*tool*',
> Field('name', 'string'),
> Field('description', 'text'))
>
> tool - stores name and description of the tools
>
> db.define_table('*tool_param*',
> Field('tool', 'reference tool'),
> Field('toolA1'),
> Field('toolA2'),
> Field('toolA3'),
> Field('toolB1'),
> Field('toolB2'),
> Field('toolC1'))
>
> *tool_param - *store parameters of the tool. Each field name is 
> constracted like following: toolA_1 =db.tool.name +param#.
> Except 'tool' - wich reference to db.tool.id
>
> db.define_table(*'tool_ax*',
> Field('tool', 'reference tool'),
> Field('default_value', 'string')
> Field('data_type', 'string'),
> Field('comment', 'string'),
> Field('help', 'text'))
>
> *tool_ax** - *stores param properties
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: HTML Input (POST) field

2014-02-05 Thread Anthony
Yes, it would be in request.vars (and request.post_vars, assuming a post 
request). Hard to help further without seeing some code.

On Wednesday, February 5, 2014 10:20:35 AM UTC-5, Austin Taylor wrote:
>
> This is driving me insane!! I've been trying to create an input field for 
> a user to type in an IP address.
>
> I then want to assign their input to a variable, run it through my IP 
> checks and return the result from our SQL database.
>
> In a nutshell, how can I assign their input to a variable (I'm thinking 
> request.vars??) and then run it through a series of checks under 
> myapp/controllers and return the result.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: HTML Input (POST) field

2014-02-05 Thread Austin Taylor
Anthony,

I've followed this tutorial here: 
http://www.web2py.com/book/default/chapter/07#FORM

my default.py looks like 

def display_form():
form=FORM('Your name:',
  INPUT(_name='name', requires=IS_NOT_EMPTY()),
  INPUT(_type='submit'))
if form.accepts(request,session):
response.flash = 'form accepted'
elif form.errors:
response.flash = 'form has errors'
else:
response.flash = 'please fill the form'
return dict(form=form)

and i'm not sure where in there I can assign a variable to run through a series 
of checks. I have a lot of checks I want to run the IP through and compare it 
against our SQL database. I just have to assign the input to a variable first.



On Wednesday, February 5, 2014 10:51:01 AM UTC-5, Anthony wrote:
>
> Yes, it would be in request.vars (and request.post_vars, assuming a post 
> request). Hard to help further without seeing some code.
>
> On Wednesday, February 5, 2014 10:20:35 AM UTC-5, Austin Taylor wrote:
>>
>> This is driving me insane!! I've been trying to create an input field for 
>> a user to type in an IP address.
>>
>> I then want to assign their input to a variable, run it through my IP 
>> checks and return the result from our SQL database.
>>
>> In a nutshell, how can I assign their input to a variable (I'm thinking 
>> request.vars??) and then run it through a series of checks under 
>> myapp/controllers and return the result.
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Strange artifact

2014-02-05 Thread horridohobbyist
I'm using SQLFORM.grid with pagination. In Chrome, Firefox, and Safari, the 
bottom of the grid looks like this:



But in Internet Explorer 11 (and presumably earlier versions of IE), the 
bottom of the grid looks like this:



What's that strange artifact just above the pagination bar?? And why does 
it only show up in the IE browser?

Thanks.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Dynamic IS_IN_SET

2014-02-05 Thread Anthony

>
> db.define_table('options',
> Field('question_id', db.questions),
> Field('option_number', requires = IS_NOT_EMPTY()),
> Field('option', requires = IS_NOT_EMPTY()),
> Field('dont_show_question', 'reference questions',
>   requires = IS_IN_SET(lambda row: 
> questionlist(row.question_id
>

Is it the case that selecting a particular option can hide only a single 
other question, or do you want to allow multiple questions to be hidden? If 
the latter, you should either make dont_show_question a list:reference 
field (possibly rename to dont_show_questions or hide_questions) or create 
a linked table to store the questions to be hidden (I would go with 
list:reference).

As for generating the options, it appears you want to exclude the question 
associated with the current record. The problem is that you can't know that 
until the question number is chosen, and that is part of the same form. 
It's difficult to know what approach to take without knowing the workflow 
for creating a new question and its options. If a new question and its 
options are created together in a single form, then there's no need to 
worry about excluding the current question id from the dont_show_questions 
options, because the current question will not have been inserted into the 
database yet.

Finally, you probably don't need IS_IN_SET with a special function to 
generate options. Just use IS_IN_DB and specify a Set object as the first 
argument. You will need to know the current survey id at that point in 
order to limit the set to questions in the current survey (again, depends 
on your workflow, but presumably the survey id could be stored in the 
session).

Anthony

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: sessions2trash.py

2014-02-05 Thread Ricardo Pedroso
On Wed, Feb 5, 2014 at 2:15 PM, Jayadevan M wrote:

>
> open("applications/myapp/sessions",
> O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 4
> getdents(4, /* 2 entries */, 32768) = 48
> getdents(4, /* 0 entries */, 32768) = 0
> close(4)= 0
>

If I'm not wrong your applications/myapp/sessions directory only have 2
entries,
and they are the "." and "..", so your session dir is empty.

Ricardo

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: HTML Input (POST) field

2014-02-05 Thread Austin Taylor
I found what I was looking for. request.vars returns the data in dictionary 
format. All I had to do was assign a variable to the name of my key in 
request.vars (example: ip = request.vars['ip'] and it worked. Thank you!!

On Wednesday, February 5, 2014 10:20:35 AM UTC-5, Austin Taylor wrote:
>
> First, thank you for any help. I really appreciate the support from these 
> forums.
>
> I've been trying to create an input field for a user to type in an IP 
> address and I can't seem to figure it out how to assign it to a variable. 
>
> Tried following: 
> http://www.web2py.com/book/default/chapter/07#Forms-and-validators and 
> still seem to be missing something.
>
> I then want to assign their input to a variable, run it through my IP 
> checks and return the result from our SQL database.
>
> In a nutshell, how can I assign their input to a variable (I'm thinking 
> request.vars??) and then run it through a series of checks under 
> myapp/controllers and return the result.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] MySQL not showing tables when using python web2py.py -S appname -M

2014-02-05 Thread Austin Taylor
Hello,

I followed the instructions for importing legacy databases and created a 
db1.py which gave me a nice model, but I'd like to be able to interact with 
my current database. 

When I type db the shell returns 

I run for x in db:
   print x

and it only shows user, user_group, user_membership, auth_event, and 
auth_cas when I access my database from phpmyadmin I don't even have those 
tables in the database.

Am I doing something wrong?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: how to make complex dynamic form

2014-02-05 Thread Andrey K
Thanks Cliff for your quick answer. I thought I could combine w2p standard 
options: Field(list:string) and Field(IS_IN_SET([...])) together somehow. 
Could you please give me example on how to make it with jQuery or a link 
with relevant examples as I am not really good in jQuery?

Also in second part of my task part of input data from client should be 
added from form to existing db.table as new column(field). I am not sure 
how to do it yet -  I have found only this 
 
link:(http://stackoverflow.com/questions/19107809/how-to-append-field-to-already-defined-table-in-web2py)
 
and still not sure how to apply it to my case. 
Any idea or link that can help me - would be handy to have. Thank you in 
advance.



On Wednesday, February 5, 2014 6:36:36 PM UTC+3, Cliff Kachinske wrote:
>
> JQuery would work for the dynamic form.
>
> On form submission you would have to manually validate the fields added by 
> JQuery. It's not difficult, but you must remember to do it.
>
> On Wednesday, February 5, 2014 10:11:51 AM UTC-5, Andrey K wrote:
>>
>> Dear web2py members, 
>> I have a question for you.
>> I would like to make a dynamic form which looks like below picture (it is 
>> easier to represent my question as a sketch rather than wording).
>> The  form suppose to allow user to add tool with 1 or many parameters. 
>> Form should consist of:
>> tool name,
>> tool description(text) and 
>> as *many tool parameters* as user wants *dynamically.*
>>
>> Each parameter consist of *4 properties*: 
>>  default 
>> value, 
>>  comment 
>> (as string), 
>>  help (as 
>> text), 
>>  data_type 
>> (as list:string). 
>>
>> I would like to  save the form data into 3tables: db.tool and 
>> db.tool_param and tool_ax (see below: mytables)
>>
>> I have been trying for several days to use following web2py UI elements: 
>> list:string, 
>> Field(IS_IN_SET([...],multiple=True), Field(SQLFORM.widgets.multiple.widget).
>> But I can't make exactly what I want. 
>>
>> Can you please help me with this pazel? Any advice or suggestion - would 
>> be greatly appreciated!
>> I would like to make a dynamic form which looks like below picture (it is 
>> easier to represent my question as a sketch rather than wording).
>> The  form suppose to allow user to add tool with 1 or many parameters. 
>> Form should consist.
>> tool name,
>> tool description(text) and 
>> as *many tool parameters* as user wants *dynamically*, 
>> each parameter consist of *4 properties*: 
>>  default 
>> value, 
>>  comment 
>> (as string), 
>>  help (as 
>> text), 
>>  data_type 
>> (as list:string). 
>>
>> I would like to  save the form data into 3tables: db.tool and 
>> db.tool_param and tool_ax (see below: mytables)
>>
>>
>> I have been trying for several days to use following web2py UI elements: 
>> list:string, 
>> Field(IS_IN_SET([...],multiple=True), Field(SQLFORM.widgets.multiple.widget).
>> But I can't make exactly what I want. 
>>
>> Can you please help me with this pazel? Any advice or suggestion - would 
>> be greatly appreciated!
>>
>>
>> 
>> *mytables:*
>> db.define_table('*tool*',
>> Field('name', 'string'),
>> Field('description', 'text'))
>>
>> tool - stores name and description of the tools
>>
>> db.define_table('*tool_param*',
>> Field('tool', 'reference tool'),
>> Field('toolA1'),
>> Field('toolA2'),
>> Field('toolA3'),
>> Field('toolB1'),
>> Field('toolB2'),
>> Field('toolC1'))
>>
>> *tool_param - *store parameters of the tool. Each field name is 
>> constracted like following: toolA_1 =db.tool.name +param#.
>> Except 'tool' - wich reference to db.tool.id
>>
>> db.define_table(*'tool_ax*',
>> Field('tool', 'reference tool'),
>> Field('default_value', 'string')
>> Field('data_type', 'string'),
>> Field('comment', 'string'),
>> Field('help', 'text'))
>>
>> *tool_ax** - *stores param properties
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message

Re: [web2py] "Lazy Options" plugin

2014-02-05 Thread Richard Vézina
I just fix this issue :

https://github.com/BuhtigithuB/sqlabs/blob/patch-1/modules/plugin_lazy_options_widget.py

See around 108...

Better late then never!!

:)

Richard


On Tue, Sep 18, 2012 at 9:49 AM, Richard Vézina  wrote:

> Will need some code!
>
> Richard
>
>
> On Mon, Sep 17, 2012 at 6:48 PM, lyn2py  wrote:
>
>> Hi!
>>
>> I'm testing the lazy options plugin again, the website is here:
>> http://dev.s-cubism.com/plugin_lazy_options_widget
>>
>> And I find that if 'form has errors', the selected value gets reset
>> instead of being remembered (all the other fields get remembered).
>> The code for form has errors is the simple code from web2py book:
>> form=SQLFORM(db.table)
>> if form.process().accepted:
>> response.flash = 'success'
>> elif form.errors:
>> response.flash = 'form has errors'
>>
>>
>> How do I get the widget to behave like it remembers the selected option?
>>
>>  --
>>
>>
>>
>>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: HTML Input (POST) field

2014-02-05 Thread Anthony
request.vars is a Storage object, so you can also do request.vars.ip.

On Wednesday, February 5, 2014 2:20:21 PM UTC-5, Austin Taylor wrote:
>
> I found what I was looking for. request.vars returns the data in 
> dictionary format. All I had to do was assign a variable to the name of my 
> key in request.vars (example: ip = request.vars['ip'] and it worked. Thank 
> you!!
>
> On Wednesday, February 5, 2014 10:20:35 AM UTC-5, Austin Taylor wrote:
>>
>> First, thank you for any help. I really appreciate the support from these 
>> forums.
>>
>> I've been trying to create an input field for a user to type in an IP 
>> address and I can't seem to figure it out how to assign it to a variable. 
>>
>> Tried following: 
>> http://www.web2py.com/book/default/chapter/07#Forms-and-validators and 
>> still seem to be missing something.
>>
>> I then want to assign their input to a variable, run it through my IP 
>> checks and return the result from our SQL database.
>>
>> In a nutshell, how can I assign their input to a variable (I'm thinking 
>> request.vars??) and then run it through a series of checks under 
>> myapp/controllers and return the result.
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Trouble Editing Files In Static Folder Less Than 9 Lines

2014-02-05 Thread Thomas Lanier
If I create a new .js file in the static folder, the web based editor will not 
allow me to edit the file. If I add content to the file with an external 
editor, I can then edit the file in the web2py editor if there are at least 9 
lines in the file. The bug does not seem to be file size dependent, but instead 
it seems to be dependent on the number of lines in the file. If there are less 
than 9 lines in the file, the web2py editor will not display the file or allow 
editing the file.

The problem occurs in both IE11 and Chrome browsers. I'm using the latest 
stable version of web2py.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: MySQL not showing tables when using python web2py.py -S appname -M

2014-02-05 Thread Anthony
When you do "for x in db", that will iterate of the Table objects attached 
to db. The Table objects are just models defined in your model files -- 
they do not necessarily have to correspond to actual tables in your 
database. The tables you listed are Auth tables that would be defined via 
auth.define_tables(). If you have migrations turned off (or the database is 
not writable), then defining those tables in the model will not result in 
them actually being created in the database.

Regarding the existing tables in the database, do you have models in your 
app defining them?

Anthony

On Wednesday, February 5, 2014 2:29:16 PM UTC-5, Austin Taylor wrote:
>
> Hello,
>
> I followed the instructions for importing legacy databases and created a 
> db1.py which gave me a nice model, but I'd like to be able to interact with 
> my current database. 
>
> When I type db the shell returns 
>
> I run for x in db:
>print x
>
> and it only shows user, user_group, user_membership, auth_event, and 
> auth_cas when I access my database from phpmyadmin I don't even have those 
> tables in the database.
>
> Am I doing something wrong?
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Trouble Editing Files In Static Folder Less Than 9 Lines

2014-02-05 Thread Richard Vézina
Could it be just a refresh issue?

I notice that once in a wild the built-in web editor not display all the
lines of the file and clicking in the bottom of the editing file space
seems to trigger an event that force the editor to display the file content
correctly...

?

Richard


On Wed, Feb 5, 2014 at 10:21 AM, Thomas Lanier  wrote:

> If I create a new .js file in the static folder, the web based editor will
> not allow me to edit the file. If I add content to the file with an
> external editor, I can then edit the file in the web2py editor if there are
> at least 9 lines in the file. The bug does not seem to be file size
> dependent, but instead it seems to be dependent on the number of lines in
> the file. If there are less than 9 lines in the file, the web2py editor
> will not display the file or allow editing the file.
>
> The problem occurs in both IE11 and Chrome browsers. I'm using the latest
> stable version of web2py.
>
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] sqlite <---> postgresql

2014-02-05 Thread Gour
Hello,

Do you consider it's safe to work with web2py on localhost machine and
use sqlite3 database as storage (which greatly simplifies setup) and
then deploy application on the production server by using e.g.
PostgreSQL database?


Sincerely,
Gour

-- 
One must deliver himself with the help of his mind, and not 
degrade himself. The mind is the friend of the conditioned soul, 
and his enemy as well.

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


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: HTML Input (POST) field

2014-02-05 Thread Austin Taylor
Now if I want to run it through a series of functions should I put the 
functions in the model.py? What would be the best way to do it?

On Wednesday, February 5, 2014 2:48:53 PM UTC-5, Anthony wrote:
>
> request.vars is a Storage object, so you can also do request.vars.ip.
>
> On Wednesday, February 5, 2014 2:20:21 PM UTC-5, Austin Taylor wrote:
>>
>> I found what I was looking for. request.vars returns the data in 
>> dictionary format. All I had to do was assign a variable to the name of my 
>> key in request.vars (example: ip = request.vars['ip'] and it worked. Thank 
>> you!!
>>
>> On Wednesday, February 5, 2014 10:20:35 AM UTC-5, Austin Taylor wrote:
>>>
>>> First, thank you for any help. I really appreciate the support from 
>>> these forums.
>>>
>>> I've been trying to create an input field for a user to type in an IP 
>>> address and I can't seem to figure it out how to assign it to a variable. 
>>>
>>> Tried following: 
>>> http://www.web2py.com/book/default/chapter/07#Forms-and-validators and 
>>> still seem to be missing something.
>>>
>>> I then want to assign their input to a variable, run it through my IP 
>>> checks and return the result from our SQL database.
>>>
>>> In a nutshell, how can I assign their input to a variable (I'm thinking 
>>> request.vars??) and then run it through a series of checks under 
>>> myapp/controllers and return the result.
>>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: MySQL not showing tables when using python web2py.py -S appname -M

2014-02-05 Thread Austin Taylor
Hi Anthony,

I created the db1.py (using scripts/extract_mysql_models.py) and placed 
that in the app/models folder. Should I have done something else?


On Wednesday, February 5, 2014 2:53:40 PM UTC-5, Anthony wrote:
>
> When you do "for x in db", that will iterate of the Table objects attached 
> to db. The Table objects are just models defined in your model files -- 
> they do not necessarily have to correspond to actual tables in your 
> database. The tables you listed are Auth tables that would be defined via 
> auth.define_tables(). If you have migrations turned off (or the database is 
> not writable), then defining those tables in the model will not result in 
> them actually being created in the database.
>
> Regarding the existing tables in the database, do you have models in your 
> app defining them?
>
> Anthony
>
> On Wednesday, February 5, 2014 2:29:16 PM UTC-5, Austin Taylor wrote:
>>
>> Hello,
>>
>> I followed the instructions for importing legacy databases and created a 
>> db1.py which gave me a nice model, but I'd like to be able to interact with 
>> my current database. 
>>
>> When I type db the shell returns 
>>
>> I run for x in db:
>>print x
>>
>> and it only shows user, user_group, user_membership, auth_event, and 
>> auth_cas when I access my database from phpmyadmin I don't even have those 
>> tables in the database.
>>
>> Am I doing something wrong?
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: MySQL not showing tables when using python web2py.py -S appname -M

2014-02-05 Thread Anthony
How many model files do you have and what is in them? Did you inadvertently 
redefine the "db" object in a subsequent model file (that will remove any 
previously defined models)?

Anthony

On Wednesday, February 5, 2014 3:35:29 PM UTC-5, Austin Taylor wrote:
>
> Hi Anthony,
>
> I created the db1.py (using scripts/extract_mysql_models.py) and placed 
> that in the app/models folder. Should I have done something else?
>
>
> On Wednesday, February 5, 2014 2:53:40 PM UTC-5, Anthony wrote:
>>
>> When you do "for x in db", that will iterate of the Table objects 
>> attached to db. The Table objects are just models defined in your model 
>> files -- they do not necessarily have to correspond to actual tables in 
>> your database. The tables you listed are Auth tables that would be defined 
>> via auth.define_tables(). If you have migrations turned off (or the 
>> database is not writable), then defining those tables in the model will not 
>> result in them actually being created in the database.
>>
>> Regarding the existing tables in the database, do you have models in your 
>> app defining them?
>>
>> Anthony
>>
>> On Wednesday, February 5, 2014 2:29:16 PM UTC-5, Austin Taylor wrote:
>>>
>>> Hello,
>>>
>>> I followed the instructions for importing legacy databases and created a 
>>> db1.py which gave me a nice model, but I'd like to be able to interact with 
>>> my current database. 
>>>
>>> When I type db the shell returns 
>>>
>>> I run for x in db:
>>>print x
>>>
>>> and it only shows user, user_group, user_membership, auth_event, and 
>>> auth_cas when I access my database from phpmyadmin I don't even have those 
>>> tables in the database.
>>>
>>> Am I doing something wrong?
>>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: HTML Input (POST) field

2014-02-05 Thread Anthony
On Wednesday, February 5, 2014 3:32:46 PM UTC-5, Austin Taylor wrote:
>
> Now if I want to run it through a series of functions should I put the 
> functions in the model.py? What would be the best way to do it?
>

If the functions are needed in multiple controllers, you can define them in 
a model file. You can also import them from a module. Functions needed only 
within a given controller can be defined right in the controller itself 
(functions that take arguments or start with a double underscore are not 
exposed as actions via URL), though you may still prefer to organize them 
in modules.

Anthony 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: emacs and web2py

2014-02-05 Thread Michele Comitini
+1
from a long time emacs user


2014-02-05 Massimo Di Pierro :

> This is really nice. Thank you for posting it.
>
>
> On Tuesday, 4 February 2014 15:22:14 UTC-6, François-Xavier Bois wrote:
>>
>> Hi,
>> I would like to announce that web-mode.el, an emacs major mode for
>> editing web templates, is now compatible with web2py templates.
>> web-mode.el is available on http://web-mode.org
>> Cheers
>>
>> fxbois
>>
>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: how to keep request when redirecting

2014-02-05 Thread Stef Mientki

thanks,

I didn't know about "components" will study that in the near future.
For the moment I've replcaed the url with a auto-commit-checkbox, so 
I'll stay on the same page/controller.


cheers,
Stef

On 05-02-14 10:46, Tim Richardson wrote:

redirect starts a new request.

I suppose your redirect URL can contain args and vars based on what 
comes in (see docs on the URL function), and then it would be up to 
the redirected controller to process them. In other words, you pass 
state in the URL.
Your controller or view could use these get_vars or args to set form 
elements as you wish, or the view could embed those settings in 
javascript, which then takes effect on page load.


Another option is to use web2py's component. Instead of reloading the 
whole page and creating a new request, the submit actions refresh a 
component in the page which contains the grid or form which has the 
data you want to refresh. In this case, you never leave the page you 
are on. This looks better too, it's very smooth. Read the components 
chapter in the book.





On Monday, 3 February 2014 04:21:44 UTC+11, aapaap wrote:

hello,

I've a form with checkboxes and radiobuttons.
All the checkboxes and radioboxes are auto-commit, i.e. the have
an argument
onchange="this.form.submit()"

Now this works perfect, as soon as a button is changed, the page is
refreshed with a new selection from the database.

Now I've some other actions on this form, which are realized by a
link.

This link points to a "controler" that does some action and then
redirects to the orginal form.
But now the settings of the checkboxes and radiobuttons is lost,
I assume the request and specially the "request.post_vars" ar lost.

The "controler" looks like :

@auth.requires_login()
def Block_Page():
   if auth.user.id  in Beheerders and
request.args :
 ID = request.args [0]
 db ( db.Knutsels.id  == ID ).update (
Approved_Date = None )
   redirect ( URL ( Show_Knutselen ))

thanks,
Stef



--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups "web2py-users" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] error postgresql with table new :S

2014-02-05 Thread www.diazluis.com
I thought fast and I resolved .. 

I have almost no knowledge as to postgresql 

run a backup "dump" of my local development version (works perfect) 

between the server and psql: delete the table manually, 
Run all the instructions that appeared in the backup that made mention to 
the table "denuncia" 
and stop giving system error .. 

in theory the user and the permissions were fine .. 
really did not create the system table "denuncia", so believe it manually 
and so I gave the error


El miércoles, 5 de febrero de 2014 05:30:05 UTC-4:30, Johann Spies escribió:
>
> On 5 February 2014 06:35, Luis Díaz >wrote:
>
>
>> ProgrammingError: permiso denegado a la relación denuncia
>>
>> Error snapshot 
>>
>> (permiso denegado a la relación 
>> denuncia )--
>>
>>
>>
> Who is the owner of the database in Postgresql? And of table 'denuncia'?
> Does user 'usuario'  have rights to that database?  
>
> The message is that Postgresql is refusing access.
>
> Regards
> Johann
>
> -- 
> Because experiencing your loyal love is better than life itself, 
> my lips will praise you.  (Psalm 63:3)
>  

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] heads up if you localized your app and upgrade to version 2.8.2+

2014-02-05 Thread Tim Richardson
Also note some labels on SQLFORM.grid have changed. 'Add' is now 'Add 
Record'. 
The search widget: "New" is now "New Search" "And" is now "+ And" "Or" is 
now "+ Or". The "plus sign" is a character, not an icon (unlike the Add 
Record button, which uses an icon for "+")



On Thursday, 6 February 2014 02:16:30 UTC+11, step wrote:
>
> Maybe it would help in some cases, but I don't think it would work in a 
> general sense. Some languages may rely on case-sensitivity to provide 
> different translations of a sentence. If T() had an option to look up 
> case-insensitively web2py devs would need to know all target languages 
> before they could evaluate if it's safe to call such option on a sentence 
> in the gluon code.
> Mmm, maybe a global setting could work better than a new argument to T(). 
> An app developer could set a global setting that affects the way T() looks 
> up its translation keys for gluon and all other modules/application files.
>
> On Wednesday, February 5, 2014 12:00:11 PM UTC+1, Kiran Subbaraman wrote:
>>
>>  Will making the translator (T) use the messages in a case-insensitive 
>> manner eliminate the need to do this?
>> I am not sure what needs to be done here exactly, but am guessing it goes 
>> in here 
>> https://github.com/web2py/web2py/blob/7bc603f38053ec80cbce9f25c4413aae550c7b4f/gluon/languages.py,
>>  
>> with look ups done for completely lower-cased messages?
>>
>> 
>> Kiran Subbaramanhttp://subbaraman.wordpress.com/about/
>>
>> On Wed, 05-02-2014 3:24 PM, step wrote:
>>  
>> Just a heads up to those who localized their apps and upgrade to a recent 
>> web2py version - I noticed this change in upgrading from 2.6.4 to 2.8.2.
>> A number of error messages in file gluon/validators.py have changed by 
>> capitalizing the error message, e.g., 'value not in database' became 'Value 
>> not in database'.
>> You need to change your language files to match the new spelling 
>> otherwise non-localized messages will start popping up in your forms.
>>  grep -E 'error_message ?=' gluon/validators.py
>>  
>>
>>  -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+un...@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>  

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: MySQL not showing tables when using python web2py.py -S appname -M

2014-02-05 Thread Austin Taylor
I have my default db.py model file and the db1.py which outlines my sql 
database. I didn't redfine anything else. All I did was update db.py to 
reflect the mysql layout.

On Wednesday, February 5, 2014 4:09:36 PM UTC-5, Anthony wrote:
>
> How many model files do you have and what is in them? Did you 
> inadvertently redefine the "db" object in a subsequent model file (that 
> will remove any previously defined models)?
>
> Anthony
>
> On Wednesday, February 5, 2014 3:35:29 PM UTC-5, Austin Taylor wrote:
>>
>> Hi Anthony,
>>
>> I created the db1.py (using scripts/extract_mysql_models.py) and placed 
>> that in the app/models folder. Should I have done something else?
>>
>>
>> On Wednesday, February 5, 2014 2:53:40 PM UTC-5, Anthony wrote:
>>>
>>> When you do "for x in db", that will iterate of the Table objects 
>>> attached to db. The Table objects are just models defined in your model 
>>> files -- they do not necessarily have to correspond to actual tables in 
>>> your database. The tables you listed are Auth tables that would be defined 
>>> via auth.define_tables(). If you have migrations turned off (or the 
>>> database is not writable), then defining those tables in the model will not 
>>> result in them actually being created in the database.
>>>
>>> Regarding the existing tables in the database, do you have models in 
>>> your app defining them?
>>>
>>> Anthony
>>>
>>> On Wednesday, February 5, 2014 2:29:16 PM UTC-5, Austin Taylor wrote:

 Hello,

 I followed the instructions for importing legacy databases and created 
 a db1.py which gave me a nice model, but I'd like to be able to interact 
 with my current database. 

 When I type db the shell returns 

 I run for x in db:
print x

 and it only shows user, user_group, user_membership, auth_event, and 
 auth_cas when I access my database from phpmyadmin I don't even have those 
 tables in the database.

 Am I doing something wrong?

>>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: How can you put computed fields in select statements and specifically groupby ?

2014-02-05 Thread Tim Richardson
If you just want rows back, you can pass raw SQL using dal. 

I personally haven't done what you are doing, but the DAL parses the query 
and turns it into sql appropriate for your adapter. grouping happens on the 
server. 

 I very much doubt this includes translating python functions into the 
functions of your database backend but apparently simple arithmetic 
functions work. 

TLDR: look at executesql in the book. 


On Wednesday, 5 February 2014 00:45:57 UTC+11, art...@xs4all.nl wrote:
>
> Consider the following query
>
> rows = db(db.table).select(x,y groupby = x)
>
> If x and y are table fields this obviously works.
>
> Now consider
>
> group = x/100
>
> rows = db(db.table).select(group,y, groupby = group)
>
> This also works nicely and will group into groups for each x with a value 
> of x divided by 100, but is of little use.
>
> However, the following fails:
>
> group = math.floor(x/100) and throws the exception function doesn't have 
> attribute type
>
> The intent is to group numeric values into ranges, so I am trying to 
> implement a  slightly more complex function which returns a range 
> indicator, perhaps as a string (e.g. "100-200"), but in order to get that 
> working first the simple case of using the result of a function needs to be 
> solved.
>
> In plain SQL calling a function is an option, perhaps it is a limitation 
> of the DAL
>
> thnx
> Arthur
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Trouble Editing Files In Static Folder Less Than 9 Lines

2014-02-05 Thread Thomas Lanier
I don't think it is a refresh issue. I have tried clearing the browser 
cache and that has no affect. I know it sounds crazy, but there is some 
kind of bug associated with the number of lines in the file.

On Wednesday, February 5, 2014 2:54:36 PM UTC-5, Richard wrote:
>
> Could it be just a refresh issue?
>
> I notice that once in a wild the built-in web editor not display all the 
> lines of the file and clicking in the bottom of the editing file space 
> seems to trigger an event that force the editor to display the file content 
> correctly...
>
> ?
>
> Richard
>
>
> On Wed, Feb 5, 2014 at 10:21 AM, Thomas Lanier 
> > wrote:
>
>> If I create a new .js file in the static folder, the web based editor 
>> will not allow me to edit the file. If I add content to the file with an 
>> external editor, I can then edit the file in the web2py editor if there are 
>> at least 9 lines in the file. The bug does not seem to be file size 
>> dependent, but instead it seems to be dependent on the number of lines in 
>> the file. If there are less than 9 lines in the file, the web2py editor 
>> will not display the file or allow editing the file.
>>
>> The problem occurs in both IE11 and Chrome browsers. I'm using the latest 
>> stable version of web2py.
>>
>>
>> --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: sessions2trash.py

2014-02-05 Thread Niphlod
BTW..you're 10 steps ahead.but you're calling it wrongly :-P

the args of the script are 

-f --> ignores session expiration (deletes either via -x or 
auth.settings.expiration)
-o --> does an execution then exits
-s --> sleep (in case -o isn't passed and the script is always "alive")
-v --> verbose mode. -vv for "ultraverbose"
-x --> sets expiration in seconds (ignoring auth.settings.expiration)

However, to launch a script using the app environment, web2py's syntax is

web2py.py 
-M # load models
-S appname # "shell mode"
-R # path to the script to execute
-A # pass any following argument to the actual script


So, in the end, what you should launch as 

python sessions2trash.py -vv -o

to have it running once (-o) and spit out every debug message possible 
(-vv), in web2py's "shell mode" is

python web2py.py -M -S appname -R scripts/sessions2trash.py -A -vv -o

to load models (-M), load apps shell (-S appname), execute the script (-R 
scripts/sessions2trash.py), pass any following argument to the script (-A), 
spit out verbose messages (-vv), exit after a single loop (-o)

All of this is extensively documented both in the book and in the docstring 
of the session2trash.py script itself

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Trouble Editing Files In Static Folder Less Than 9 Lines

2014-02-05 Thread Richard Vézina
Can you post screen shot?


On Wed, Feb 5, 2014 at 4:31 PM, Thomas Lanier  wrote:

> I don't think it is a refresh issue. I have tried clearing the browser
> cache and that has no affect. I know it sounds crazy, but there is some
> kind of bug associated with the number of lines in the file.
>
>
> On Wednesday, February 5, 2014 2:54:36 PM UTC-5, Richard wrote:
>
>> Could it be just a refresh issue?
>>
>> I notice that once in a wild the built-in web editor not display all the
>> lines of the file and clicking in the bottom of the editing file space
>> seems to trigger an event that force the editor to display the file content
>> correctly...
>>
>> ?
>>
>> Richard
>>
>>
>> On Wed, Feb 5, 2014 at 10:21 AM, Thomas Lanier  wrote:
>>
>>> If I create a new .js file in the static folder, the web based editor
>>> will not allow me to edit the file. If I add content to the file with an
>>> external editor, I can then edit the file in the web2py editor if there are
>>> at least 9 lines in the file. The bug does not seem to be file size
>>> dependent, but instead it seems to be dependent on the number of lines in
>>> the file. If there are less than 9 lines in the file, the web2py editor
>>> will not display the file or allow editing the file.
>>>
>>> The problem occurs in both IE11 and Chrome browsers. I'm using the
>>> latest stable version of web2py.
>>>
>>>
>>> --
>>> Resources:
>>> - http://web2py.com
>>> - http://web2py.com/book (Documentation)
>>> - http://github.com/web2py/web2py (Source code)
>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "web2py-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to web2py+un...@googlegroups.com.
>>>
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: How-to: read-only resource for a few controllers, load once, read many

2014-02-05 Thread A36_Marty
Blind leading the blind here as I am new to web2py, but I saw something in 
the docs that may achieve what you are after:

http://web2py.com/book/default/chapter/04#Cron

In the crontab ability of web2py, there's a @reboot condition (of web2py, 
not the machine) -- meaning a script is run whenever web2py 
starts/restarts.   Maybe put your code there?

I've also read a few places that the scheduler ability in web2py is favored 
over crontab.  I'm working my way through this video now to learn scheduler 
vs. crontab.

I'm guessing with either method you could do your lookups, store the 
results in a table, and have quicker access to the lookups... Maybe even 
adding @cache decorators to the actual lookups to further reduce lookup 
times.

On Tuesday, February 4, 2014 7:33:35 PM UTC-6, r.ry...@gmail.com wrote:
>
>
> Hi,
> I am using web2py v2.8.2.  My command line to launch web2py is "python 
> web2py -i 0.0.0.0" .  I am using python 2.7.5
> I have a fair sized dataset, takes about 10sec to load from the datafiles 
> and perform some calc for lookup.
>
> Code is something like this:
> lookup_data = fn_datalookup(filespath)
>
> I want to expose the lookup_data to a few controllers, but i want web2py 
> to load it only once and make it available to controllers that make the 
> request. Yes, global variable. Load once, read many as long as web2py is 
> up. Reason is : I don't want to loose 10sec on every request that needs to 
> work on this dataset.
>
> I tried the following:
> 1. In a new model file: Call gets executed by all controllers, every time, 
> i.e. 10sec loss on every request in the app. Not a recommended approach 
> (based on documentation). Hence not good
>  
> 2. In specific controllers: Takes 10sec to load on all valid calls, but 
> still not good. I don't want to loose 10sec on all valid requests.
>
> During web2py startup, can i load once and make it available as a global 
> read-only? If yes, how?
>
> If this has been answered before, please point to the post and i will 
> gladly read and learn from the answered post. My search didn't yield the 
> results.
>
> Another problem:
> I noticed that the memory usage(VSZ, RSS) keeps going up and never came 
> down in both the above cases. i.e. every new call increased the memory 
> usage. I waited for more than an hour (with no activity), still didn't come 
> down
> Web2py runs as a single process, doesn't spawn any new process on 
> requests Where can i find documentation on how web2py allocates and 
> deallocates resources and some best practices when working on long running 
> processes, large datasets.
>
> Thanks,
> Yogesh
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: how to keep request when redirecting

2014-02-05 Thread Richard Vézina
Passing vars or args with redirect seems a better approach...

Something like that

# Controller
form.process().accepted:
...
redirect(URL(..., args=request.args(...),
vars=dict(var_name=request.vars.var_name))

Richard


On Wed, Feb 5, 2014 at 4:14 PM, Stef Mientki  wrote:

>  thanks,
>
> I didn't know about "components" will study that in the near future.
> For the moment I've replcaed the url with a auto-commit-checkbox, so I'll
> stay on the same page/controller.
>
> cheers,
> Stef
>
>
> On 05-02-14 10:46, Tim Richardson wrote:
>
> redirect starts a new request.
>
> I suppose your redirect URL can contain args and vars based on what comes
> in (see docs on the URL function), and then it would be up to the
> redirected controller to process them. In other words, you pass state in
> the URL.
> Your controller or view could use these get_vars or args to set form
> elements as you wish, or the view could embed those settings in javascript,
> which then takes effect on page load.
>
> Another option is to use web2py's component. Instead of reloading the
> whole page and creating a new request, the submit actions refresh a
> component in the page which contains the grid or form which has the data
> you want to refresh. In this case, you never leave the page you are on.
> This looks better too, it's very smooth. Read the components chapter in the
> book.
>
>
>
>
> On Monday, 3 February 2014 04:21:44 UTC+11, aapaap wrote:
>>
>> hello,
>>
>> I've a form with checkboxes and radiobuttons.
>> All the checkboxes and radioboxes are auto-commit, i.e. the have an
>> argument
>> onchange="this.form.submit()"
>>
>> Now this works perfect, as soon as a button is changed, the page is
>> refreshed with a new selection from the database.
>>
>> Now I've some other actions on this form, which are realized by a link.
>>
>> This link points to a "controler" that does some action and then
>> redirects to the orginal form.
>> But now the settings of the checkboxes and radiobuttons is lost,
>> I assume the request and specially the "request.post_vars" ar lost.
>>
>> The "controler" looks like :
>>
>> @auth.requires_login()
>> def Block_Page():
>>if auth.user.id in Beheerders and request.args :
>>  ID = request.args [0]
>>  db ( db.Knutsels.id == ID ).update ( Approved_Date = None )
>>redirect ( URL ( Show_Knutselen ))
>>
>> thanks,
>> Stef
>>
>
>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Grid in component edit twice issue

2014-02-05 Thread Jim Karsten
Yes, I am using the packed app as is.

I dug into it a bit and the request.cid is getting dropped. I used Firebug 
to expose the http headers. 

* Load the component and display the grid 
http://127.0.0.1:8000/testy/default/component.load 
GET component.load 
web2py-component-element c435484472283 
web2py-component-location http://127.0.0.1:8000/testy 

* Click Edit load the edit form 
http://127.0.0.1:8000/testy/default/component.load/edit/person/1 
GET 1 
web2py-component-element c435484472283 
web2py-component-location http://127.0.0.1:8000/testy 

* Submit form 
http://127.0.0.1:8000/testy/default/component.load/edit/person/1 
POST 1 
web2py-component-element c435484472283 
web2py-component-location http://127.0.0.1:8000/testy 

* Redisiplay the grid. 
http://127.0.0.1:8000/testy/default/component.load 
GET component.load 


The two web2py-component http headers are dropped when the component is 
reloaded to display the grid after the form is submitted. 

On Tuesday, February 4, 2014 10:07:23 AM UTC-5, Niphlod wrote:
>
> are you using exactly the app you packed ?
>
> On Tuesday, February 4, 2014 2:53:41 AM UTC+1, Jim Karsten wrote:
>>
>> Originally the *Edit* button has this code: 
>>
>> https://groups.google.com/testy/default/component.load/edit/person/1"; 
>> data-w2p_target="c932772971645" data-w2p_method="GET" 
>> data-w2p_disable_with="default"> 
>>  
>> Edit 
>>  
>>
>> I then edit and submit and the Edit button then has this code: 
>>
>> https://groups.google.com/testy/default/component.load/edit/person/1"; 
>> data-w2p_disable_with="default"> 
>>  
>> Edit
>>  
>>
>> The *data-w2p_target* and *data-w2p_method* attributes appear to be 
>> dropped.
>>
>> I use Firebug. I don't see any js errors in the Console. 
>>  
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] json error when trying mongo slice

2014-02-05 Thread greaneym
Hi,

I am trying out the slice by Alan Etkin that demonstrates the use of the
mongodb adapter. Everything works ok, but when I try to enter the 
description
part of the form
and the description should be in json format, it returns "invalid JSON".

Here are two examples of what I entered for the description. Alan's example 
show
this kind of entry:
{ u'counter':3, u'now':'2014:05-02 13:00:00' )

the web2py manual shows this kind of entry:
{ 'counter':3, 'now':'2014:05-02 13:00:00' )

but I get invalid json as the error. 

How can I fix this please?
(mac os, version 232 web2py, python 2.6, pymongo)


thanks,
Margaret

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Can I specify a display name in emails sent via auth.settings.mailer?

2014-02-05 Thread User
I would like the from address of automated emails for user registration, 
retrieve password, etc to have a display name.  How can I do this?

Currently my mailer is defined similar to:

mail = auth.settings.mailer
mail.settings.server = 'logging' or 'smtp.gmail.com:587'
mail.settings.sender = 'i...@example.com'

Can I do something like this?

mail.settings.sender = 'Company Name 
'<'companyi...@example.com'>

I saw this related post: 
https://groups.google.com/forum/#!topic/web2py/GCY_jQusDKk but that is only 
discussing the mail.send() method I believe

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Strange artifact

2014-02-05 Thread horridohobbyist
Sorry, the artifact appears in SQLFORM.grid, regardless of pagination.

Does *anyone* know what's going on??


On Wednesday, 5 February 2014 10:57:30 UTC-5, horridohobbyist wrote:
>
> I'm using SQLFORM.grid with pagination. In Chrome, Firefox, and Safari, 
> the bottom of the grid looks like this:
>
>
> 
>
> But in Internet Explorer 11 (and presumably earlier versions of IE), the 
> bottom of the grid looks like this:
>
>
> 
>
> What's that strange artifact just above the pagination bar?? And why does 
> it only show up in the IE browser?
>
> Thanks.
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] linked_tables not show using smartgrid

2014-02-05 Thread 黄祥
hello folks,

i'm using the linked_tables in smartgrid, but it is not show up. no errors 
occured, but the show is not expected.  the table is referenced and i'm not 
using response.models to run and not using modules. check on response 
toolbar only the header table is loaded the detail table is not loaded. 
check on database administration the detail that refer to the header is 
linked (detail rows that refer to the header can be clicked to the header). 
any idea how to fix it?
*code :*
*models/purchase.py*
db.define_table('purchase_header', 
Field('purchase_no'), 
Field('purchase_date', 'date'), 
Field('supplier', 'reference supplier'), 
Field('reference'), 
Field('total', 'integer'), 
format = '%(purchase_no)s')

db.define_table('purchase_detail', 
Field('purchase_no', 'reference purchase_header'), 
Field('product', 'reference product'), 
Field('quantity', 'integer'), 
Field('price', 'integer'), 
Field('amount', 'integer'), 
Field('total', 'integer'), 
format = '%(purchase_no)s')

*controllers/report.py*
def report_purchase():
#from gluon.debug import dbg
#dbg.set_trace()
purchase_detail = ['purchase_detail']
#grid = SQLFORM.smartgrid(db.purchase_header, 
linked_tables=['purchase_detail'], fields=fields, links=purchase_links, 
create=create, editable=editable, deletable=deletable, details=details, 
showbuttontext=False)
grid = SQLFORM.smartgrid(db.purchase_header, 
linked_tables=['purchase_detail'])
#grid = SQLFORM.smartgrid(db.purchase_header)
return locals()

*response toolbar db tables :*
sqlite://citifone.sqlite:defined:auth_usercategoryproductpurchase_header
supplierlazy:auth_casauth_eventauth_groupauth_membershipauth_permission
chart_of_accountpayment_detailpayment_headerpurchase_detailsale_detail
sale_header

thanks and best regards,
stifan

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] heads up if you localized your app and upgrade to version 2.8.2+

2014-02-05 Thread Anthony
Perhaps the book should note that messages are not guaranteed to remain the 
same and recommend that users be explicit about messages if they don't want 
to risk them changing in their app.

Anthony

On Wednesday, February 5, 2014 4:40:01 PM UTC-5, Tim Richardson wrote:
>
> Also note some labels on SQLFORM.grid have changed. 'Add' is now 'Add 
> Record'. 
> The search widget: "New" is now "New Search" "And" is now "+ And" "Or" is 
> now "+ Or". The "plus sign" is a character, not an icon (unlike the Add 
> Record button, which uses an icon for "+")
> There are tooltips as well. "Start building a new search", "Add this to 
> the search as an AND term", "Add this to the search as an OR term"
> (these changes take effect in the next release)
>
>
> On Thursday, 6 February 2014 02:16:30 UTC+11, step wrote:
>>
>> Maybe it would help in some cases, but I don't think it would work in a 
>> general sense. Some languages may rely on case-sensitivity to provide 
>> different translations of a sentence. If T() had an option to look up 
>> case-insensitively web2py devs would need to know all target languages 
>> before they could evaluate if it's safe to call such option on a sentence 
>> in the gluon code.
>> Mmm, maybe a global setting could work better than a new argument to T(). 
>> An app developer could set a global setting that affects the way T() looks 
>> up its translation keys for gluon and all other modules/application files.
>>
>> On Wednesday, February 5, 2014 12:00:11 PM UTC+1, Kiran Subbaraman wrote:
>>>
>>>  Will making the translator (T) use the messages in a case-insensitive 
>>> manner eliminate the need to do this?
>>> I am not sure what needs to be done here exactly, but am guessing it 
>>> goes in here 
>>> https://github.com/web2py/web2py/blob/7bc603f38053ec80cbce9f25c4413aae550c7b4f/gluon/languages.py,
>>>  
>>> with look ups done for completely lower-cased messages?
>>>
>>> 
>>> Kiran Subbaramanhttp://subbaraman.wordpress.com/about/
>>>
>>> On Wed, 05-02-2014 3:24 PM, step wrote:
>>>  
>>> Just a heads up to those who localized their apps and upgrade to a 
>>> recent web2py version - I noticed this change in upgrading from 2.6.4 to 
>>> 2.8.2.
>>> A number of error messages in file gluon/validators.py have changed by 
>>> capitalizing the error message, e.g., 'value not in database' became 'Value 
>>> not in database'.
>>> You need to change your language files to match the new spelling 
>>> otherwise non-localized messages will start popping up in your forms.
>>>  grep -E 'error_message ?=' gluon/validators.py
>>>  
>>>
>>>  -- 
>>> Resources:
>>> - http://web2py.com
>>> - http://web2py.com/book (Documentation)
>>> - http://github.com/web2py/web2py (Source code)
>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>> --- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "web2py-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to web2py+un...@googlegroups.com.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>>  

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: MySQL not showing tables when using python web2py.py -S appname -M

2014-02-05 Thread Anthony
Can you show your code?

On Wednesday, February 5, 2014 4:44:49 PM UTC-5, Austin Taylor wrote:
>
> I have my default db.py model file and the db1.py which outlines my sql 
> database. I didn't redfine anything else. All I did was update db.py to 
> reflect the mysql layout.
>
> On Wednesday, February 5, 2014 4:09:36 PM UTC-5, Anthony wrote:
>>
>> How many model files do you have and what is in them? Did you 
>> inadvertently redefine the "db" object in a subsequent model file (that 
>> will remove any previously defined models)?
>>
>> Anthony
>>
>> On Wednesday, February 5, 2014 3:35:29 PM UTC-5, Austin Taylor wrote:
>>>
>>> Hi Anthony,
>>>
>>> I created the db1.py (using scripts/extract_mysql_models.py) and placed 
>>> that in the app/models folder. Should I have done something else?
>>>
>>>
>>> On Wednesday, February 5, 2014 2:53:40 PM UTC-5, Anthony wrote:

 When you do "for x in db", that will iterate of the Table objects 
 attached to db. The Table objects are just models defined in your model 
 files -- they do not necessarily have to correspond to actual tables in 
 your database. The tables you listed are Auth tables that would be defined 
 via auth.define_tables(). If you have migrations turned off (or the 
 database is not writable), then defining those tables in the model will 
 not 
 result in them actually being created in the database.

 Regarding the existing tables in the database, do you have models in 
 your app defining them?

 Anthony

 On Wednesday, February 5, 2014 2:29:16 PM UTC-5, Austin Taylor wrote:
>
> Hello,
>
> I followed the instructions for importing legacy databases and created 
> a db1.py which gave me a nice model, but I'd like to be able to interact 
> with my current database. 
>
> When I type db the shell returns 
>
> I run for x in db:
>print x
>
> and it only shows user, user_group, user_membership, auth_event, and 
> auth_cas when I access my database from phpmyadmin I don't even have 
> those 
> tables in the database.
>
> Am I doing something wrong?
>


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: sessions2trash.py

2014-02-05 Thread Jayadevan M
Thanks for the reply.  Let me provide more info. May be I missed something 
very basic. I am replying inline to your/Ricardo's comments.


"BTW..you're 10 steps ahead.but you're calling it wrongly :-P"
I guess I am calling it wrongly. Did not get the 10 steps ahead part

"the args of the script are.
However, to launch a script using the app environment, web2py's syntax is"

I think this difference is what sends me down the wrong path

"If I'm not wrong your applications/myapp/sessions directory only have 2 
entries,
and they are the "." and "..", so your session dir is empty."

But I did have entries going till beginning of January. I used the -o -x 
3600 and they disappeared. So my question about the basic behaviour - 
I am using db auth. So once a user logs in, there is an entry in the 
auth_event table. If the user quits without logging out, obviously there is 
no entry for 'log out'. In such a scenario, will the script delete session 
files?

On Thursday, February 6, 2014 3:35:23 AM UTC+5:30, Niphlod wrote:
>
> BTW..you're 10 steps ahead.but you're calling it wrongly :-P
>
> the args of the script are 
>
> -f --> ignores session expiration (deletes either via -x or 
> auth.settings.expiration)
> -o --> does an execution then exits
> -s --> sleep (in case -o isn't passed and the script is always "alive")
> -v --> verbose mode. -vv for "ultraverbose"
> -x --> sets expiration in seconds (ignoring auth.settings.expiration)
>
> However, to launch a script using the app environment, web2py's syntax is
>
> web2py.py 
> -M # load models
> -S appname # "shell mode"
> -R # path to the script to execute
> -A # pass any following argument to the actual script
>
>
> So, in the end, what you should launch as 
>
> python sessions2trash.py -vv -o
>
> to have it running once (-o) and spit out every debug message possible 
> (-vv), in web2py's "shell mode" is
>
> python web2py.py -M -S appname -R scripts/sessions2trash.py -A -vv -o
>
> to load models (-M), load apps shell (-S appname), execute the script (-R 
> scripts/sessions2trash.py), pass any following argument to the script (-A), 
> spit out verbose messages (-vv), exit after a single loop (-o)
>
> All of this is extensively documented both in the book and in the 
> docstring of the session2trash.py script itself
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: Dynamic IS_IN_SET

2014-02-05 Thread Johann Spies
Thanks Anthony.

I have decided to move the logic to the controller and sidestep the
difficulties of handling it in the model.

The workflow separates forms for survey(general particulars), questions,
options to questions and extra information linked to questions.  The
present question in the above problem would be the question that, if a
certain option was chosen, would cause other questions to be hidden.  That
was why I tried to exclude the present one from the set.

In the controller I can handle all these difficulties easier using separate
steps in stead of trying to use one validator.

Your remarks helps me to understand why my IS_IN_SET had a problem.

Regards
Johann




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

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.