[web2py] Re: where is pydal doc ?

2017-11-10 Thread Lars

Thanks a lot for the thorough explanation, I will keep that in mind for my 
future investigations. 


>

-- 
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/d/optout.


[web2py] Re: where is pydal doc ?

2017-11-09 Thread Lars



> As suggested, if you can't find documentation on something, first trying 
> searching this forum, as there are several posts explaining 
> decode_credentials (e.g., 
> https://groups.google.com/d/msg/web2py/xPREtSr3-PI/xx5EPVrU738J). It has 
> nothing to do with database encryption. Rather, it allows you to url-encode 
> your database credentials in case they happen to include an "@" character 
> (which causes a problem because the DAL uses the "@" character to separate 
> the username and password). If you url-encode your credentials, setting 
> decode_credentials=True then instructs the DAL to decode the credentials 
> after parsing them from the connection string.
>

Thanks for that. Bad google, and I thought he was my friend. :)

 

>
> Another strategy is simply to grep the codebase -- in this case, that 
> would lead you here 
> 
> .
>

I rarely use it because it often returns too much result. But in this case, 
I surely should have. I'd have ruled out database encryption even if not 
understand fully its use purpose.

 

>
> There is a Github repo for the web2py book 
> . You are certainly encouraged to 
> make contributions to it. I'm not sure if you were using the repo when you 
> were working on the translation, but if so, you should have seen the 
> existing translation in the repo (or in a pull request if it wasn't merged 
> yet).
>

Actually I did, my first. But even in github, as far as I know, there is no 
way to know what work forkers are working on and monitor their progress, is 
there ? 


-- 
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/d/optout.


[web2py] Re: where is pydal doc ?

2017-11-09 Thread Lars
Thanks for the support, I already feel less less. :)

On Wednesday, November 8, 2017 at 3:40:33 PM UTC+1, Leonel Câmara wrote:
>
> Lars I think everyone agrees the pyDAL codebase should be better 
> documented. I even opened up an issue about it 
> https://github.com/web2py/pydal/issues/468
>
> I think what happened here was that people thought you wanted usage 
> documentation, the DAL's usage is pretty well documented in the web2py 
> book. The DAL code, not so much.  
>

-- 
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/d/optout.


[web2py] Re: where is pydal doc ?

2017-11-08 Thread Lars
"Good morning, Dave.." :)

Actually here I was looking for the decode_credential meaning, which I 
guess is for database encryption, but I would have like it better to have a 
description of its use, its handling (does it suffice to encrypt the 
database or do I need to encrypt the database myself and then, provide 
credentials to w2p to allow it to use it, etc..). For example, I didn't 
know what is connection pooling but looking at the doc in the book allow me 
to assess and decide if I need it or not, and at least to understand the 
basic function.

Furthermore, I understand that w2p is not fully compatible with python3, so 
I was ok to encounter some difficulties. But when I try to ascend in the 
code (I use pycharm), I find many functions with the same name with no doc 
explaining its purpose or parameters types. And as a far from experimented 
developer, I found it very difficult to sort out my own mistakes, from my 
computer's bugging attitude (yes it does.. sometimes) and the w2p faulty 
code if there is. Less now because I know that it can happen, but I spent a 
lot of time, some not so often times I know, trying to correct things in my 
code and in fact looking at the wrong place.

This is what led me to change to django, which at least, when I have an 
error : I am 99% sure that it is my fault (yes I heard you in the back... 
That you're pretty sure that it is the same with w2p :) ). And also, they 
have detailed tutorials, for each version of the software (which w2p 
doesn't need as it is 100% compatible between versions... Mostly).

That being said, after playing around with w2p, I can say that when I 
follow some dj tutorials, now I am able to say : oh ok they are doing that 
for this reason, this other thing for that other reason. Because I could 
play a lot with functioning applications in web2py, but I am afraid that 
the magic behind w2p still remains magic for me today. And there comes the 
philosophical question : is good coding better teaching than good 
documentation ? I think that we need both. I encounter django first and I 
didn't like it because I didn't understand the why behind the 
code/documentation (app code structure, relation between static and non 
static ressources/servers, their gluttonous appetite for external python 
tools, etc...). I then turned to web2py and understood the why. But now 
that I want to understand the how, I find deeper meaning in the django docs 
(I may be dumber than the average (yes you in the back, I heard that 
too...) but I just understood lately, for example, that it is better to 
freeze the software version in time to work an app).

As I'm still playing and haven't started my "super app" :) yet, I may be 
back to w2p later. All the more so as Massimo seems to want to develop a 
new soft which will behave more like django, fully compatible with python3. 
So I kind of taking some advance into the comprehension of this one. ;)

But I still humbly think documentation as the key to a better teaching and 
that the official website should unite it all : recent tutorials, detailed 
class api references and the book as a general insight of the software 
(even if some of you find some information redundant or self explaining, 
dumb newbies need redundancy and even useless explanations). I am even 
willing to help on the matter if you can find some use for my lack of 
competence. :D But for this too, there must be a place where all 
improvements are displayed in real time (maybe it is but I don't know 
where) : for example, I tried to translate a part of the book a few months 
ago, all for realise when I was finished that it was already done.

Thanks to all that are still awake.





On Tuesday, November 7, 2017 at 9:24:04 PM UTC+1, Dave S wrote:
>
>
>
> On Tuesday, November 7, 2017 at 7:59:19 AM UTC-8, Lars wrote:
>>
>> I really didn't want to argue on this, I just said how I feel, that's 
>> all. Sorry if I offended anyone.
>>
>
> I don't think it was a matter of offense (although I'm not Anthony, I've 
> had a chance to see his work here); more a matter of making sure the thread 
> has the most accurate information for other people who read (or will read) 
> these posts, and to give you any help that you might want to pick up on.
>
> What did you feel was missing in the documentation?  What were you trying 
> to do at the time?
>
> /dps
>
>
>
>> On Tuesday, November 7, 2017 at 4:52:18 PM UTC+1, Anthony wrote:
>>>
>>> On Tuesday, November 7, 2017 at 4:22:44 AM UTC-5, Lars wrote:
>>>>
>>>> Hi Anthony,
>>>>
>>>> > I think that convers most of the arguments
>>>>
>>>>
>>>> Actually 11 on 24...
>>>>
>>>
>>> I count 19 out of 24 documented in the DAL chapter of the book and 2 
>>> additional (after_connection and 

[web2py] Re: where is pydal doc ?

2017-11-07 Thread Lars
I really didn't want to argue on this, I just said how I feel, that's all. 
Sorry if I offended anyone.

On Tuesday, November 7, 2017 at 4:52:18 PM UTC+1, Anthony wrote:
>
> On Tuesday, November 7, 2017 at 4:22:44 AM UTC-5, Lars wrote:
>>
>> Hi Anthony,
>>
>> > I think that convers most of the arguments
>>
>>
>> Actually 11 on 24...
>>
>
> I count 19 out of 24 documented in the DAL chapter of the book and 2 
> additional (after_connection and table_hash) documented at 
> http://pydal.readthedocs.io/en/latest/. The only arguments that appear to 
> be undocumented are debug, db_uid, and tables, and you probably don't need 
> those (not saying they shouldn't be documented, but you make the situation 
> sound much worse than it is).
>
> 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/d/optout.


[web2py] Re: where is pydal doc ?

2017-11-07 Thread Lars
Hi Anthony,

> I think that convers most of the arguments


Actually 11 on 24... ;)

 

-- 
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/d/optout.


Re: [web2py] where is pydal doc ?

2017-11-06 Thread Lars
Hi Kiran,

Yes it does... A bit. I couldn't find this in the source code, I really 
have a hard time to find my way through it.
Do you know by chance what is the decode_credentials parameter ?

Thanks a lot anyway. ;)

On Monday, November 6, 2017 at 5:37:07 PM UTC+1, Kiran Subbaraman wrote:
>
> This helps? 
> http://pydal.readthedocs.io/en/latest/_modules/pydal/base.html?highlight=DAL
>
> 
> Kiran Subbaramanhttp://subbaraman.wordpress.com/about/
>
> On 06-Nov-17 9:02 PM, Lars wrote:
>
> Hi, 
>
> I would like to use pydal but I can't seem to find the documentation 
> (except from this one : http://pydal.readthedocs.io/en/latest/). But I 
> didn't find (sorry if I missed it) anywhere explained the DAL constructor 
> parameters for example.
> Is there any ? And where please ?
>
> Thank you
> -- 
> 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/d/optout.
>
>
>

-- 
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/d/optout.


[web2py] where is pydal doc ?

2017-11-06 Thread Lars
Hi,

I would like to use pydal but I can't seem to find the documentation 
(except from this one : http://pydal.readthedocs.io/en/latest/). But I 
didn't find (sorry if I missed it) anywhere explained the DAL constructor 
parameters for example.
Is there any ? And where please ?

Thank you

-- 
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/d/optout.


[web2py] checkbox don't appear

2017-09-21 Thread Lars
Hi,

I want to display a form with the following code :

def display_line():
T = current.T
try:
return TR(
TD(id),
TD(file_name),
TD(file_size),
TD(file_type),
TD(INPUT(_type='submit', _name=T('Rename'), _value=T('Rename'
))),
TD(INPUT(_type='submit', _name=T('Delete'), _value=T('Delete'
))),
TD(INPUT(_type='submit', _name=T('Details'), _value=T('Details'
))),
TD(INPUT(_type='checkbox', _value=id))
)
except (AttributeError, KeyError):
return


def get_filesystem_form():
T = current.T
files_html = []

# get files list
file_list = files.load()

for _file in file_list:
files_html.append(display_line(_file))
return FORM(TABLE(*files_html), _width='100%')




And everything looks fine except that checkboxes don't appear.

Any idea ?

w2p : 2.15.4 python : 3.5.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/d/optout.


[web2py] Re: logging

2017-08-31 Thread Lars
The code needs to be in model not in modules.

Could anyone explain why ?



On Thursday, August 31, 2017 at 12:38:32 PM UTC+2, Lars wrote:
>
> Hi,
>
> I have this code in dlogging.py in the modules folder of my app :
>
> import logging
> import logging.handlers
>
>
> def get_configured_logger(name):
> global logger
> logger = logging.getLogger(name)
> if len(logger.handlers) == 0:
> fh = logging.FileHandler(os.path.join('/'.join(os.path.realpath(
> __file__).split('/')[:-3]),
>  'logs/system.log'))
> formatter = logging.Formatter('%(asctime)s - %(levelname)s 
> %(message)s')
> fh.setFormatter(formatter)
> logger.addHandler(fh)
> logger.setLevel(logging.DEBUG)
> return logger
>
> logger = get_configured_logger('web2py.app.system')
>
> I don't understand why it works in the shell but not from web2py from 
> inside a module class (with from dloggig import logger). Could anybody 
> figure why ?
>
> Thanks
>
> w2p : 2.15.3 py : 3.5.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/d/optout.


[web2py] logging

2017-08-31 Thread Lars
Hi,

I have this code in dlogging.py in the modules folder of my app :

import logging
import logging.handlers


def get_configured_logger(name):
global logger
logger = logging.getLogger(name)
if len(logger.handlers) == 0:
fh = logging.FileHandler(os.path.join('/'.join(os.path.realpath(
__file__).split('/')[:-3]),
 'logs/system.log'))
formatter = logging.Formatter('%(asctime)s - %(levelname)s 
%(message)s')
fh.setFormatter(formatter)
logger.addHandler(fh)
logger.setLevel(logging.DEBUG)
return logger

logger = get_configured_logger('web2py.app.system')

I don't understand why it works in the shell but not from web2py from 
inside a module class. Could anybody figure why ?

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/d/optout.


[web2py] Re: how to use a specific driver for the database

2017-08-30 Thread Lars
Hi Anthony,

psycopg2 was installed but (don't know if related) I use the last web2py on 
python3.5 and it didn't find it.
It should now.

Thank you ;)

On Wednesday, August 30, 2017 at 5:49:17 PM UTC+2, Anthony wrote:
>
> If psycopg2 is installed, then it will be used by default.
>
> In any case, you can be explicit via the connection string:
>
> 'postgres:psycopg2://...'
>
> Anthony
>
> On Wednesday, August 30, 2017 at 11:16:32 AM UTC-4, Lars wrote:
>>
>> Hi,
>> How can we use for example : psycopg2 instead of pg8000 which is default ?
>> 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/d/optout.


[web2py] Re: Modules do not reflected changes.

2017-08-30 Thread Lars
Hi,
You need to write at the beginning of the app models :
from gluon.custom_import import track_changes
track_changes(track=True)
Regards

On Wednesday, August 30, 2017 at 4:56:54 PM UTC+2, Claudio Andre wrote:
>
> Hello,
>
> I'm using web2py 2.15.3-stable on Kali (debian) and having a strange 
> behavior. Each time I change anything on the source code of one of the 
> modules I have inside of the folder /applications/modules/ is not reflected 
> on the application unless I reboot the VM (tried restarting just the web2py 
> server but it does not help)
>
> I'm using the* from folderspath.module import class *normal syntax to 
> import the module.
>
> From what I've search, only old versions of web2py that did not used 
> Rocket had this type of issues in reloading modules.
>
> Thanks for the 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/d/optout.


[web2py] how to use a specific driver for the database

2017-08-30 Thread Lars
Hi,
How can we use for example : psycopg2 instead of pg8000 which is default ?
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/d/optout.


[web2py] Re: rendering multiple components in ajax call

2017-05-10 Thread Lars
The solution is to put the table and the form in a div not in a dict. 
Simple enough.. ^^

On Wednesday, May 10, 2017 at 10:35:42 PM UTC+2, Lars wrote:
>
> Hi,
>
> Those are my first steps with ajax, so please indulge me.. :)
>
> I have a list of divs describing objects. Id like to click on one div so 
> that it sends the object id in an ajax call which would open a div at the 
> top with the object description and a form to bid on it. I don't know how 
> to send the id to a LOAD function and the poor result I got so far led to a 
> already submitted form which give the validator error message (here a 
> decimal in range).
>
> So this is what I have so far : cf. test code
>
> so when this code runs it render a new whole page containing the table in 
> the div. If I add the form in the dict, it just renders nothing.
>
> db.py :
> db.define_table('objects', Field('name'), Field('price'))
> # demo data
> db.objects.bulk_insert([dict(name='station', price=52), dict(name='desk', 
> price=52), dict(name='glass', price=52), dict(name='beer', price=52)])
>
> default.py
> def index():
> # get objects list
> current_objects = db(db.objects).select().as_list()
> return dict(current_objects=current_objects)
>
>
> def object_desc():
> oid = request.vars.oid
> # get object description
> object_desc = db(db.objects.id == oid).select()
> name = object_desc[0].name
> price = object_desc[0].price
>
> object_desc = TABLE(TH('object Details', _colspan="2"),
> TR('Name : ', TD(name, _colspan="3")),
> TR('Price : ', TD(price, _colspan="3"))
> )
>
> form = SQLFORM(db.bid)
> return dict(oid=oid, object_desc=object_desc)
>
>
> index.html
> {{extend 'layout.html'}}
> {{n = 0}}
>
> 
> 
>
> 
>
> 
> {{=T('Name')}}
> {{=T('Price')}}
> 
>
> {{for object_ in current_objects:}}
> {{n += 1}}
>  onclick="$('#object_tools').slideToggle(); var oid={{=object_['id']}}; 
> ajax('object_desc?oid=' + oid, [], 'object_tools');">
> {{=object_['name']}}
> {{=object_['price']}}
> 
> {{pass}}
>
> 
>
>
> 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/d/optout.


[web2py] Re: How do I change the sqlform button location

2017-05-10 Thread Lars
Hi,

For custom styles, you should use the web tools addons in firefox to get 
the chain of formattings : you click on the button you want to customize 
and you have all css styles matching it.

To change the disposition of the widgets (input, button, etc..), for a 
complete customization you should try custom forms as in : 
http://www.web2py.com/books/default/chapter/29/07/forms-and-validators#Custom-forms

Best,


On Wednesday, May 10, 2017 at 9:21:03 PM UTC+2, hardclock wrote:
>
>
>  Hello everyone.
> I'm sorry for the inconvenience,I just started learning css and web2py 
> recently. With the\is page I want to create a login layout similar to the 
> on in ubuntu where the input fields are in the middle and the 
> "username/password" texts are inside the fields.
> I was able to change the colors,font and border of the texts and fields 
> but I couldn't change the submit button nor move any of them out of the 
> corner.Is there any way to do it?I remembered each field has a 
> corresponding class but couldn't find it in the manual.Thank you and sorry 
> for the trouble.
>
>
> h1 {
> color: #6b9430;
> text-align: center;
>font-family: FontAwesome;
>font-size: 50px;
>font-weight: 300;
>text-transform: none !important;
> }
> body, input, select, textarea {
> color: black;
> font-family: FontAwesome;
> font-size: 10pt;
> font-weight: 900;
> line-height: 1.65em;
> }
> input[type='text'],
> input[type='password'],
> input[type='email'],
> input[type='select']
> textarea{
> color: #3b9e3b;
> margin-left: auto;
> margin-right: auto;
> border-radius: 8px;
> width: 200px;
> height: 20px;
> }
> I've tried input[type='submit'] and button 
>
>

-- 
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/d/optout.


[web2py] rendering multiple components in ajax call

2017-05-10 Thread Lars
Hi,

Those are my first steps with ajax, so please indulge me.. :)

I have a list of divs describing objects. Id like to click on one div so 
that it sends the object id in an ajax call which would open a div at the 
top with the object description and a form to bid on it. I don't know how 
to send the id to a LOAD function and the poor result I got so far led to a 
already submitted form which give the validator error message (here a 
decimal in range).

So this is what I have so far :

db.py :
db.define_table('objects', Field('name'), Field('price'))
# demo data
db.objects.bulk_insert([dict(name='station', price=52), dict(name='desk', 
price=52), dict(name='glass', price=52), dict(name='beer', price=52)])

default.py
def index():
# get objects list
current_objects = db(db.objects).select().as_list()
return dict(current_objects=current_objects)


def object_desc():
oid = request.vars.oid

# get object description
object_desc = db(db.objects.id == oid).select()
name = object_desc[0].name
price = object_desc[0].price

object_desc = TABLE(TH('object Details', _colspan="2"),
TR('Name : ', TD(name, _colspan="3")),
TR('Price : ', TD(price, _colspan="3"))
)

form = SQLFORM(db.bid)
# form.vars.user_id = auth.user.id
#
# if form.accepts(request, formname=None):
# return DIV("Message posted")
# elif form.errors:
# return TABLE(*[TR(k, v) for k, v in form.errors.items()])

return dict(oid=oid, object_desc=object_desc)


index.html
{{extend 'layout.html'}}
{{n = 0}}







{{=T('Name')}}
{{=T('Price')}}


{{for object_ in current_objects:}}
{{n += 1}}

{{=object_['name']}}
{{=object_['price']}}

{{pass}}



Enter code here...
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/d/optout.


[web2py] Re: xml() error when BEAUTIFY globals()

2017-03-24 Thread Lars

I went for something even simpler : I bypass BEAUTIFUL.. I just wanted a 
view with everything named :
def my_beautify(component):
t = TABLE()
if isinstance(component, dict):
for k, v in component.iteritems():
if v is None or isinstance(v, (bool, str)):
t.append(TR([str(k), str(v), ' ']))
else:
t.append(TR([str(k), repr(v), str(dir(v))]))
return t

Thanks to both of you ! :)



On Friday, March 24, 2017 at 12:08:16 AM UTC+1, Anthony wrote:
>
> BEAUTIFY is not designed to take the entire global environment. The 
> problem is that globals() includes all of the web2py HTML helper classes. 
> Because BEAUTIFY is itself an HTML helper, it is serialized by recursively 
> processing its components. The serialization process checks whether a given 
> component has a callable "xml" attribute, and assuming such an attribute is 
> an instance method, it attempts to call .xml(). The problem is the helper 
> classes themselves do have a callable "xml" attribute, but it is not 
> actually an instance method in that case (it is simply an attribute that 
> belongs to the class itself) -- so calling it generates an exception.
>
> You might try something like:
>
> BEAUTIFY({k: v for k, v in globals().iteritems() if not hasattr(v, 'xml'
> )})
>
> But you're probably asking for trouble attempting to display the entire 
> global environment.
>
> 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/d/optout.


[web2py] xml() error when BEAUTIFY globals()

2017-03-23 Thread Lars
Hi,

Everything is in the title : I try to have a BEAUTIFY look at 
copy.copy(globals()) and I get an xml error line 131 in html.py :

data is empty for : return data.xml()

Why can't we beautify globals() ?

Thank you

-- 
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/d/optout.


Re: [web2py] global name DIV not defined

2017-03-15 Thread Lars
I don't now about before (I don't have much experience) but the book 
specifies not to pass current at module level, only in functions. 
Thanks for the hint anyway. :)


On Tuesday, March 14, 2017 at 9:40:36 PM UTC+1, Richard wrote:
>
>
> http://web2py.com/books/default/chapter/29/04/the-core#Sharing-the-global-scope-with-modules-using-the-current-object
>
> current.request, response, etc
>
> On Tue, Mar 14, 2017 at 4:40 PM, Richard Vézina <ml.richa...@gmail.com 
> > wrote:
>
>> You can pass T() to module or use current.T(), I think the later is the 
>> proper way to do now as current wasn't existing before we had to pass 
>> request, T(), etc...
>>
>> http://web2py.com/books/default/chapter/29/04/the-core#API
>>
>> "Other objects and modules are defined in the libraries, but they are not 
>> automatically imported since they are not used as often.
>>
>> The core API entities in the web2py execution environment are request, 
>> response, session, cache, URL, HTTP, redirect and Tand are discussed 
>> below."
>>
>>
>> Then a little further :
>>
>>
>>
>> On Tue, Mar 14, 2017 at 3:23 PM, Lars <laer...@gmx.fr > 
>> wrote:
>>
>>> Actually it comes from T, the issue remains even with no xml() or XML 
>>> involved.
>>>
>>> Sorry but I reduced the function to the wrong line : I had a T = 
>>> current.T at the beginning of get_dashboard() which
>>> deletion didn't suppress the issue.
>>>
>>> It seems that an involuntary (my bad) spelling of the returned string 
>>> (message='Lorat ..') created multiple versions of the message in LANG.py 
>>> which then create a bad dictionary that contains different possible 
>>> translations for the same item in uwsgi cache.
>>>
>>> Rewrite (sanitize) lang.py by hand and restart uwsgi does the trick.
>>>
>>> Thank you
>>>
>>>  
>>>
>>> On Tuesday, March 14, 2017 at 1:07:13 AM UTC+1, Richard wrote:
>>>>
>>>> So the problem is from .xml() than??
>>>>
>>>> Richard
>>>>
>>>> On Mon, Mar 13, 2017 at 6:20 PM, Anthony <abas...@gmail.com> wrote:
>>>>
>>>>> No, DIV is in gluon.html.
>>>>>
>>>>> --
>>>>> 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/d/optout.
>>>>>
>>>>
>>>> -- 
>>> 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/d/optout.
>>>
>>
>>
>

-- 
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/d/optout.


Re: [web2py] global name DIV not defined

2017-03-14 Thread Lars
Actually it comes from T, the issue remains even with no xml() or XML 
involved.

Sorry but I reduced the function to the wrong line : I had a T = current.T 
at the beginning of get_dashboard() which
deletion didn't suppress the issue.

It seems that an involuntary (my bad) spelling of the returned string 
(message='Lorat ..') created multiple versions of the message in LANG.py 
which then create a bad dictionary that contains different possible 
translations for the same item in uwsgi cache.

Rewrite (sanitize) lang.py by hand and restart uwsgi does the trick.

Thank you

 

On Tuesday, March 14, 2017 at 1:07:13 AM UTC+1, Richard wrote:
>
> So the problem is from .xml() than??
>
> Richard
>
> On Mon, Mar 13, 2017 at 6:20 PM, Anthony  
> wrote:
>
>> No, DIV is in gluon.html.
>>
>> --
>> 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/d/optout.
>>
>
>

-- 
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/d/optout.


[web2py] global name DIV not defined

2017-03-13 Thread Lars
Hi,

I have this small code in the dashboard module:

from gluon.html import DIV
def get_dashboard():
return DIV(
DIV('Lorat ipsum etc', _class='dashboard alert'),
_class='center-box').xml()

and this one in default.py :

def index():
from modelling.dashboard import get_dashboard
dashboard = get_dashboard()
return dict(message=message, dashboard=dashboard



And I noticed that if I refresh the page to quickly sometimes I have the 
error :
global name DIV is not defined

or some other, the css is not defined ?

Could anybody figure why ? And how to avoid this ?

Thank you,

-- 
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/d/optout.


[web2py] Re: what are hooks - modelless ?

2017-03-02 Thread Lars
I'm going for the module approach, I find that easier to organize. 
Actually I did define some tables like you suggested but I thought maybe 
his way was a more pythonic or proper one.

Thanks for your answer.



On Thursday, March 2, 2017 at 8:49:28 PM UTC+1, Anthony wrote:
>
> Looks like you would define those methods in your model classes (when 
> needed). I would say this whole approach is overly complex, though. If you 
> want to avoid the overhead of defining models, first simply set 
> lazy_tables=True 
> <http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Lazy-Tables>.
>  
> If that's not enough, then try conditional models 
> <http://web2py.com/books/default/chapter/29/04/the-core#Conditional-models>. 
> Finally, if you would like to move model definitions to modules, you can do 
> so by simply wrapping standard web2py db.define_table calls inside a 
> function rather than using the complex class-inheritance-based approach 
> shown in this slice.
>
> Anthony
>
> On Thursday, March 2, 2017 at 10:01:09 AM UTC-5, Lars wrote:
>>
>> Hi,
>>
>> Could someone please explain to me how to use hooks in that code ? I 
>> can't find where the set_ functions are defined : so I guess I have to 
>> write them but where ? And what are they different from the define_ ones ?
>>
>>
>> http://www.web2pyslices.com/slice/show/1479/model-less-apps-using-data-models-and-modules-in-web2py
>>
>> Thank you
>>
>

-- 
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/d/optout.


[web2py] what are hooks - modelless ?

2017-03-02 Thread Lars
Hi,

Could someone please explain to me how to use hooks in that code ?

http://www.web2pyslices.com/slice/show/1479/model-less-apps-using-data-models-and-modules-in-web2py

Thank you

-- 
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/d/optout.


Re: [web2py] Re: Oh, Reddit :(

2011-02-07 Thread Lars Hansson
But what exactly is his complaint? Would it have hurt for him to
actually, you know, explain?

---
Lars


Re: [web2py] Why web2py? and not django?

2011-01-26 Thread Lars Hansson
Yeah, but if everyone sits around waiting for the champion to appear
there won't be one. Someone has to take the plunge.

Cheers,
Lars Hansson