Re: [web2py] Re: sessions2trash.py

2014-02-06 Thread Niphlod


On Thursday, February 6, 2014 5:28:17 AM UTC+1, Jayadevan M wrote:
>
> 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?
>
>>
>>
a session lasts for whatever time it needs to be alive. if a user logs out 
but 1 hour doesn't pass, the session is not marked for deletion (assuming 
-x 3600). When the session is not "resumed" for at least an hour, then the 
session gets marked for deletion. 

-- 
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-06 Thread step
I agree, the book should say that. Let me add that users don't have control 
over messages that originate in the gluon code, so they can't be explicit 
about them. They will *always* risk messages changing in their app.
I like the general design of web2py's translation code. The issue is more 
in the way it can get used. When gluon devs write messages in English, they 
seed the temptation for future devs to change the message text, thus 
breaking existing localizations. The only way around this would be to avoid 
plain English altogether and write messages as symbols, say M01, M02, and 
so on, with no discernible link between the symbol and its meaning. Then 
web2py would need to ship an en.py file that translates the symbols into 
English. It's a lot of work - just like localizing an app and keeping up 
with message updates is a lot of work. It's a compromize, I think the devs 
had better spend their time on improving/extending web2py's functionality. 
Maybe in the future web2py will be as popular as libre office or mozilla 
and have a large and focused localization team liike they do that takes 
care of this type of issues.

On Thursday, February 6, 2014 5:07:13 AM UTC+1, Anthony wrote:
>
> 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: linked_tables not show using smartgrid

2014-02-06 Thread Tim Richardson
is this trunk or a release? 

-- 
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: DAL Function in select

2014-02-06 Thread Tim Richardson
I think I replied to another post of yours, same topic.

This won't work because select sends SQL to a database server, and this is 
where grouping happens, yet math.floor() is Python, not SQL.
Use the book to read about executesql and use it send SQL to your server; 
you will still gets rows back.

The DAL is clever, but it doesn't Python math functions into the equivalent 
of your backend server's SQL syntax.



On Wednesday, 5 February 2014 01:47:56 UTC+11, art...@xs4all.nl wrote:
>
> 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] Re: json error when trying mongo slice

2014-02-06 Thread Alan Etkin

>
> 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' )
>

Currently the json validator accepts only legal json, meaning you have to 
enclose strings in double quotes (altough it automatically escapes special 
characters). This would validate:

{"møøse": "We apologise, we had to sack the møøse also"}

So I think both the book and the recipe need to be updated.

-- 
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: sqlite <---> postgresql

2014-02-06 Thread Alan Etkin

>
> 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? 
>

There are some difficulties when you need to migrate data between both 
backends. Currently, if you have a complex model, you have to resort to 
engine specific commands to solve constraint issues like disabling triggers 
and usually you need to reorder model table definitions. In some cases like 
circular references, reordering is not enough, and there's need to manually 
fix the constraints. I've posted a module for web2py shell which automates 
the migration here:

https://groups.google.com/d/msg/web2py-developers/QxeJNByj6qc/cpBHsa1ymUkJ

But you still need to fix the model definition order so it works with 
postgresql

BTW: there is a work-in-progress modification of dal so the engine 
migration is transparent.

-- 
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 table column/field pro grammatically to existing table under controler

2014-02-06 Thread Andrey K
I have a need to dynamically add Fields to my table. I wonder what is the 
best way to add column/field to existing table (already defined in db.py 
model) under controller (for example default.py) with main Field parameters 
(value, type, comment)?

Example:

*model/dp.py:*
db.define_table('tA',
Field('f1', 'string'))

*controler/default.py:*
#how to make function looking something like below
def addField(tableName, fieldValue, fieldType, fieldComment):
???

Thank you in advance!!!

-- 
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 reset authentication?

2014-02-06 Thread Austin Taylor
I've tried creating another app and authentication works fine there with 
the sqlite database, but when I try to use my mysql instance I run into 
error after error.

Right now I have Login, Forgot Username and Lost Password when I hover over 
the login button. I don't know how to get it back to the default of just 
register/lost password/login.

I have no idea where the code could be that messed up my registration. It 
was initially working but I tried creating another registration script that 
seems to have messed everything up.

I tried removing the script and creating a new app and cloning the 
models/controllers but the old registration form which request a username 
still pops up.

Any help would be greatly appreciated!!

-- 
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-06 Thread Johann Spies
+1


On 5 February 2014 23:16, Michele Comitini wrote:

> +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.
>



-- 
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: linked_tables not show using smartgrid

2014-02-06 Thread 黄祥
release version 2.8.2 source

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-06 Thread Anthony
On Thursday, February 6, 2014 5:12:38 AM UTC-5, step wrote:
>
> I agree, the book should say that. Let me add that users don't have 
> control over messages that originate in the gluon code, so they can't be 
> explicit about them. They will *always* risk messages changing in their 
> app.
>

I think most if not all messages generated in gluon code are customizable 
via the API as well as translatable. If you are aware of messages that are 
not, please point them out.
 

> I like the general design of web2py's translation code. The issue is more 
> in the way it can get used. When gluon devs write messages in English, they 
> seed the temptation for future devs to change the message text, thus 
> breaking existing localizations. The only way around this would be to avoid 
> plain English altogether and write messages as symbols, say M01, M02, and 
> so on, with no discernible link between the symbol and its meaning.
>

I'd say it would be a lot easier if there was some discernible link between 
the symbol and its meaning (much like auth.messages). 

It's a compromize, I think the devs had better spend their time on 
> improving/extending web2py's functionality.
>

Feel free to help. ;-)

Note, web2py already comes with translations of many of the built-in 
messages in a number of languages. With this change, we should have updated 
those language files as well. If any users translate additional messages or 
make translations into new languages, they should submit them so everyone 
can benefit.

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.


[web2py] Re: linked_tables not show using smartgrid

2014-02-06 Thread 黄祥
trying another tables using smartgrid and have the same result. 
trying to add the auth signature but have the same result.
trying to create the apps from scratch (copy the models, controllers and 
views folders) but have the same result.
*code*
*controllers/report.py*
def report_product():
product_detail = ['purchase_detail']
grid = SQLFORM.smartgrid(db.product)
return locals()

def report_supplier():
supplier_detail = ['purchase_header']
grid = SQLFORM.smartgrid(db.supplier)
return locals()

any idea how to fix it?

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.


[web2py] Re: adding table column/field pro grammatically to existing table under controler

2014-02-06 Thread Anthony
The safest way is probably to redefine the whole table.

*models/dp.py:*

tA_args = dict(format='%(f1)s', ...)
db.define_table('tA',
Field('f1', 'string'),
**tA_args)

*controler/default.py:*

db.define_table('tA', db.tA,
Field('newfield'),
redefine=True, **tA_args)

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.


[web2py] Re: sqlite <---> postgresql

2014-02-06 Thread Gour
On Thu, 6 Feb 2014 04:06:55 -0800 (PST)
Alan Etkin  wrote:

> I've posted a module for web2py shell which automates the migration
> here:
> https://groups.google.com/d/msg/web2py-developers/QxeJNByj6qc/cpBHsa1ymUkJ

Thanks a lot. Just what I need. ;)

> BTW: there is a work-in-progress modification of dal so the engine 
> migration is transparent.

This is even better. No rush here, but just curious if there is any ETA
for it?


Sincerely,
Gour

-- 


-- 
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:19089] Re: Input type button

2014-02-06 Thread Austin Taylor
Steve,

I know this is an old post, but i'm trying to implement something like this 
(the classes). Where should I put the class index(): and how would I import 
it? Would it go in the default.py? 

On Sunday, April 5, 2009 6:03:26 AM UTC-4, Steve Shephed wrote:
>
> Where did you find the book in pdf format for under $20?
> You should look at the the following code that allows a callback without 
> updating the page. This would be great for a calculator.
>
> class index():
> button1=TAG.BUTTON(_onclick="$
> .ajax({url: '%s', success: function
> (value) { $('#target').html(value); } });" % URL
> (r=request,f='callback'))
> div1=DIV(_id='target')
> return dict(button1=button1, div1=div1)
>
> class callback():
> return H1('Hello world').xml()
>
>

-- 
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 reset authentication?

2014-02-06 Thread Austin Taylor
Or would it be possible for my authentication to be handled by another 
database?? I'm open for ideas/best practices. 

On Thursday, February 6, 2014 7:38:26 AM UTC-5, Austin Taylor wrote:
>
> I've tried creating another app and authentication works fine there with 
> the sqlite database, but when I try to use my mysql instance I run into 
> error after error.
>
> Right now I have Login, Forgot Username and Lost Password when I hover 
> over the login button. I don't know how to get it back to the default of 
> just register/lost password/login.
>
> I have no idea where the code could be that messed up my registration. It 
> was initially working but I tried creating another registration script that 
> seems to have messed everything up.
>
> I tried removing the script and creating a new app and cloning the 
> models/controllers but the old registration form which request a username 
> still pops up.
>
> Any help would be greatly appreciated!!
>

-- 
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: sqlite <---> postgresql

2014-02-06 Thread Cliff Kachinske
Gour,

Maybe I'm missing something, but why would you develop on one back end if 
your production target is another?

If you switch back ends you will need to go through a complete regression 
test before you deploy.

Postgres is not that hard to set up and use. MariaDB/MySQL is equally easy.



On Wednesday, February 5, 2014 3:02:50 PM UTC-5, Gour wrote:
>
> 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: sqlite <---> postgresql

2014-02-06 Thread Cliff Kachinske
And maybe there's no need to switch. SQLite is not a toy.

http://www.sqlite.org/whentouse.html

On Wednesday, February 5, 2014 3:02:50 PM UTC-5, Gour wrote:
>
> 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: linked_tables not show using smartgrid

2014-02-06 Thread Tim Richardson
I'm guessing this is not a complete model since there is no supplier table 
defined (reference in purchase_header)
For the point of making progress, perhaps you can temporarily remove that 
reference and make sure that you get the two-table smart grid working 
(there shouldn't be any need to specify the linked table)


On Friday, 7 February 2014 00:25:49 UTC+11, 黄祥 wrote:
>
> trying another tables using smartgrid and have the same result. 
> trying to add the auth signature but have the same result.
> trying to create the apps from scratch (copy the models, controllers and 
> views folders) but have the same result.
> *code*
> *controllers/report.py*
> def report_product():
> product_detail = ['purchase_detail']
> grid = SQLFORM.smartgrid(db.product)
> return locals()
>
> def report_supplier():
> supplier_detail = ['purchase_header']
> grid = SQLFORM.smartgrid(db.supplier)
> return locals()
>
> any idea how to fix it?
>
> 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.


[web2py] How to handle (add?) hidden fields with a grid after submission / setting in onvalidation?

2014-02-06 Thread A36_Marty

I've hit a roadblock and would appreciate a nudge in the right direction.

I have a grid with a field I'd like to not show to the user.  I've set the 
"onvalidation" to call a function to check values, and depending on what 
was entered in another field, add a separate value to the unseen/hidden 
field on the grid.create/edit form.

The db.table.field.default route before the grid call doesn't work because 
I don't know the value needed for the field until after the user hits 
submit and the 'onvalidation' code is run (it's a complex look, if nothing 
is found during the lookup, a record is inserted in a seperate table, and 
the id of the found/new record is placed in the hidden field).

Likewise, if I set .readable=.writable=False to hide the field, I don't see 
the field as an option in the response object inside the onvalidation 
function...  So that doesn't seem to be the way to accomplish the goal.

Finally, I thought about adding the field to the response collections, 
however, web2py is tagging the fields with keys to prevent 
double-submission and I don't know how to generate a valid key after the 
submit so as to programmatically add a new field in the mix for committing 
to the db by the grid...  

Could someone point me in the right direction / design pattern to 
accomplish the above?

Many thanks in advance.

-- 
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 behavior of ajax() function if there are request,args

2014-02-06 Thread Mirek Zvolský
Hi,

>> I will see all form controls twice, in the 2nd case inside of 
the target  where I wait the ajax() value. 
<<<

I work with Web2py 2.5.1 (I'm sorry).
Can somebody make me sure, we have no longer following strange behavior in 
newer versions?
So if somebody can copy the controller and view provided bellow in the 
current version and try call application/poptavka/poptavka/1 and then go 
into textbox, fill something and move outside.
If fixed already, any idea, how to patch 2.5.1?

When I navigate to:
controller/function
all works well,

but when I navigate to:
controller/function/1
>> I will see all form controls twice, in the 2nd case inside of 
the target  where I wait the ajax() value. 
<<<

In other words: ajax() function will render and return the complete html 
page layout - instead of simple string.

My code:
model - nothing - I have removed all completly and problem is still here
controller poptavka.py
  def poptavka():
form = SQLFORM.factory(
Field('fld', 'string'),
)
return dict(form=form)
def echo():
return 'aaa'
view poptavka/poptavka.html
  {{extend 'layout.html'}}
  {{=form}}
  
  
  $(document).ready(function() {
  $('#no_table_fld').change(function(){
ajax('echo', [], 'target');
});
  });
  

-- 
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-06 Thread rif
M-x package-list-packages right now.

Thanks a lot!

marți, 4 februarie 2014, 23:22:14 UTC+2, François-Xavier Bois a scris:
>
> 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: strange behavior of ajax() function if there are request,args

2014-02-06 Thread Anthony
The ajax() function must take a proper URL as the first argument. Your URL 
is just 'echo', which the browser interprets as being relative to the 
current page (because it doesn't start with a '/'). Instead, should be:

ajax('{{=URL('poptavka', 'echo')}}', [], 'target')

which will produce:

ajax('/yourapp/poptavka/echo', [], 'target')

Anthony

On Thursday, February 6, 2014 11:56:25 AM UTC-5, Mirek Zvolský wrote:
>
> Hi,
>
> >> I will see all form controls twice, in the 2nd case inside of 
> the target  where I wait the ajax() value. 
> <<<
>
> I work with Web2py 2.5.1 (I'm sorry).
> Can somebody make me sure, we have no longer following strange behavior in 
> newer versions?
> So if somebody can copy the controller and view provided bellow in the 
> current version and try call application/poptavka/poptavka/1 and then go 
> into textbox, fill something and move outside.
> If fixed already, any idea, how to patch 2.5.1?
>
> When I navigate to:
> controller/function
> all works well,
>
> but when I navigate to:
> controller/function/1
> >> I will see all form controls twice, in the 2nd case inside of 
> the target  where I wait the ajax() value. 
> <<<
>
> In other words: ajax() function will render and return the complete html 
> page layout - instead of simple string.
>
> My code:
> model - nothing - I have removed all completly and problem is still here
> controller poptavka.py
>   def poptavka():
> form = SQLFORM.factory(
> Field('fld', 'string'),
> )
> return dict(form=form)
> def echo():
> return 'aaa'
> view poptavka/poptavka.html
>   {{extend 'layout.html'}}
>   {{=form}}
>   
>   
>   $(document).ready(function() {
>   $('#no_table_fld').change(function(){
> ajax('echo', [], 'target');
> });
>   });
>   
>
>

-- 
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] Setting DAL less strict from a model

2014-02-06 Thread Rene Dohmen
Hi Mic,

I will test it later on. But i'm not sure how this would solve the problem; 
I still need to remove the check_reserved from the DAL connection string.
The goal is to NOT change anything in db.py; so the page module can be used 
as a normal w2p plugin.

Or are you saying check_reserved will be removed in the future; e.g. it wil 
be replaced by entity_quoting=True by default?

Kind regards 
Rene

On Tuesday, February 4, 2014 10:01:04 PM UTC+1, Michele Comitini wrote:
>
> Hi Rene,
>
>
>
> try testing with trunk, remove check_reserved and add the following to DAL 
> parameters:
>
> DAL(., entity_quoting=True) after that you should have no conflict 
> with reserved SQL words.
> You should be able to use any name, e.g. do things like 
> define_table('table', Field('select'), Field('update'))
>
> Let us know if that works.
>
> mic
>
>
>
> 2014-02-04 Rene Dohmen >:
>
>> Hi Web2py-users,
>>
>> I have developed a CMS kind of system based on web2py. 
>> https://github.com/acidjunk/web2py-pages
>>
>> I actually want to provide a release as a w2p file on a regular basis, so 
>> it can be used more easily. But I'm running into a problem if I don't 
>> overwrite any core web2py app files.
>> https://github.com/acidjunk/web2py-pages/blob/master/README.md
>>
>> When I started the development (web2py 1.97.2) I made some DB naming 
>> choices that gave problems later on, when using strict(er) mode in DAL. The 
>> key problem is that we choose 'page' for our main table containing the 
>> pages. Obviously a lot of code in the page controller is using 'page' also 
>> for adding, editing and sorting pages; and I also have some projects in 
>> production that use it already. So a rename is not that straight forward or 
>> easy...
>>
>> I did investigate the web2py docs to see if I could relax the strict mode 
>> from a model that would be included after db.py; but that doesn't seem to 
>> be possible.
>>
>> Any help is appreciated.
>>
>> Kind Regards
>>
>> Rene
>>
>>  -- 
>> 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: sqlite <---> postgresql

2014-02-06 Thread Gour
On Thu, 6 Feb 2014 06:27:36 -0800 (PST)
Cliff Kachinske  wrote:

> Maybe I'm missing something, but why would you develop on one back
> end if your production target is another?

It's easy to work with sqlite.

> Postgres is not that hard to set up and use. MariaDB/MySQL is equally
> easy.

That's true, but it's still one server more to take care about, while
sqlite is 'already installed' and no need to admin. :-)

> And maybe there's no need to switch. SQLite is not a toy.

It's definitely not a toy, but maybe not the best option for web app
which should muliple users at once?


Sincerely,
Gour

-- 
When your intelligence has passed out of the dense forest 
of delusion, you shall become indifferent to all that has 
been heard and all that is to be heard.

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: json error when trying mongo slice

2014-02-06 Thread greaneym
thanks, this works well. I should have tried that.

This is a nice application.

On Thursday, February 6, 2014 5:47:27 AM UTC-6, Alan Etkin wrote:
>
> 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' )
>>
>
> Currently the json validator accepts only legal json, meaning you have to 
> enclose strings in double quotes (altough it automatically escapes special 
> characters). This would validate:
>
> {"møøse": "We apologise, we had to sack the møøse also"}
>
> So I think both the book and the recipe need to be updated.
>
>

-- 
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] How to handle (add?) hidden fields with a grid after submission / setting in onvalidation?

2014-02-06 Thread Richard Vézina
I am not sure to understand exactly your issue, and your explanation are
not as easy as a piece of code to understand... But maybe not "removing"
you field from the form with readable and writable = False, but instead
just hiding it with javascript could be of some help... The thing is that
if you field is set to readable and writable = False you will not have this
field in the form.vars so you can make any verification with your
onvalidation function base on this field

Hope it helps.

Richard


On Thu, Feb 6, 2014 at 11:17 AM, A36_Marty  wrote:

>
> I've hit a roadblock and would appreciate a nudge in the right direction.
>
> I have a grid with a field I'd like to not show to the user.  I've set the
> "onvalidation" to call a function to check values, and depending on what
> was entered in another field, add a separate value to the unseen/hidden
> field on the grid.create/edit form.
>
> The db.table.field.default route before the grid call doesn't work because
> I don't know the value needed for the field until after the user hits
> submit and the 'onvalidation' code is run (it's a complex look, if nothing
> is found during the lookup, a record is inserted in a seperate table, and
> the id of the found/new record is placed in the hidden field).
>
> Likewise, if I set .readable=.writable=False to hide the field, I don't
> see the field as an option in the response object inside the onvalidation
> function...  So that doesn't seem to be the way to accomplish the goal.
>
> Finally, I thought about adding the field to the response collections,
> however, web2py is tagging the fields with keys to prevent
> double-submission and I don't know how to generate a valid key after the
> submit so as to programmatically add a new field in the mix for committing
> to the db by the grid...
>
> Could someone point me in the right direction / design pattern to
> accomplish the above?
>
> Many thanks in advance.
>
> --
> 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] Re: sqlite <---> postgresql

2014-02-06 Thread Carlos Correia
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Em 06-02-2014 18:27, Gour escreveu:
> On Thu, 6 Feb 2014 06:27:36 -0800 (PST)
> Cliff Kachinske  wrote:
> 
>> Maybe I'm missing something, but why would you develop on one back
>> end if your production target is another?
> 
> It's easy to work with sqlite.
> 

Also with Postgresql (unless you're in Windows).

>> Postgres is not that hard to set up and use. MariaDB/MySQL is equally
>> easy.
> 
> That's true, but it's still one server more to take care about, while
> sqlite is 'already installed' and no need to admin. :-)
> 

It doesn't take more then 2 minutes to setup a basic environment for Postgrsql.

>> And maybe there's no need to switch. SQLite is not a toy.
> 
> It's definitely not a toy, but maybe not the best option for web app
> which should muliple users at once?
> 
> 
> Sincerely,
> Gour
> 


- -- 
Com os melhores cumprimentos,

Carlos Correia
=
MEMÓRIA PERSISTENTE
Tel.: 219 291 591 - GSM:  917 157 146 / 967 511 762
e-mail: ge...@memoriapersistente.pt - URL: http://www.memoriapersistente.pt
Jabber: m...@jabber.org
GnuPG: wwwkeys.eu.pgp.net
URL Suporte: https://t5.m16e.com/gps
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.14 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlLz9rgACgkQ90uzwjA1SJVNUgCfYDa48i9z3xn4O3jwNTU4f7Kv
22oAn20hj9pcjggKwjP8hzHcpmK4jFGX
=2R0n
-END PGP SIGNATURE-

-- 
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] Acces to row object with widget (widget=lambda field, value, row: ...)

2014-02-06 Thread Richard
Hello,

I may ask something not realistic, I didn't think that much to this...

But I found my self, I would really need to know the value of another 
fields the than the field on which the widget is apply in other to init my 
widget correctly. I found a workaround that would be as easy as passing the 
value of those fields as a vars in the URL, but I feel that it is hacky 
compare to having acces to row from widget, like reprensent...

Just to be more specific... I use this widget, from s-cubism sqlab : 

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

That I modify to fix issue with initialisation on update form... The thing 
is, that my fix is far from perfect, since the conditionnal field (the one 
on which the widget have been declared) is not filtered out, only the 
proper value for the conditionnal field is selected as it should on form 
update...

So, I thougt, that I can fix this like that :

Defining another _get_select_el function (maybe not required, but for now 
let use it) :

def _get_select_el_for_init(self, trigger, value=None):
if trigger:
self._require.orderby = self.orderby or self._require.orderby
self._require.dbset = self._require.dbset(self.where(trigger))
options = self._require.options()
opts = [OPTION(v, _value=k) for (k, v) in options]
return DIV(SELECT(_id='%s__aux' % self._el_id, value=value,
  
_onchange='jQuery("#%s").val(jQuery(this).val());' % self._hidden_el_id,
  *opts))
else:
return self.default

Then 

I can do that :

if value:
el = DIV(script_el,
 
SPAN(self._get_select_el_for_init(trigger=self.conditional_field_value, 
value=value),
  # SELECT(value=value,
  #_id='%s__aux' % self._el_id,
  #   
 _onchange='jQuery("#%s").val(jQuery(this).val());' % self._hidden_el_id,
  #*[OPTION(v, _value=k) for (k, v) in 
field.requires.options()],
  #),
  _id=self._disp_el_id),
 INPUT(_value=value, _type='hidden',
   _name=field.name, _id=self._hidden_el_id,
   requires=field.requires),
 _id=self._el_id)
else:
el = DIV(script_el,
 SPAN(select_el or self.default, _id=self._disp_el_id),
 INPUT(_value=value, _type='hidden',
   _name=field.name, _id=self._hidden_el_id,
   requires=field.requires),
 _id=self._el_id)

Instead of what is commented out...

self.conditional_field_value contain the id selected in the "master" field.

It would requires that I could do something like that :

widget=lambda field, value, row: lazy_options_widget(field=field,

 on_key='no_table_master_field__selected',

 off_key='master_field__unselected',

 where=lambda master_field: (db.lookuptable.master_field == row.master_field
),

 trigger=request.vars.master_field,

 orderby=db.lookuptable.id,
 ...
 )

Does it make any sens or what?

I can just do that instead :

 if value:
el = DIV(script_el,
 SPAN(self._get_select_el_for_init(trigger=
*current.request.vars.conditional_field_value*, value=value),
  # SELECT(value=value,
  #_id='%s__aux' % self._el_id,
  #   
 _onchange='jQuery("#%s").val(jQuery(this).val());' % self._hidden_el_id,
  #*[OPTION(v, _value=k) for (k, v) in 
field.requires.options()],
  #),
  _id=self._disp_el_id),
 INPUT(_value=value, _type='hidden',
   _name=field.name, _id=self._hidden_el_id,
   requires=field.requires),
 _id=self._el_id)

And passing the vars into the URL...

Thanks

Richard

-- 
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

Re: [web2py] Installing web2py

2014-02-06 Thread Tim Richardson
Pythonanywhere is good. You get a shell so you can edit in the terminal, access 
github etc. 
If your budget stretches to USD $5 a month, you can get an entire virtual 
server from digitalocean.put Ubuntu on it and follow the web2py book. This is 
more setup work, but you learn more too. 
In both cases you can use the increasingly capable browser-based editor of 
web2py as well as terminal editors. 

-- 
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 handle (add?) hidden fields with a grid after submission / setting in onvalidation?

2014-02-06 Thread A36_Marty
Thanks Richard.  

Here's some simplified code to hopefully clarify what I'm trying to do:


db.define_table('record, Field('hidden_field'), Field('non_hidden_fields'))


def index():
grid = SQLFORM.grid(db.record, onvalidate=validate_form)

def validate_form(form):
Check to values in non-hidden fields, do a fairly complex lookup, if a 
record is found
in the lookup tables, stick the value in the "hidden_field", otherwise 
add a record in 
the lookup table and put the ID of the newly created record in the 
"hidden_field"

*And do all of the above with "hidden_field" never appearing to the user*, 
yet still being able to be modified in the validate_form fx.

I will do your Javascript hide approach if there's no other way to make 
this happen.   I just assume I was overlooking something

Many thank,
Marty


-- 
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] Acces to row object with widget (widget=lambda field, value, row: ...)

2014-02-06 Thread Anthony
Don't have time to process all this, but are you saying you have a row 
object and just need to know how to pass it to a custom widget?

On Thursday, February 6, 2014 4:14:26 PM UTC-5, Richard wrote:
>
> Hello,
>
> I may ask something not realistic, I didn't think that much to this...
>
> But I found my self, I would really need to know the value of another 
> fields the than the field on which the widget is apply in other to init my 
> widget correctly. I found a workaround that would be as easy as passing the 
> value of those fields as a vars in the URL, but I feel that it is hacky 
> compare to having acces to row from widget, like reprensent...
>
> Just to be more specific... I use this widget, from s-cubism sqlab : 
>
>
> https://github.com/BuhtigithuB/sqlabs/blob/patch-1/modules/plugin_lazy_options_widget.py
>
> That I modify to fix issue with initialisation on update form... The thing 
> is, that my fix is far from perfect, since the conditionnal field (the one 
> on which the widget have been declared) is not filtered out, only the 
> proper value for the conditionnal field is selected as it should on form 
> update...
>
> So, I thougt, that I can fix this like that :
>
> Defining another _get_select_el function (maybe not required, but for now 
> let use it) :
>
> def _get_select_el_for_init(self, trigger, value=None):
> if trigger:
> self._require.orderby = self.orderby or self._require.orderby
> self._require.dbset = self._require.dbset(self.where(trigger))
> options = self._require.options()
> opts = [OPTION(v, _value=k) for (k, v) in options]
> return DIV(SELECT(_id='%s__aux' % self._el_id, value=value,
>   
> _onchange='jQuery("#%s").val(jQuery(this).val());' % self._hidden_el_id,
>   *opts))
> else:
> return self.default
>
> Then 
>
> I can do that :
>
> if value:
> el = DIV(script_el,
>  
> SPAN(self._get_select_el_for_init(trigger=self.conditional_field_value, 
> value=value),
>   # SELECT(value=value,
>   #_id='%s__aux' % self._el_id,
>   #   
>  _onchange='jQuery("#%s").val(jQuery(this).val());' % self._hidden_el_id,
>   #*[OPTION(v, _value=k) for (k, v) in 
> field.requires.options()],
>   #),
>   _id=self._disp_el_id),
>  INPUT(_value=value, _type='hidden',
>_name=field.name, _id=self._hidden_el_id,
>requires=field.requires),
>  _id=self._el_id)
> else:
> el = DIV(script_el,
>  SPAN(select_el or self.default, _id=self._disp_el_id),
>  INPUT(_value=value, _type='hidden',
>_name=field.name, _id=self._hidden_el_id,
>requires=field.requires),
>  _id=self._el_id)
>
> Instead of what is commented out...
>
> self.conditional_field_value contain the id selected in the "master" field.
>
> It would requires that I could do something like that :
>
> widget=lambda field, value, row: lazy_options_widget(field=field,
> 
>  on_key='no_table_master_field__selected',
> 
>  off_key='master_field__unselected',
> 
>  where=lambda master_field: (db.lookuptable.master_field == 
> row.master_field),
> 
>  trigger=request.vars.master_field,
>  orderby=
> db.lookuptable.id,
>  ...
>  )
>
> Does it make any sens or what?
>
> I can just do that instead :
>
>  if value:
> el = DIV(script_el,
>  SPAN(self._get_select_el_for_init(trigger=
> *current.request.vars.conditional_field_value*, value=value),
>   # SELECT(value=value,
>   #_id='%s__aux' % self._el_id,
>   #   
>  _onchange='jQuery("#%s").val(jQuery(this).val());' % self._hidden_el_id,
>   #*[OPTION(v, _value=k) for (k, v) in 
> field.requires.options()],
>   #),
>   _id=self._disp_el_id),
>  INPUT(_value=value, _type='hidden',
>_name=field.name, _id=self._hidden_el_id,
>requires=field.requires),
>  _id=self._el_id)
>
> And passing the vars into the URL...
>
> Thanks
>
> Ri

[web2py] Re: sqlite <---> postgresql

2014-02-06 Thread Alan Etkin
> This is even better. No rush here, but just curious if there is any ETA 

> for it? 
>

ETA: uncertain. It is not a trivial change.

-- 
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] Restricting certian access based on Active Directory groups

2014-02-06 Thread Doug Campbell
I am trying to block access on specific things using Active Directory 
groups and am a bit lost.

I can login just fine using active directory and here is my connection 
string (with revealing info removed):

from gluon.contrib.login_methods.ldap_auth import ldap_auth
auth.settings.login_methods = [ldap_auth(mode='ad',
#allowed_groups = ['UnixAdmin'],
group_dn = 'OU=<>,DC=<>,DC=<>',
group_name_attrib = 'cn',
group_member_attrib = 'member',
group_filterstr = 'objectClass=Group',
   server='<>',
   base_dn='dc=<>,dc=<>')]


This works just fine and if I uncomment the allowed_groups line, it blocks 
access correctly to the entire application. I only want to block access to 
specific parts though. For example I want to make a database writable only 
if the user is a member of a specific Active Directory group but all 
users/groups should be able to login. 

Here is the code that was working when using local login but being able to 
use Active Directory would be great:

 if auth.has_membership(group_id='UnixAdmin'):
db.config_detail.value.writable=True
else:
db.config_detail.value.writable=False


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] Import from MySQL

2014-02-06 Thread Garry Smith
HI

I have just started using web2py, but have used MVC in other programming 
languages, the problem I have gaot is importing a db from MySQL.  I use the 
script in the scripts folder for extracting from MySQL, which worked fine. 
 When I added to web2py, most of the tables work fine, but one table keeps 
giving an flash error saying "Invalid query 1054, "Unknown column 'user.id' 
in 'where clause'".
Not surw how to correct.

This is the full error

Traceback (most recent call last):
  File 
"/home/gazza/Downloads/web2py/applications/school/controllers/appadmin.py", 
line 250, in select
nrows = db(query, ignore_common_filters=True).count()
  File "/home/gazza/Downloads/web2py/gluon/dal.py", line 10325, in count
return db._adapter.count(self.query,distinct)
  File "/home/gazza/Downloads/web2py/gluon/dal.py", line 1851, in count
self.execute(self._count(query, distinct))
  File "/home/gazza/Downloads/web2py/gluon/dal.py", line 1916, in execute
return self.log_execute(*a, **b)
  File "/home/gazza/Downloads/web2py/gluon/dal.py", line 1910, in log_execute
ret = self.cursor.execute(command, *a[1:], **b)
  File "/usr/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 174, in 
execute
self.errorhandler(self, exc, value)
  File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36, in 
defaulterrorhandler
raise errorclass, errorvalue
OperationalError: (1054, "Unknown column 'user.id' in 'where clause'")

-- 
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: linked_tables not show using smartgrid

2014-02-06 Thread 黄祥
finally found the culprit :
lazy_tables = True
on
db = DAL('sqlite://test.sqlite', pool_size = 30, check_reserved = ['all'], 
migrate = True, fake_migrate_all = False, lazy_tables = True)

my question is why lazy_tables = True is affected the linked tables on the 
smartgrid? i found the solution just set lazy_tables = False or simply just 
remove lazy_tables = True
check on web2py book it said :
Because usually in web2py models are executed before controllers, it is 
possible that some table are defined even if not needed. It is therefore 
necessary to speed up the code by making table definitions lazy. This is 
done by setting the DAL(...,lazy_tables=True) parameter. Tables will be 
actually created only when accessed.

just don't know the reason of it, i've accessed the tables by insert the 
data on it via sqlform smartgrid and the tables already created before i 
insert it for the first time (checked on database administration)

any idea about this?

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.


[web2py] Re: Upload file to copy.com

2014-02-06 Thread Alan Etkin

>
> 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?
>

You can handle dropbox data from web2py apps instead

http://www.web2py.com/books/default/chapter/29/14/other-recipes?search=dropbox#Dropbox-API

However, you would need custom code to write upload streams to the remote 
storage system

-- 
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-06 Thread Dave S
Thanks for the followup!

/dps


On Wednesday, February 5, 2014 3:09:33 AM UTC-8, Jayadevan M wrote:
>
> 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.


[web2py] Re: Strange artifact

2014-02-06 Thread horridohobbyist
Really? Nobody knows? Nobody cares?


On Wednesday, 5 February 2014 20:53:13 UTC-5, horridohobbyist wrote:
>
> 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] Dreamhost deployment

2014-02-06 Thread sasogeek
how do I install python 2.7 and web2py on dreamhost with a windows 
environment? I looked at the dreamhost wiki but their tutorial assumes 
installation from a linux environment... help?

-- 
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] Search operators

2014-02-06 Thread horridohobbyist
In SQLFORM.grid, you have a Search operation in the form. The operators 
include =, !=, <, >, <=, >=, starts with, contains, in, not in. I can't 
figure out how to use 'in' and 'not in'. What are these operators?? Are 
they for strings? Are they for numeric ranges? If the latter, how do you 
designate a range?

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] jQuery Noob question: usage of this

2014-02-06 Thread Dominique
Hello,

That's a noob question... Thanks for helping

Inside a function in a script, I'm trying to get the value of a button when 
clicked.
I just can't figure out the usage of "this" in that case.
There are a certain number of buttons in the page and several functions 
attached to them so I don't want to do jQuery('.A1').val() in the fuction 
each time a button is clicked. 
I want the function to detect which button is clicked and its value


jQuery(document).ready(function(){
$.fn.dosomething = function(){
var currentval = $(this).val();
console.log(currentval);
};
});




Thanks a lot for any help

Dominique

-- 
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-06 Thread step


On Thursday, February 6, 2014 2:02:00 PM UTC+1, Anthony wrote:
>
>
> I think most if not all messages generated in gluon code are customizable 
> via the API as well as translatable. If you are aware of messages that are 
> not, please point them out.
>

What do you mean by customizable via the API? I don;t know how to do that 
for gluon messages - other than patching the source. Can you teach me 
another way?

-- 
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: sqlite <---> postgresql

2014-02-06 Thread Gour
On Thu, 06 Feb 2014 20:55:20 +
Carlos Correia
 wrote:

> Also with Postgresql (unless you're in Windows).

I'm know...since the time when I was running Bacula (backup) and
recently I moved from linux (Debian Sid) to Free/PC-BSD, one still has
to take care when upgrading server versions as well as to use compatible
version on localhost and production server where I do not control system
software which is installed (I use webfaction-like semi-shared hosting).

With Sqlite, it's no-brainer. :)

Sincerely,
Gour

-- 
A person who has given up all desires for sense gratification, 
who lives free from desires, who has given up all sense of 
proprietorship and is devoid of false ego — he alone can 
attain real peace.

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


signature.asc
Description: PGP signature