[web2py] Re: rname and reserved names

2014-07-22 Thread Niphlod
if it's what I think, then 

db = DAL(, check_reserved=None)
db.define_table('easy', 
   Field('position', rname='"difficult_name_for_the_field"'),
rname='"difficult_name_for_table"')

should work (albeit, if it does, it shows "the bug" because if you're using 
rname, then you don't need to check for reserved keywords).

The point of rname (in addition to give the possibility to use the proper 
quoting directly) is also to separate model from the underling structure.

Usually I'm dealing with table names like 
t_ABCD_Alpha_Blocking_Common_Dolls and fields like 
ABCD_CreationDateForTicket (very enteprisey ^_^''') ... until rname my 
code was full of

db(db.t_ABCD_Alpha_Blocking_Common_Dolls.ABCD_CreationDateForTicket > 
request.now).select(db.t_ABCD_Alpha_Blocking_Common_Dolls.ALL)


that eventually turned up to be

tb = db.t_ABCD_Alpha_Blocking_Common_Dolls
db(tb.ABCD_CreationDateForTicket > request.now ).select(tb.ALL)



but it was a vibe-killer.

Now I can

db.define_table('ABCD',
Field('CreateDate', rname='"ABCD_CreationDateForTicket"'),
rname='"t_ABCD_Alpha_Blocking_Common_Dolls"')


and use 

db(db.ABCD.CreateDate > request.now).select(db.ABCD.ALL)




On Tuesday, July 22, 2014 12:29:06 AM UTC+2, Simon Ashley wrote:
>
> Thanks Niphlod, its the latter. A question just concerning rname/ quoting 
> 101. 
> Haven't used it before, and trying baby steps to see how it works.
> (couldn't see it hitting the relevant sections of dal.py)
> A simple working example would give me a push in the right direction.
>
> While Limedrop raises interesting points which I''ll explore, its not 
> where my headspace is currently at.
>
>

-- 
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: rname and reserved names

2014-07-22 Thread Michele Comitini
You can also use explicit quoting of entities at DAL level.  It works
transparently so you can use the same names in python and in the DB schema.

db = DAL('postgres://...', ...,ignore_field_case=False, entity_quoting=True)


db.define_table('table1', Field('column'), Field('COLUMN'))

print db(db.table1.COLUMN != db.table1.column).select()




2014-07-22 10:09 GMT+02:00 Niphlod :

> if it's what I think, then
>
> db = DAL(, check_reserved=None)
> db.define_table('easy',
>Field('position', rname='"difficult_name_for_the_field"'),
> rname='"difficult_name_for_table"')
>
> should work (albeit, if it does, it shows "the bug" because if you're
> using rname, then you don't need to check for reserved keywords).
>
> The point of rname (in addition to give the possibility to use the proper
> quoting directly) is also to separate model from the underling structure.
>
> Usually I'm dealing with table names like
> t_ABCD_Alpha_Blocking_Common_Dolls and fields like
> ABCD_CreationDateForTicket (very enteprisey ^_^''') ... until rname my
> code was full of
>
> db(db.t_ABCD_Alpha_Blocking_Common_Dolls.ABCD_CreationDateForTicket >
> request.now).select(db.t_ABCD_Alpha_Blocking_Common_Dolls.ALL)
>
>
> that eventually turned up to be
>
> tb = db.t_ABCD_Alpha_Blocking_Common_Dolls
> db(tb.ABCD_CreationDateForTicket > request.now ).select(tb.ALL)
>
>
>
> but it was a vibe-killer.
>
> Now I can
>
> db.define_table('ABCD',
> Field('CreateDate', rname='"ABCD_CreationDateForTicket"'),
> rname='"t_ABCD_Alpha_Blocking_Common_Dolls"')
>
>
> and use
>
> db(db.ABCD.CreateDate > request.now).select(db.ABCD.ALL)
>
>
>
>
> On Tuesday, July 22, 2014 12:29:06 AM UTC+2, Simon Ashley wrote:
>
>> Thanks Niphlod, its the latter. A question just concerning rname/ quoting
>> 101.
>> Haven't used it before, and trying baby steps to see how it works.
>> (couldn't see it hitting the relevant sections of dal.py)
>> A simple working example would give me a push in the right direction.
>>
>> While Limedrop raises interesting points which I''ll explore, its not
>> where my headspace is currently at.
>>
>>  --
> 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.
>

-- 
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: Are there any Lotus Notes developers using web2py?

2014-07-22 Thread António Ramos
done
https://code.google.com/p/web2py/issues/detail?id=1953


2014-07-22 7:31 GMT+01:00 Massimo Di Pierro :

> Please open a ticket about this.
>
>
> On Monday, 21 July 2014 11:15:36 UTC-5, Ramos wrote:
>>
>> Hello @Massimo, any news about this?
>>
>> Em quarta-feira, 21 de setembro de 2011 18h23min18s UTC+1, Massimo Di
>> Pierro escreveu:
>>>
>>> I see the need for this. I need to think bout how to do it in a
>>> backward compatible way and in a way that works on GAE without joins.
>>> Please open a ticket about it.
>>>
>>> On Sep 20, 5:03 pm, António Ramos  wrote:
>>> > *  The Web2py security methods put Notes ACL to shame?*
>>> > Can you explain why you think this way?
>>> >
>>> > how do i solve this problem in web2py?
>>> >
>>> > In a small organization (+- 100 users) it can be dificult to manage
>>> ACLs
>>> > without being able to add group to group membership.
>>> >
>>> > consider my company
>>> >
>>> > we have this groups in the maintenance department
>>> >
>>> > MMC (20 users)
>>> > ME ( 15 users)
>>> > MI ( 10 users)
>>> >
>>> > MD (maintenance department)
>>> > (all users above)
>>> >
>>> > so this group is composed of MMC,ME, MI and we dont repeat adding all
>>> users
>>> > to MD, we just add group MMC,ME,MI
>>> >
>>> > When we delete a person from ME, MD group automaticaly reflects the
>>> change.
>>> >
>>> > In Lotus notes is very easy.
>>> > *in web2py its impossible!*
>>> >
>>> > Also in web2py you have to decorate every function to allow certain
>>> users or
>>> > groups. In Lotus Notes if i say in my app acl that user A cannot
>>> access it i
>>> > dont even care that inside the app everything is free for everyone.
>>> User A
>>> > is blocked ! I dont have to repeat myself.
>>> >
>>> > 2011/9/20 Cliff 
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> > > >>> web2py ... does not reach yet the Lotus Notes  power of views,
>>> ACLs,
>>> > > formulas,calendar,etc
>>> >
>>> > > Not sure about that.  It takes about as long to put a simple view
>>> > > together in Web2py as in Notes.  It would take a bit longer to do a
>>> > > view with child records the first time around, but after that I
>>> don't
>>> > > see a problem.
>>> >
>>> > > The Web2py security methods put Notes ACL to shame.  True, it's not
>>> > > baked in like Notes ACL but once you get the hang of it, setting up
>>> > > authorizations for your app is pretty easy.
>>> >
>>> > > I'll agree on calendaring with one disclaimer: the Notes calendar
>>> > > worked very well in the Notes client.  Through a browser, not so
>>> > > much.  But my familiarity stopped with Notes v6, so maybe it's
>>> better
>>> > > on the web now.
>>> >
>>> > > I'll also agree that LotusScript is blecherous.
>>> >
>>> > > The debugger, on the other hand, was very nice.
>>> >
>>> > > On Sep 20, 5:00 am, António Ramos  wrote:
>>> > > > YES
>>> >
>>> > > > i´m a lotus notes Developer,
>>> > > > i have moved a lot of code to python and a few simple apps to
>>> web2py.
>>> > > > I think xpages is way more dificult to jquery ui mobile with
>>> web2py.So i
>>> > > > decided to not learn xpages and go with web2py+jqueryui mobile.
>>> > > > Also i like a lot web2py although it does not reach yet the Lotus
>>> Notes
>>> > > > power of views, ACLs, formulas,calendar,etc
>>> > > > In the other side, i hate lotusscript. If Lotus Notes moved from
>>> > > lotusscript
>>> > > > to python 
>>> >
>>> > > > Please see my workflow engine in Lotus Notes.
>>> > > > I´d like to move it to web2py but i´m still a rookie in web2py so
>>> i will
>>> > > > need more time.
>>> >
>>> > > >http://www.youtube.com/watch?v=zMNwqAtiFOw
>>> >
>>> > > > Best regards
>>> > > > António
>>> >
>>> > > > 2011/9/20 David Marko 
>>> >
>>> > > > > Are there any Lotus Notes developers using web2py? I'v been
>>> doing Lotus
>>> > > > > Notes development for more than 15 years and I also did two
>>> projects
>>> > > with
>>> > > > > web2py recently. I really like web2py it makes me very
>>> productive,
>>> > > comparing
>>> > > > > to Java Server Faces based xPages in Lotus Notes, which are
>>> really,
>>> > > really
>>> > > > > slow to develop (to be honest I like java more, but web2py is
>>> > > definitely
>>> > > > > more productive in many areas). In Lotus Notes we have many
>>> smaller or
>>> > > > > bigger applications installed at our customers solving general
>>> problems
>>> > > like
>>> > > > > CRM, document workflow, invoice approval process, projects, task
>>> > > management
>>> > > > > etc. I appreciate the web2py concept of one server running many
>>> > > > > applications, SSO using CAS, its very similar to Lotus Notes
>>> approach,
>>> > > which
>>> > > > > is great.
>>> >
>>> > > > > And now the point ... I'm thinking about creating some code
>>> > > infrastracture
>>> > > > > similar to LN, some general workflow engine and so and I thought
>>> about
>>> > > to
>>> > > > > join forces with others maybe LN developers that have similar
>>> > > requirements
>

[web2py] Tables defined in module not showing up

2014-07-22 Thread Ruud Schroen
Hi guys,

I'm building a Blog module, which I will post here as soon as it's done.
But there's something wrong, I've defined a couple of tables in the module.

def define_tables(self):
category_tablename = self.settings.category_tablename
post_tablename = self.settings.post_tablename
link_tablename = self.settings.link_tablename
comment_tablename = self.settings.comment_tablename

self.blog_category = self.db.define_table(category_tablename,
Field("name", label=self.T("Name of the category")),
Field("slug", compute=lambda r: IS_SLUG()("%s" % 
(r["name"]))[0]),
Field("description", 'text', label=self.T('Describe what 
will be inside this category'))
)

self.blog_post = self.db.define_table(post_tablename,
Field("title", label=self.T("Name the title of this post")),
Field("slug", compute=lambda r: IS_SLUG()("%s" % 
(r["title"]))[0]),
Field('body', 'text', label=self.T('The content of this 
post')),
self.auth.signature
)

self.post_category_link = self.db.define_table(link_tablename,
Field('post_id', 'reference %s' % post_tablename),
Field('category_id', 'reference %s' % category_tablename),
Field('is_active', 'boolean', default=True)
)

self.blog_comment = self.db.define_table(comment_tablename,
Field('post_id', 'reference %s' % post_tablename),
Field('parent_comment', 'reference %s' % comment_tablename),
Field('author', label=self.T('Your name')),
Field('body', 'text', label=self.T('Your comment')),
)

#Creates an admin role if there is none
if self.db(self.db.auth_group.role == 'admin').count() == 0:
self.db.auth_group.insert(role='admin')

#Virtual field which keeps track of the category links of each post
#Allows for an easy way of showing the post's categories in the 
views
self.blog_post.categories = Field.Virtual('categories', lambda row: 
self.category_field(row))

The tables ARE created because when I do "self.db.tables()", this is my 
output:
auth_userauth_groupauth_membershipauth_permissionauth_eventauth_cas
blog_categoryblog_postpost_to_categoryblog_comment

However.. the tables do not show up in appadmin, why?

-- 
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: Tables defined in module not showing up

2014-07-22 Thread Ruud Schroen
Nevermind, it was because I initialized my module in a controller and not a 
model.

On Tuesday, July 22, 2014 11:21:39 AM UTC+2, Ruud Schroen wrote:
>
> Hi guys,
>
> I'm building a Blog module, which I will post here as soon as it's done.
> But there's something wrong, I've defined a couple of tables in the module.
>
> def define_tables(self):
> category_tablename = self.settings.category_tablename
> post_tablename = self.settings.post_tablename
> link_tablename = self.settings.link_tablename
> comment_tablename = self.settings.comment_tablename
>
> self.blog_category = self.db.define_table(category_tablename,
> Field("name", label=self.T("Name of the category")),
> Field("slug", compute=lambda r: IS_SLUG()("%s" % 
> (r["name"]))[0]),
> Field("description", 'text', label=self.T('Describe what 
> will be inside this category'))
> )
>
> self.blog_post = self.db.define_table(post_tablename,
> Field("title", label=self.T("Name the title of this 
> post")),
> Field("slug", compute=lambda r: IS_SLUG()("%s" % 
> (r["title"]))[0]),
> Field('body', 'text', label=self.T('The content of this 
> post')),
> self.auth.signature
> )
>
> self.post_category_link = self.db.define_table(link_tablename,
> Field('post_id', 'reference %s' % post_tablename),
> Field('category_id', 'reference %s' % category_tablename),
> Field('is_active', 'boolean', default=True)
> )
>
> self.blog_comment = self.db.define_table(comment_tablename,
> Field('post_id', 'reference %s' % post_tablename),
> Field('parent_comment', 'reference %s' % 
> comment_tablename),
> Field('author', label=self.T('Your name')),
> Field('body', 'text', label=self.T('Your comment')),
> )
>
> #Creates an admin role if there is none
> if self.db(self.db.auth_group.role == 'admin').count() == 0:
> self.db.auth_group.insert(role='admin')
>
> #Virtual field which keeps track of the category links of each post
> #Allows for an easy way of showing the post's categories in the 
> views
> self.blog_post.categories = Field.Virtual('categories', lambda 
> row: self.category_field(row))
>
> The tables ARE created because when I do "self.db.tables()", this is my 
> output:
> auth_userauth_groupauth_membershipauth_permissionauth_eventauth_cas
> blog_categoryblog_postpost_to_categoryblog_comment
>
> However.. the tables do not show up in appadmin, why?
>

-- 
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] Getting more rows from a table without jQuery, PHP, etc

2014-07-22 Thread Michele Comitini
Remove PHP from the landscape and put web2py there.
You can use any AJAX enabled grid that does what you need.
Write a controller that gets called by the grid and sends JSON encoded rows
back to the grid, when the scroll to the end event is generated on the grid.

For instance you can bind a call to the web2py controller to the onScroll
event

https://github.com/mleibman/SlickGrid/wiki/Grid-Events


2014-07-21 18:23 GMT+02:00 Thiago Duarte :

> Hi there,
>
> I tweaked a couple of codes of a pagination demo, but it doesn't worked
> for me because the page is refreshed, I'm wanting add a button which always
> gets the next 10 rows from a table when clicked, so that contents is loaded
> always below, like an infinite scroll. I've seen a lot of examples on how
> to implement it in a webpage and it seems the easiest way to managed it is
> using PHP, jQuery, JSON, etc, associated with the database.
> I would to know if there is a way to achieve this only using the web2py
> features, or there is no way and I should to use these languages above.
> (I took a quick look in chapters 6 and 7 of the manual, is SQLFORMS.grid
> what I'm looking for?)
>
> 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/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] Can not import copy_reg

2014-07-22 Thread Richard
Hi,

I have an issue with adjusting the auth tables resulting in a custom import 
and an error that copy_reg can not be imported.

The error trace is:

Traceback (most recent call last):
  File "/home4/mamplcom/public_html/cgi-bin/gluon/restricted.py", line 220, in 
restricted
exec ccode in environment
  File "/home4/mamplcom/public_html/cgi-bin/applications/im/models/db.py" 
, line 74, in 
auth.define_tables(username=False, signature=False)
  File "/home4/mamplcom/public_html/cgi-bin/gluon/tools.py", line 1784, in 
define_tables
format='%(first_name)s %(last_name)s (%(id)s)'))
  File "/home4/mamplcom/public_html/cgi-bin/gluon/dal.py", line 8226, in 
define_table
table = self.lazy_define_table(tablename,*fields,**args)
  File "/home4/mamplcom/public_html/cgi-bin/gluon/dal.py", line 8263, in 
lazy_define_table
polymodel=polymodel)
  File "/home4/mamplcom/public_html/cgi-bin/gluon/dal.py", line 1125, in 
create_table
sql_fields_old = pickle.load(tfile)
  File "/home4/mamplcom/public_html/cgi-bin/gluon/custom_import.py", line 92, 
in custom_importer
return base_importer(pname, globals, locals, fromlist, level)
ImportError: No module named copy_reg

I can import copy_reg from the python prompt and adding the import copy reg 
from Dal.py (suggested in a thread by Massimo) has no effect.

I use Python 2.7.8.

Any clu would be helpfull.

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.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Can not import copy_reg

2014-07-22 Thread Massimo Di Pierro
Copy reg is a python module. Can you import it from the normal python shell?

On Tuesday, 22 July 2014 06:05:06 UTC-5, Richard wrote:
>
> Hi,
>
> I have an issue with adjusting the auth tables resulting in a custom 
> import and an error that copy_reg can not be imported.
>
> The error trace is:
>
> Traceback (most recent call last):
>   File "/home4/mamplcom/public_html/cgi-bin/gluon/restricted.py", line 220, 
> in restricted
> exec ccode in environment
>   File "/home4/mamplcom/public_html/cgi-bin/applications/im/models/db.py" 
> , line 74, in 
> 
> auth.define_tables(username=False, signature=False)
>   File "/home4/mamplcom/public_html/cgi-bin/gluon/tools.py", line 1784, in 
> define_tables
> format='%(first_name)s %(last_name)s (%(id)s)'))
>   File "/home4/mamplcom/public_html/cgi-bin/gluon/dal.py", line 8226, in 
> define_table
> table = self.lazy_define_table(tablename,*fields,**args)
>   File "/home4/mamplcom/public_html/cgi-bin/gluon/dal.py", line 8263, in 
> lazy_define_table
> polymodel=polymodel)
>   File "/home4/mamplcom/public_html/cgi-bin/gluon/dal.py", line 1125, in 
> create_table
> sql_fields_old = pickle.load(tfile)
>   File "/home4/mamplcom/public_html/cgi-bin/gluon/custom_import.py", line 92, 
> in custom_importer
> return base_importer(pname, globals, locals, fromlist, level)
> ImportError: No module named copy_reg
>
> I can import copy_reg from the python prompt and adding the import copy reg 
> from Dal.py (suggested in a thread by Massimo) has no effect.
>
> I use Python 2.7.8.
>
> Any clu would be helpfull.
>
> 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.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: SQLFORM grid process not working

2014-07-22 Thread Anthony
Sorry, forgot that you have to extract the form from the grid object. You 
can also get the create and update forms via:

form = grid.element('.web2py_form')

Note, that will be None if there is no form (e.g., when loading just the 
grid), so first test that it exists.

Anthony

On Tuesday, July 22, 2014 2:46:59 AM UTC-4, Massimo Di Pierro wrote:
>
> you say form = SQLFORM.grid() but this is not a form, this is a grid 
> even if you call it form. Therefore there is no form.process(), there is no 
> form.accepted, there is no form.errors etc. This if not a form.
>
> A grid MAY contain a form so you should do:
>
> grid = SQLFORM.grid()
> if grid.create_form:
>  if grid.create_form.errors:
>
> elif grid.update_form:
>  if grid.update_form.errors:
>...
>
> NEVER call process() for these forms. The grid process them automatically 
> and you should never process() twice.
>
> On Tuesday, 22 July 2014 01:35:07 UTC-5, Yebach wrote:
>>
>> Looks like everything I do with form.* after I declare it in my 
>> controller I get an error
>>
>> What am I doing wrong here?
>>
>>
>> 2014-07-22 8:15 GMT+02:00 Vid Ogris :
>>
>>> If I use 
>>> if form.accepted:
>>>
>>> I still get an error 
>>>  'DIV' object has no attribute 
>>> 'accepted'
>>>
>>> I put {{=response.flash}} in my view
>>>
>>>
>>> 2014-07-21 16:05 GMT+02:00 Anthony :
>>>
>>> The message is in response.flash, so you need to display that in your 
 view somewhere (it is already present in the layout.html of the 
 scaffolding 
 app).

 Anthony


 On Monday, July 21, 2014 8:23:16 AM UTC-4, Yebach wrote:
>
> Thank you on fast reply
>
> How do I present this message in my view?
>
>
> 2014-07-21 14:13 GMT+02:00 Anthony :
>
>> Do not call the .process method on a grid -- it automatically does 
>> the processing itself. If you don't like the default flash messages, you 
>> can do:
>>
>> if form.accepted:
>>
>> or:
>>
>> SQLFORM.grid(..., formargs=dict(message_onsuccess='form accepted',
>> message_onfailure='form has errors'))
>>
>>
>> Anthony
>>
>>
>> On Monday, July 21, 2014 6:43:00 AM UTC-4, Yebach wrote:
>>>
>>> Hello
>>>
>>> I have a SQLForm.grid. 
>>>
>>> I want to create a response.flash message but on my if evaluation I 
>>> get an error when my edit view is done
>>>
>>>  'DIV' object has no attribute 
>>> 'process'
>>> even on my sqlform.grid view
>>>
>>> this is my controller function
>>>
>>>  form = SQLFORM.grid(query=query, 
>>> left=db.status.on(db.worker.w_status == db.status.id),
>>>  fields=fields,  searchable=True, orderby=default_sort_order,cre
>>> ate=True,
>>> deletable=True, editable=True, paginate=25, buttons_placement = 
>>> 'right')
>>>   if form.process().accepted:
>>>  response.flash = 'form accepted'
>>>  elif form.errors:
>>>  response.flash = 'form has errors'
>>> else:
>>> response.flash = 'please fill the form'
>>> # Note: no form instance is passed to the view
>>>  return dict(form=form)
>>>
>>>  -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to a topic in 
>> the Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit https://groups.google.com/d/
>> topic/web2py/2ikYrc84qB4/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Lep pozdrav 
>
> Vid Ogris
>
>
>   -- 
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 --- 
 You received this message because you are subscribed to a topic in the 
 Google Groups "web2py-users" group.
 To unsubscribe from this topic, visit 
 https://groups.google.com/d/topic/web2py/2ikYrc84qB4/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to 
 web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

>>>
>>>
>>>
>>> -- 
>>> Lep pozdrav 
>>>
>>> Vid Ogris
>>>
>>>
>>>  
>>
>>
>> -- 
>> Lep pozdrav 
>>
>> Vid Ogris
>>
>>
>>  

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

[web2py] Re: urllib2 and web2py not showing page

2014-07-22 Thread Anthony
{{=XML(idx_page)}}

See http://web2py.com/books/default/chapter/29/05/the-views#XML.

Anthony

On Monday, July 21, 2014 9:58:32 AM UTC-4, David Jobes wrote:
>
> I am trying to call a web page from within a function it works fine, 
> except for the fact that it only shows the raw html page and not a the 
> rendered page i need, have tried all the urllib2 methods and still not 
> luck, here is code, any ideas or sugggestions.
>
> def vrt():
> fup_form = 
> FORM(INPUT(_name='title',_type='text'),INPUT(_name='file',_type='file'))
> idx_page= urllib2.urlopen('http://xxx.xxx.xxx.xxx:9090/').read()
> grid = SQLFORM.smartgrid(db.files,onupdate=auth.archive)
> return dict(idx_page=idx_page,grid=grid)
>
>
> the index page
>
> {{extend 'layout.html'}}
> 
> Import and Convert VRT/ET Rules (Beta Conversion)
> 
> 
> 
> {{=idx_page}}
> 
> 
> {{=grid}}
>

-- 
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: Display registration error for auth.register_bare()

2014-07-22 Thread Mark Li
Hey Massimo! Just for clarification, are you referring to opening a ticket 
for:

1. auth.register() only showing a flash msg on registration error, without 
a page reload

OR

2. auth.register_bare() returning error msg on registration fail, instead 
of just False


In my case I would like functionality for #1, but I just wanted to know to 
which of my suggestions you were referring to.


On Monday, July 21, 2014 11:32:13 PM UTC-7, Massimo Di Pierro wrote:
>
> Please open a ticket. Perhaps this should be the default behavior. Easy to 
> change.
>
> On Monday, 21 July 2014 14:59:34 UTC-5, Mark Li wrote:
>>
>> Maybe I'm not going about this in the right way. I basically want 
>> auth.register() functionality, but without a page reload on registration 
>> fail; just a flash msg of the error.
>>
>> On Monday, July 21, 2014 12:07:05 PM UTC-7, Mark Li wrote:
>>>
>>> Is it possible to return the registration error msg from 
>>> auth.register_bare(), similar to how auth.register() would display the 
>>> error msg after submit? From what I can gather in the source, seems like it 
>>> only returns False on fail, and the user object on success. I would like to 
>>> display more information to the user (password too short, username already 
>>> taken, etc.), if registration fails.
>>>
>>> I am implementing an ajax registration, where I do not want the page to 
>>> reload on submit unless registration is successful. 
>>>
>>

-- 
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: Can not import copy_reg

2014-07-22 Thread Richard
Yes, I can import copy_reg from the Python prompt on the remote server.


On Tuesday, July 22, 2014 1:21:36 PM UTC+2, Massimo Di Pierro wrote:
>
> Copy reg is a python module. Can you import it from the normal python 
> shell?
>
> On Tuesday, 22 July 2014 06:05:06 UTC-5, Richard wrote:
>>
>> Hi,
>>
>> I have an issue with adjusting the auth tables resulting in a custom 
>> import and an error that copy_reg can not be imported.
>>
>> The error trace is:
>>
>> Traceback (most recent call last):
>>   File "/home4/mamplcom/public_html/cgi-bin/gluon/restricted.py", line 220, 
>> in restricted
>> exec ccode in environment
>>   File "/home4/mamplcom/public_html/cgi-bin/applications/im/models/db.py" 
>> , line 74, in 
>> 
>> auth.define_tables(username=False, signature=False)
>>   File "/home4/mamplcom/public_html/cgi-bin/gluon/tools.py", line 1784, in 
>> define_tables
>> format='%(first_name)s %(last_name)s (%(id)s)'))
>>   File "/home4/mamplcom/public_html/cgi-bin/gluon/dal.py", line 8226, in 
>> define_table
>> table = self.lazy_define_table(tablename,*fields,**args)
>>   File "/home4/mamplcom/public_html/cgi-bin/gluon/dal.py", line 8263, in 
>> lazy_define_table
>> polymodel=polymodel)
>>   File "/home4/mamplcom/public_html/cgi-bin/gluon/dal.py", line 1125, in 
>> create_table
>> sql_fields_old = pickle.load(tfile)
>>   File "/home4/mamplcom/public_html/cgi-bin/gluon/custom_import.py", line 
>> 92, in custom_importer
>> return base_importer(pname, globals, locals, fromlist, level)
>> ImportError: No module named copy_reg
>>
>> I can import copy_reg from the python prompt and adding the import copy reg 
>> from Dal.py (suggested in a thread by Massimo) has no effect.
>>
>> I use Python 2.7.8.
>>
>> Any clu would be helpfull.
>>
>> 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.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Opening PDF files in web browser

2014-07-22 Thread José Eloy
Hello!

I've developed an application that allows users to upload document files 
(doc, pdf, xls) and then download them. The problem is when the user wants 
download the files the web browser always opens a window to ask where to 
download them (or the file is downloaded in the download folder). In the 
case of doc and xls files is fine, but would it be possible that the pdf 
files will open directly in the web browser?. To upload/download the files 
I use the standard way of web2py. This problem occurs with Firefox, Safari, 
Chrome, IE 10. The version of web2py I use with the application is the 
1.99.7.

I hope you can understand me, my english is not very good.

Thanks ins advanced.

Regards

José Eloy Torres

-- 
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: Opening PDF files in web browser

2014-07-22 Thread Leonel Câmara
You need to change your download for PDFs controller, this would work if 
you don't use uploadseparate (which I usually do) :

def download_pdf():
  filename=request.args[0]
  path=os.path.join(request.folder,'uploads', filename)
  response.headers['ContentType'] ="application/pdf"
  response.headers['Content-Disposition']="inline; filename.pdf"  
+filename
  return response.stream(open(filename), chunk_size=65536)

-- 
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] nice menu template

2014-07-22 Thread Dmitry Ermolaev
with flyed submenu
http://www.bringbackroi.com/collections/shipped

-- 
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: Opening PDF files in web browser

2014-07-22 Thread Michele Comitini
If you want to avoid the Acrobat plugin entirely and show pdf inline:
https://github.com/mozilla/pdf.js
It's already included in Firefox, but the other browsers can use it too


2014-07-22 21:11 GMT+02:00 Leonel Câmara :

> You need to change your download for PDFs controller, this would work if
> you don't use uploadseparate (which I usually do) :
>
> def download_pdf():
>   filename=request.args[0]
>   path=os.path.join(request.folder,'uploads', filename)
>   response.headers['ContentType'] ="application/pdf"
>   response.headers['Content-Disposition']="inline; filename.pdf"
> +filename
>   return response.stream(open(filename), chunk_size=65536)
>
> --
> 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.
>

-- 
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: SQLFORM doesn't have SELECT element values

2014-07-22 Thread Frank Buibish
I just checked what was being sent via POST, and it's not submitting an 
empty variable corresponding with the select name.  Now could this be 
because the select tag isn't an input tag?  I'm not an html pro yet, so 
small details like this are something i will learn with time.  Any 
suggestions on workarounds?  Should I have a hidden input field that stores 
what is in the select field? or should I use a different form inside of a 
form (not even sure that is possible).

Thanks for any suggestions

Frank

On Monday, July 21, 2014 10:38:38 PM UTC-4, Anthony wrote:
>
> Yes, you're allowed to bump. Use the browser developer tools to see what 
> gets sent to the server when you submit the form. Perhaps the problem is 
> with the JavaScript on the client side.
>
> Anthony
>
> On Monday, July 21, 2014 8:18:30 PM UTC-4, Frank Buibish wrote:
>>
>> Am I allowed to bump in this forum? if not this shall be the last 
>> time...most likely
>>
>> On Thursday, July 17, 2014 10:43:56 PM UTC-4, Frank Buibish wrote:
>>>
>>> 
>>>   Bench
>>> 
>>>
>>> They get added through javascript from the first select element.
>>>
>>> On Thursday, July 17, 2014 10:14:17 PM UTC-4, Anthony wrote:

 The first select has no name, and the second one has no options.

>>>

-- 
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] web2py.com up and down all day

2014-07-22 Thread Jim S
Just posting this to make sure the powers are aware...

I double-checked on the downforeveryoneorjustme.com site and it confirmed 
that it is down.

I've used it throughout the day (for access to the book) but it keeps 
coming and going since this morning.

-- 
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: web2py.com up and down all day

2014-07-22 Thread Jim S
FWIW - here is the pythonanywhere message that is returned:

Something went wrong :-( 

This website is hosted by PythonAnywhere, an online hosting environment. 
Something went wrong while trying to load it; please try again later. 
 
If this is your PythonAnywhere-hosted site, and you just reloaded it, then 
the problem might simply be that it hasn't loaded up yet. Try refreshing 
this page and see if this message disappears. 

If you keep getting this message, you should check your site's server and 
error logs for any messages — you can view them from the Web tab inside 
PythonAnywhere. 

If there's nothing in the logs, and you're sure your site is OK, then it 
might be a problem on our side. Drop us a line at 
supp...@pythonanywhere.com, in the forums, or using the "Send feedback" 
link on the site, quoting the error code below. 
 
Error code: 502-loadbalancer


 

On Tuesday, July 22, 2014 4:07:26 PM UTC-5, Jim S wrote:
>
> Just posting this to make sure the powers are aware...
>
> I double-checked on the downforeveryoneorjustme.com site and it confirmed 
> that it is down.
>
> I've used it throughout the day (for access to the book) but it keeps 
> coming and going since this morning.
>

-- 
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: SQLFORM doesn't have SELECT element values

2014-07-22 Thread Cliff Kachinske
The Chrome developer tools should show the dragged-to select being 
populated as you drag things across.

If things aren't moving look in the "console" tab for errors. 

Also you can insert alert statements into the javascript to see if the 
events are firing. 

On Tuesday, July 22, 2014 5:01:55 PM UTC-4, Frank Buibish wrote:
>
> I just checked what was being sent via POST, and it's not submitting an 
> empty variable corresponding with the select name.  Now could this be 
> because the select tag isn't an input tag?  I'm not an html pro yet, so 
> small details like this are something i will learn with time.  Any 
> suggestions on workarounds?  Should I have a hidden input field that stores 
> what is in the select field? or should I use a different form inside of a 
> form (not even sure that is possible).
>
> Thanks for any suggestions
>
> Frank
>
> On Monday, July 21, 2014 10:38:38 PM UTC-4, Anthony wrote:
>>
>> Yes, you're allowed to bump. Use the browser developer tools to see what 
>> gets sent to the server when you submit the form. Perhaps the problem is 
>> with the JavaScript on the client side.
>>
>> Anthony
>>
>> On Monday, July 21, 2014 8:18:30 PM UTC-4, Frank Buibish wrote:
>>>
>>> Am I allowed to bump in this forum? if not this shall be the last 
>>> time...most likely
>>>
>>> On Thursday, July 17, 2014 10:43:56 PM UTC-4, Frank Buibish wrote:

 
   Bench
 

 They get added through javascript from the first select element.

 On Thursday, July 17, 2014 10:14:17 PM UTC-4, Anthony wrote:
>
> The first select has no name, and the second one has no options.
>


-- 
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: rname and reserved names

2014-07-22 Thread Simon Ashley
The missing piece was check_reserved=None. 

-- 
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] on_define example to improve the book: please help.

2014-07-22 Thread Tim Richardson
I'm trying to improve ch 6 in the book, DAL. 
The on_define parameter to define_table is not documented. 

This is my current text, but the example concerns me because it seems 
redundant to me. That is, until I found the example, I thought that adding 
such simple requires settings via Field definitions would still leave the 
table lazily defined.  

on_define

on_define is a callback triggered when a lazy_table is instantiated, 
although it is called anyway if the table is not lazy. This allows dynamic 
changes to the table without losing the advantages of delayed instantiation.

Example:

 db = DAL(lazy_tables=True) 
 db.define_table('person',Field('name'),Field('age','integer'), 
on_define=lambda table: [ 
table.name.set_attributes(requires=IS_NOT_EMPTY(),default=''), 

table.age.set_attributes(requires=IS_INT_IN_RANGE(0,120),default=30), 




-- 
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: Web2py Rocket server is too slow

2014-07-22 Thread Tim Richardson
Look in the book, in the deployment recipes chapter, for further guidance 
about the scripts Massimo mentions. 

On Monday, July 21, 2014 9:29:24 PM UTC+10, jaipraka...@gmail.com wrote:
>
> web2py rocket server is too slow for my application.
> Can somebody share step by step instruction to install Apache or nginx web 
> server?
>  
> I want to install nginx server on Ubuntu.
>  
> Kindly help.
>  
> Regards,
> Jaiprakash
>

-- 
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: on_define example to improve the book: please help.

2014-07-22 Thread Anthony
I think you're right -- those attributes shouldn't trigger the lazy 
definition. on_define would be more useful in case something expensive is 
happening in defining one of the attributes. Also, if you define an 
IS_IN_DB or IS_NOT_IN_DB that has a Set object as the first argument (as 
the query will involve doing something like db.sometable.somefield == 
some_value, which would cause sometable to be defined).

Anthony

On Tuesday, July 22, 2014 10:01:33 PM UTC-4, Tim Richardson wrote:
>
> I'm trying to improve ch 6 in the book, DAL. 
> The on_define parameter to define_table is not documented. 
>
> This is my current text, but the example concerns me because it seems 
> redundant to me. That is, until I found the example, I thought that adding 
> such simple requires settings via Field definitions would still leave the 
> table lazily defined.  
>
> on_define
>
> on_define is a callback triggered when a lazy_table is instantiated, 
> although it is called anyway if the table is not lazy. This allows 
> dynamic changes to the table without losing the advantages of delayed 
> instantiation.
>
> Example:
>
>  db = DAL(lazy_tables=True) 
>  db.define_table('person',Field('name'),Field('age','integer'), 
> on_define=lambda table: [ 
> table.name.set_attributes(requires=IS_NOT_EMPTY(),default=''), 
> 
> table.age.set_attributes(requires=IS_INT_IN_RANGE(0,120),default=30), 
>
>
>
>
>

-- 
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: on_define example to improve the book: please help.

2014-07-22 Thread Tim Richardson
On Wed, Jul 23, 2014 at 1:20 PM, Anthony  wrote:

> I think you're right -- those attributes shouldn't trigger the lazy
> definition. on_define would be more useful in case something expensive is
> happening in defining one of the attributes. Also, if you define an
> IS_IN_DB or IS_NOT_IN_DB that has a Set object as the first argument (as
> the query will involve doing something like db.sometable.somefield ==
> some_value, which would cause sometable to be defined).


thanks, I will amend my PR..


-- 



*Tim Richardson, Director*
GrowthPath, Data-driven profit growth

Mobile: +61 423 091 732
Office: +61 3 8678 1850
I tweet useful business & IT tips at growthpath_au

GrowthPath Pty Ltd
ABN 76 133 733 963






-- 
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: on_define example to improve the book: please help.

2014-07-22 Thread 黄祥

>
>  db = DAL(lazy_tables=True) 
>
>
not sure, if lazy_tables = True is mandatory or not, another example for 
on_define :
e.g.
def on_define_bank(table): 
# default
table.name.default = ''
table.age.default = 30
# label
table.name.label = T('Name')
table.age.label = T('Age')
# notnull
table.name.notnull = True
table.age.notnull = True
# required
table.name.required = True
table.age.required = True
# requires
table.name.requires = IS_NOT_EMPTY()
table.age.requires = IS_INT_IN_RANGE(0, 120)

db.define_table('person', 
Field('name'), 
Field('age', 'integer'), 
on_define = on_define_bank)

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


Re: [web2py] Re: on_define example to improve the book: please help.

2014-07-22 Thread Tim Richardson
I believe that on_define is always done at table instantiation, so for non
lazy tables it's done when the request is executed as part of setting up
the table. so lazy_tables is not mandatory.


On Wed, Jul 23, 2014 at 2:37 PM, 黄祥  wrote:

>  db = DAL(lazy_tables=True)
>>
>>
> not sure, if lazy_tables = True is mandatory or not, another example for
> on_define :
> e.g.
> def on_define_bank(table):
> # default
> table.name.default = ''
> table.age.default = 30
> # label
> table.name.label = T('Name')
> table.age.label = T('Age')
> # notnull
> table.name.notnull = True
> table.age.notnull = True
> # required
> table.name.required = True
> table.age.required = True
> # requires
> table.name.requires = IS_NOT_EMPTY()
> table.age.requires = IS_INT_IN_RANGE(0, 120)
>
> db.define_table('person',
> Field('name'),
> Field('age', 'integer'),
> on_define = on_define_bank)
>
> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/t5XrUYK3WDg/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 



*Tim Richardson, Director*
GrowthPath, Data-driven profit growth

Mobile: +61 423 091 732
Office: +61 3 8678 1850
I tweet useful business & IT tips at growthpath_au

GrowthPath Pty Ltd
ABN 76 133 733 963






-- 
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: Bootstrap is really killing web2py

2014-07-22 Thread Gael Princivalle
Hello Moustafa.

I agree with you and hope that we'll have soon a fully Bootstrap 3 web2py 
version.

Il giorno venerdì 18 luglio 2014 21:17:34 UTC+2, Moustafa Mahmoud ha 
scritto:
>
> I have been using web2py for 3 years know, and I was really impressed by 
> it, I defended it in every discussion, even implemented all my projects 
> using it and even convinced my Graduation Project Team to use it in our GP. 
> However, as my skill increased and I began looking more into customizing my 
> applications, I have hit a brick wall discovering how tightly bound web2py 
> is to bootstrap2, I wanted to use bootstrap 3 but was faced with tons of 
> problems. If I want to move to another front end framework then I 
> discovered that it would be easier to use another framework because of the 
> time and effort I would need to invest in modifying all parts of web2py 
> that are tightly bound  to bootstrap.
> This will result in making web2py a headache to me rather than my best 
> friend. I am writing this message because I am really sad that an amazing 
> framework like web2py is forcing me to consider an alternative because I do 
> really feel it is constraining me at this point.
> Any help or ideas about that ?
>

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