Re: [web2py] Re: web2py 2.1.1 is OUT!

2012-10-25 Thread Vasile Ermicioi
> This is the best version! its stable and fast.


yes, but is backward incompatible with a few of my apps, routes_app_raw is
 broken :(

-- 





Re: [web2py] SQLFORM.grid created from request.vars - search, pagination etc breaks

2012-10-25 Thread Niphlod
a) you can have the search form to do a get instead of a post. In that way 
when the user presses the button "submit" he is redirected to your page, 
and that page can load the grid with the parameters specified into 
request.vars
b) with this you are sure that the parameters are reset if the user stops 
navigating your grid

-- 





[web2py] Re: browser request

2012-10-25 Thread Niphlod
What are you expecting from a "raw request" ? Doesn't request.env suffice ?

On Wednesday, October 24, 2012 11:33:52 PM UTC+2, patrick moon wrote:
>
> is it possible to get a raw "request" from a browser in web2py?  right now 
> it looks like some of the request information is converted to 
> gluon.storage.Storage.  I'm doing a parallel compare with django and am 
> trying to keep the code base comparison as close as possible.  Thanks 
>

-- 





[web2py] how to hide the [wiki] menu option in auth.wiki

2012-10-25 Thread Andrew W
the [wiki] menu option is good for the person maintaining the website, but 
shouldn't be seen by others (at least those not logged in) .
How do I hide it for unauthorised users ?

Any update on when the book will contain auth.wiki information ?  I can see 
plugin_wiki still there.

Thanks

Andrew W

-- 





[web2py] Re: routes.py not working in 2.0.9

2012-10-25 Thread LightOfMooN
Hello.

I have

routes_in = (
('/admin/$anything', '/admin/$anything'),
('(?P.*)/appadmin/(?P.*)', 
'\g/appadmin/\g'),
('.*://.*mydomain.com:.* /$anything', '/welcome/$anything'),
)
routes_out = (
('(?P.*)/admin/(?P.*)', 
'\g/admin/\g'),
('(?P.*)/appadmin/(?P.*)', 
'\g/appadmin/\g'),
('/$app/$anything', '/$anything'),
)

It works fine with 1.99.7. But with 2.2.1 it always rises "Invalid request"

If i add:
default_application = "welcome"
default_controller = "default"
default_function = "index"
And replace "('.*://.*mydomain.com:.* /$anything', '/welcome/$anything')" 
with "('.*://.*mydomain.com:.* /$anything', 
'/my_not_welcome_app/$anything')"
I'll see welcome app if i go to mydomain.com
But without some static files (no js,css,images will be loaded)


суббота, 13 октября 2012 г., 6:50:31 UTC+5 пользователь Massimo Di Pierro 
написал:
>
> Strange. We have unitests for them and they all pass. Can I see your 
> routes.py?
>
> On Friday, 12 October 2012 17:54:08 UTC-5, Vasile Ermicioi wrote:
>>
>> hi,
>> I put my apps and routes.py in a new folder web2py  2.0.9 and all my 
>> websites are pointed to init app
>> and I downgraded back to 1.99.4
>>
>

-- 





Re: [web2py] Re: Image Tutorial and linked_tables

2012-10-25 Thread Leonel Câmara
Can you tell me if this fixes it?

@auth.requires_membership('manager')
def manage():
db.comment
grid = SQLFORM.smartgrid(db.image)
return locals()

Quarta-feira, 24 de Outubro de 2012 20:25:33 UTC+1, David Simmons escreveu:
>
> Hi Jim
>
> my model is:
>
> db.define_table('image',
>Field('title', unique=True),
>Field('file', 'upload'),
>format = '%(title)s')
> 
> db.define_table('comment',
>Field('image_id', 'reference image'),
>Field('author'),
>Field('email'),
>Field('body', 'text'))
>
>
> I'm really hoping I'm doing something plain daft here.
>
> cheers
>
> Dave
>

-- 





[web2py] Re: routes.py not working in 2.0.9

2012-10-25 Thread LightOfMooN
I wrote routes.py from the book:

routes_in = (
  ('/testme', '/examples/default/index'),
)routes_out = (
  ('/examples/default/index', '/testme'),
)


And go to mydomain.com/testme

and get Request Error. But if i check href attribute from "examples" app 
link in admin, it's 'mydomain.com/testme'

So, routes_out works fine in that example, but not routes_in.


суббота, 13 октября 2012 г., 6:50:31 UTC+5 пользователь Massimo Di Pierro 
написал:
>
> Strange. We have unitests for them and they all pass. Can I see your 
> routes.py?
>
> On Friday, 12 October 2012 17:54:08 UTC-5, Vasile Ermicioi wrote:
>>
>> hi,
>> I put my apps and routes.py in a new folder web2py  2.0.9 and all my 
>> websites are pointed to init app
>> and I downgraded back to 1.99.4
>>
>

-- 





Re: [web2py] Re: routes.py not working in 2.0.9

2012-10-25 Thread Vasile Ermicioi
since I started with web2py routes were the most uneasy and unstable part
of web2py,
and how awesome is web2py in all other parts - dal, template, sql forms,
authentication, building services(json,xml)
but with routes always had problems - no unicode support, very hard to
'rewrite' urls, not quite easy to match subdomains,
I found flask routes so much easier to use :( but they are not fitting
web2py design

-- 





[web2py] Re: Formatter and values=None problem

2012-10-25 Thread Paolo Caruccio
Did you try:

db.tablename.fieldname.represent= lambda value: value if value else 'NT"

?
web2py book reference 
http://web2py.com/books/default/chapter/29/06?search=represent#Record-representation


Il giorno giovedì 25 ottobre 2012 03:20:29 UTC+2, Joe Barnhart ha scritto:
>
> I have an application where I expect "None" items in my database and I 
> want to format them to "NT".  It is an app that uses time standards, and if 
> there is no standard present I expect a "None" in the database which 
> translates to a field of "No Time" or "NT".
>
> The problem is that the current implementation of formatter in the Field 
> class tests the value for "None" and escapes before the formatter is called.
>
> I can see why this behavior might be expected in a lot of cases, but it 
> seems extreme to deny the ability to format "None" into a more pleasing 
> form for those applications that could benefit from it.  Here is the 
> offending part of formatter (located in gluon/dal.py):
>
> def formatter(self, value):
> requires = self.requires
> if value is None or not requires:
> return value
>
> If I change the above to:
>
> def formatter(self, value):
> requires = self.requires
> if not requires:
> return value
>
> I get my desired behavior, which is to pass "None" to my formatter which 
> is implemented as part of a custom Validator object.  I realize the code 
> now has to go "further" for cases where the value is None, but is it really 
> safe to assume nobody will ever want to "format" None into another string?  
> Not in my case, at least!
>
> Joe B.
>
>
>

-- 





[web2py] Re: about editing database

2012-10-25 Thread alazar baharu
hello dear bro thanks for replaying to me just in short what i want to do 
is there is a model
db.define_table(
'Office',
Field('Office_level'),
Field('Office_building'),
Field('Office_number'),
Field('Maximum_load'),
Field('Free_space'),
Field('Office_discription', 'text'),
Field('status','boolean',readable=False, writable= False, default=True),
format = '%(name)s')

db.define_table(
'Request',
Field('Requester',db.auth_user, default=auth.user_id),
Field('Requested_office','reference Office'),
Field('Request_information', 'text'),
format = '%(name)s')
db.Request.Requested_office.requires = IS_IN_DB(db,db.Office.Office_number, 
'%(Office_number)s')
db.Request.Requester.readable = db.Request.Requester.writable = False
db.Request.Requester.requires = IS_NOT_EMPTY()
db.Request.Request_information.requires = IS_NOT_EMPTY()
db.define_table(
'Response',
Field('Respondant', default='ADMINISTRATOR', writable=False),
Field('Office_Assigned_To', db.auth_user, readable=False),
Field('Assigned_Office_Number', 'reference Office'),
Field('Response_information', 'text'),
format = '%(name)s')
db.Response.Assigned_Office_Number.requires = 
IS_IN_DB(db,db.Office.Office_number, '%(Office_number)s')
db.Response.Office_Assigned_To.requires = 
IS_IN_DB(db,db.auth_user.id,'%(username)s')
db.Response.Respondant.requires = IS_NOT_EMPTY()
db.Response.Response_information.requires = IS_NOT_EMPTY()
db.Office.Office_level.requires = IS_NOT_EMPTY()
db.Office.Office_building.requires = IS_NOT_EMPTY()
db.Office.Office_number.requires = IS_NOT_EMPTY()
db.Office.Maximum_load.requires = IS_NOT_EMPTY()
db.Office.Free_space.requires = IS_NOT_EMPTY()
db.Office.Office_discription.requires = IS_NOT_EMPTY()
db.define_table('message',
Field('fromid', db.auth_user, default=auth.user_id, readable=False, 
writable=False),
Field('toid', db.auth_user, readable=False),
Field('timesent', 'datetime', default=request.now, readable=False, 
writable=False),
Field('subject','string', length=255),
Field('messages', 'text'),
Field('opened', 'boolean', writable=False, readable=False, 
default=False),
Field('timeopened', 'datetime', readable=False, writable=False)
)
db.message.toid.requires=IS_IN_DB(db, db.auth_user.id,'%(username)s')
 i have inserted data in the database using SQlFORM
first i will register office information in the office table (lets register 
office  with office id 1, office number 123, capacity 12, free space 12 
initially )then users will request to the office using the office id as 
reference by office number field (let request office id 1 referencing 
office number 123 ) and send the request and what i want is that in the 
response to the request controller when office manager give response to the 
request the( office id 1, office number 123 will be given to the user ) 
after this the office table information for office id 1, office number 123, 
capacity 12 and free space has to be just like this office id 1, office 
number 123, capacity 12, free space 11(because we have given one free space 
for one user) this is what i want to do. 10q for your help.
and this is my controller 
# -*- coding: utf-8 -*-
# this file is released under public domain and you can use without 
limitations

#
## This is a samples controller
## - index is the default action of any application
## - user is required for authentication and authorization
## - download is for downloading files uploaded in the db (does streaming)
## - call exposes all registered services (none by default)
#
response.menu = [['Register office', False, URL('create')],
 ['Request office', False, URL('create_Request')],
 ['Respond to Request', False, URL('create_Response')],
 ['Office information', False, URL('Officeinfo')],
 ['Search for office', False, URL('search_office')],
 ['office gread', False, URL('office_gread')],
 ['respondrequest', False, URL('respondrequest')],
 ['Compose', False, URL('compose')],
 ['Inbox', False, URL('inbox')]]
@auth.requires_login()
def index():
"""
example action using the internationalization operator T and flash
rendered by views/default/index.html or views/generic.html
"""
response.flash = "Welcome to web2py!"
return dict(message=T('Hello World'))

def user():
"""
exposes:
http:///[app]/default/user/login
http:///[app]/default/user/logout
http:///[app]/default/user/register
http:///[app]/default/user/profile
http:///[app]/default/user/retrieve_password
http:///[app]/default/user/change_password
use @auth.requires_login()
@auth.requires_membership('group name')
@auth.requires_permissi

[web2py] Re: Formatter and values=None problem

2012-10-25 Thread Paolo Caruccio
or better

def format_function (value)
 formatted_value = .
 return formatted_value

db.tablename.fieldname.represent= lambda value,row: format_function(value) 
if value else "Not Standard Time"




Il giorno giovedì 25 ottobre 2012 13:31:43 UTC+2, Paolo Caruccio ha scritto:
>
> Did you try:
>
> db.tablename.fieldname.represent= lambda value: value if value else 'NT"
>
> ?
> web2py book reference 
> http://web2py.com/books/default/chapter/29/06?search=represent#Record-representation
>
>
> Il giorno giovedì 25 ottobre 2012 03:20:29 UTC+2, Joe Barnhart ha scritto:
>>
>> I have an application where I expect "None" items in my database and I 
>> want to format them to "NT".  It is an app that uses time standards, and if 
>> there is no standard present I expect a "None" in the database which 
>> translates to a field of "No Time" or "NT".
>>
>> The problem is that the current implementation of formatter in the Field 
>> class tests the value for "None" and escapes before the formatter is called.
>>
>> I can see why this behavior might be expected in a lot of cases, but it 
>> seems extreme to deny the ability to format "None" into a more pleasing 
>> form for those applications that could benefit from it.  Here is the 
>> offending part of formatter (located in gluon/dal.py):
>>
>> def formatter(self, value):
>> requires = self.requires
>> if value is None or not requires:
>> return value
>>
>> If I change the above to:
>>
>> def formatter(self, value):
>> requires = self.requires
>> if not requires:
>> return value
>>
>> I get my desired behavior, which is to pass "None" to my formatter which 
>> is implemented as part of a custom Validator object.  I realize the code 
>> now has to go "further" for cases where the value is None, but is it really 
>> safe to assume nobody will ever want to "format" None into another string?  
>> Not in my case, at least!
>>
>> Joe B.
>>
>>
>>

-- 





[web2py] Re: sessions2trash.py not working in v2.2.1, fix included

2012-10-25 Thread Massimo Di Pierro
Thanks, in trunk!

On Wednesday, 24 October 2012 18:22:02 UTC-5, Jim Karsten wrote:
>
> current.response._dbtable_and_field is referenced in sessions2trash.py. 
> That value was replaced in version 2.2.1 with 
> current.response.session_db_table, current.response.session_db_record_id, 
> and current.response.session_db_unique_key. 
>
> Attached is a fixed version of sessions2trash.py. 

-- 





Re: [web2py] Re: web2py 2.1.1 is OUT!

2012-10-25 Thread Massimo Di Pierro
Yes, but it is broken because of a bug, not intentionally and we are about 
to fix it. If you have not done so already, open a ticket about it.

On Thursday, 25 October 2012 02:35:57 UTC-5, Vasile Ermicioi wrote:
>
>
> This is the best version! its stable and fast. 
>
>
> yes, but is backward incompatible with a few of my apps, routes_app_raw is 
>  broken :(
>  

-- 





[web2py] Re: how to hide the [wiki] menu option in auth.wiki

2012-10-25 Thread Massimo Di Pierro
I agree. Changed the behavior in trunk.

On Thursday, 25 October 2012 03:44:08 UTC-5, Andrew W wrote:
>
> the [wiki] menu option is good for the person maintaining the website, but 
> shouldn't be seen by others (at least those not logged in) .
> How do I hide it for unauthorised users ?
>
> Any update on when the book will contain auth.wiki information ?  I can 
> see plugin_wiki still there.
>
> Thanks
>
> Andrew W
>

-- 





Re: [web2py] Re: routes.py not working in 2.0.9

2012-10-25 Thread Massimo Di Pierro
We'll change them in web3py. Suggestions?

On Thursday, 25 October 2012 06:10:44 UTC-5, Vasile Ermicioi wrote:
>
> since I started with web2py routes were the most uneasy and unstable part 
> of web2py,
> and how awesome is web2py in all other parts - dal, template, sql forms, 
> authentication, building services(json,xml)
> but with routes always had problems - no unicode support, very hard to 
> 'rewrite' urls, not quite easy to match subdomains, 
> I found flask routes so much easier to use :( but they are not fitting 
> web2py design
>
>

-- 





[web2py] Re: how to hide the [wiki] menu option in auth.wiki

2012-10-25 Thread apps in tables


why is auth.wiki different from everything else in web2py?


-- 





[web2py] an editor ...

2012-10-25 Thread apps in tables
Hi,

Pls, don't laugh...

Does any one know of an editor that collapse and expand the functions 
within the controller?

Regards,

Ashraf

-- 





[web2py] Re: an editor ...

2012-10-25 Thread Niphlod
komodo, geany, notepad++, eclipse, netbeans...

On Thursday, October 25, 2012 3:49:57 PM UTC+2, apps in tables wrote:
>
> Hi,
>
> Pls, don't laugh...
>
> Does any one know of an editor that collapse and expand the functions 
> within the controller?
>
> Regards,
>
> Ashraf
>

-- 





[web2py] Re: an editor ...

2012-10-25 Thread David Marko
Eclipse + Pydev

Dne čtvrtek, 25. října 2012 15:49:57 UTC+2 apps in tables napsal(a):
>
> Hi,
>
> Pls, don't laugh...
>
> Does any one know of an editor that collapse and expand the functions 
> within the controller?
>
> Regards,
>
> Ashraf
>

-- 





[web2py] Re: grid export button

2012-10-25 Thread Omi Chiba
I posted on this on my 
blog
 and 
someone pointed that it will get ticket when clicking View button. Do you 
know how to fix?

Problem looks like here.
export_menu_links = original_export_menu.elements('a')

1.
2.
3.
4.
5.
6.

Traceback (most recent call last):
  File "C:\web2py\gluon\restricted.py", line 209, in restricted
exec ccode in environment
  File "C:\web2py\applications\grid\views\default/index.html", line 82, in 

AttributeError: 'NoneType' object has no attribute 'elements'



73.
74.
75.
76.
77.
78.
79.
80.
81.
82.

83.
84.
85.
86.
87.
88.
89.
90.
91.
92.

pass
response.write('\n\n\n', escape=False)
response.write('\n', escape=False)
response.write('\r\n', escape=False)
w2p_grid_tbl = grid.element('table')
if w2p_grid_tbl:
original_export_menu = grid.element('div.w2p_export_menu')
export_menu_links = original_export_menu.elements('a')

export_menu_items = []
for link in export_menu_links:
item = LI(link)
export_menu_items.append(item)
pass
new_export_menu = DIV(
A( T('Exports'),
SPAN(_class='caret'),
_href='#',
_class='btn dropdown-toggle',






On Tuesday, October 23, 2012 8:38:54 AM UTC-5, Omi Chiba wrote:
>
> It works! Thank you for sharing your code.
>
>
>
> On Monday, October 22, 2012 5:00:19 PM UTC-5, Paolo Caruccio wrote:
>>
>> My fault. I extrapoled the code from more complex one.
>>
>> Try this:
>>
>> {{extend 'layout.html'}}
>> {{
>> w2p_grid_tbl = grid.element('table')
>> if w2p_grid_tbl:
>>  original_export_menu = grid.element('div.w2p_export_menu')
>>  export_menu_links = original_export_menu.elements('a')
>>  export_menu_items = []
>>  for link in export_menu_links:
>>  item = LI(link)
>>  export_menu_items.append(item)
>>  pass
>>  new_export_menu = DIV(
>>   A( T('Exports'),
>>  SPAN(_class='caret'),
>>  _href='#',
>>  _class='btn dropdown-toggle',
>>  **{'_data-toggle':"dropdown"}
>> ),
>>   UL(*export_menu_items,
>>  _class='dropdown-menu'
>> ),
>> _class='w2p_export_menu btn-group'
>> )
>>  export_menu = grid.element('div.w2p_export_menu',replace=new_export_menu
>> )
>> pass
>> }}
>>
>> {{=grid}}
>>
>> Of course you could modify the DOM directly in the controller.
>>
>>
>>
>> Il giorno lunedì 22 ottobre 2012 22:56:48 UTC+2, Omi Chiba ha scritto:
>>>
>>> Wow! This is exactly what I wanted. I hope this will be the default 
>>> layout for grid.
>>>
>>> I copy and pasted your code between {{extend 'layout.html'}} and 
>>> {{=gird}}, then export labels are now disappeard...
>>> Maybe you should check your code with the latest (2.1.1). 
>>>
>>> {{left_sidebar_enabled,right_sidebar_enabled=False,('message' in 
>>> globals())}}
>>> {{extend 'layout.html'}}
>>> {{
>>> w2p_grid_tbl = grid.element('table')
>>> if w2p_grid_tbl:
>>>  export_menu = grid.element('div.w2p_export_menu')
>>>  export_menu_links = export_menu.elements('a')
>>>  export_menu_items = []
>>>  for link in export_menu_links:
>>>  item = LI(link)
>>>  export_menu_items.append(item)
>>>  pass
>>>  export_menu = grid.element('div.w2p_export_menu',replace=None)
>>>  new_export_menu = DIV(
>>>   A( T('Exports'),
>>>  SPAN(_class='caret'),
>>>  _href='#',
>>>  _class='btn dropdown-toggle',
>>>  **{'_data-toggle':"dropdown"}
>>> ),
>>>   UL(*export_menu_items,
>>>  _class='dropdown-menu'
>>> ),
>>> _class='w2p_export_menu btn-group'
>>> )
>>> pass
>>> }}
>>>
>>> {{=grid}}
>>>
>>>
>>>
>>>
>>> On Monday, October 22, 2012 2:10:53 PM UTC-5, Paolo Caruccio wrote:

 For grid export menu I'm happy with below method

 In the views/*.html file where is your grid put on top (just below 
 extend layout command)  the following code:

 {{
 w2p_grid_tbl = grid.element('table')
 if w2p_grid_tbl:
  export_menu = grid.element('div.w2p_export_menu')
  export_menu_links = export_menu.elements('a')
  export_menu_items = []
  for link in export_menu_links:
  item = LI(link)
  export_menu_items.append(item)
  pass
  export_menu = grid.element('div.w2p_export_menu',replace=None)
  new_export_menu = DIV(
   A( T('Exports'),
  SPAN(_class='caret'),
  _href='#',
  _class='btn dropdown-toggle',
  **{'_data-toggle':"

[web2py] Re: an editor ...

2012-10-25 Thread apps in tables
it is in front of me all the time ...

my mind needs fixing.

-- 





[web2py] BUG: appadmin cannot save to db

2012-10-25 Thread lyn2py
I'm on Version 2.2.1 (2012-10-22 18:50:13) stable

This is specific to *database admin *in *appadmin.*
I needed to change some data, but appadmin will not save the items, 
although on response.flash / session.flash it says "done!"


-- 





[web2py] Re: an editor ...

2012-10-25 Thread lyn2py
+1 to* SublimeText 2*

On Thursday, October 25, 2012 10:44:34 PM UTC+8, apps in tables wrote:
>
> it is in front of me all the time ...
>
> my mind needs fixing.

-- 





Re: [web2py] BUG: appadmin cannot save to db

2012-10-25 Thread Richard Vézina
Did you use appdamin with a new app or you use the appadmin of your own app?

If you use your own app appadmin did you think to replace it with the
appadmin of the welcome?

Richard

On Thu, Oct 25, 2012 at 11:01 AM, lyn2py  wrote:

> I'm on Version 2.2.1 (2012-10-22 18:50:13) stable
>
> This is specific to *database admin *in *appadmin.*
> I needed to change some data, but appadmin will not save the items,
> although on response.flash / session.flash it says "done!"
>
>
>  --
>
>
>
>

-- 





[web2py] Re: grid export button

2012-10-25 Thread Paolo Caruccio
This happens because the url has arguments.

please try with:

{{extend 'layout.html'}}
{{
if not request.args:
 w2p_grid_tbl = grid.element('table')
 if w2p_grid_tbl:
 original_export_menu = grid.element('div.w2p_export_menu')
 export_menu_links = original_export_menu.elements('a')
 export_menu_items = []
 for link in export_menu_links:
 item = LI(link)
 export_menu_items.append(item)
 pass
 new_export_menu = DIV(
  A( T('Exports'),
 SPAN(_class='caret'),
 _href='#',
 _class='btn dropdown-toggle',
 **{'_data-toggle':"dropdown"}
),
  UL(*export_menu_items,
 _class='dropdown-menu'
),
_class='w2p_export_menu btn-group'
)
 export_menu = grid.element('div.w2p_export_menu',replace=new_export_menu)
 pass
pass
}}


{{=grid}}

Of course if the page with the grid has arguments in url you have to change 
the first condition and check the acceptable cases.
 
 

Il giorno giovedì 25 ottobre 2012 16:20:45 UTC+2, Omi Chiba ha scritto:
>
> I posted on this on my 
> blog
>  and 
> someone pointed that it will get ticket when clicking View button. Do you 
> know how to fix?
>
> Problem looks like here.
> export_menu_links = original_export_menu.elements('a')
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
>
> Traceback (most recent call last):
>   File "C:\web2py\gluon\restricted.py", line 209, in restricted
> exec ccode in environment
>   File "C:\web2py\applications\grid\views\default/index.html", line 82, in 
> 
> AttributeError: 'NoneType' object has no attribute 'elements'
>
>
>
> 73.
> 74.
> 75.
> 76.
> 77.
> 78.
> 79.
> 80.
> 81.
> 82.
>
> 83.
> 84.
> 85.
> 86.
> 87.
> 88.
> 89.
> 90.
> 91.
> 92.
>
> pass
> response.write('\n\n\n', escape=False)
> response.write('\n', escape=False)
> response.write('\r\n', escape=False)
> w2p_grid_tbl = grid.element('table')
> if w2p_grid_tbl:
> original_export_menu = grid.element('div.w2p_export_menu')
> export_menu_links = original_export_menu.elements('a')
>
> export_menu_items = []
> for link in export_menu_links:
> item = LI(link)
> export_menu_items.append(item)
> pass
> new_export_menu = DIV(
> A( T('Exports'),
> SPAN(_class='caret'),
> _href='#',
> _class='btn dropdown-toggle',
>
>
>
>
>
>
> On Tuesday, October 23, 2012 8:38:54 AM UTC-5, Omi Chiba wrote:
>>
>> It works! Thank you for sharing your code.
>>
>>
>>
>> On Monday, October 22, 2012 5:00:19 PM UTC-5, Paolo Caruccio wrote:
>>>
>>> My fault. I extrapoled the code from more complex one.
>>>
>>> Try this:
>>>
>>> {{extend 'layout.html'}}
>>> {{
>>> w2p_grid_tbl = grid.element('table')
>>> if w2p_grid_tbl:
>>>  original_export_menu = grid.element('div.w2p_export_menu')
>>>  export_menu_links = original_export_menu.elements('a')
>>>  export_menu_items = []
>>>  for link in export_menu_links:
>>>  item = LI(link)
>>>  export_menu_items.append(item)
>>>  pass
>>>  new_export_menu = DIV(
>>>   A( T('Exports'),
>>>  SPAN(_class='caret'),
>>>  _href='#',
>>>  _class='btn dropdown-toggle',
>>>  **{'_data-toggle':"dropdown"}
>>> ),
>>>   UL(*export_menu_items,
>>>  _class='dropdown-menu'
>>> ),
>>> _class='w2p_export_menu btn-group'
>>> )
>>>  export_menu = grid.element('div.w2p_export_menu',replace=
>>> new_export_menu)
>>> pass
>>> }}
>>>
>>> {{=grid}}
>>>
>>> Of course you could modify the DOM directly in the controller.
>>>
>>>
>>>
>>> Il giorno lunedì 22 ottobre 2012 22:56:48 UTC+2, Omi Chiba ha scritto:

 Wow! This is exactly what I wanted. I hope this will be the default 
 layout for grid.

 I copy and pasted your code between {{extend 'layout.html'}} and 
 {{=gird}}, then export labels are now disappeard...
 Maybe you should check your code with the latest (2.1.1). 

 {{left_sidebar_enabled,right_sidebar_enabled=False,('message' in 
 globals())}}
 {{extend 'layout.html'}}
 {{
 w2p_grid_tbl = grid.element('table')
 if w2p_grid_tbl:
  export_menu = grid.element('div.w2p_export_menu')
  export_menu_links = export_menu.elements('a')
  export_menu_items = []
  for link in export_menu_links:
  item = LI(link)
  export_menu_items.append(item)
  pass
  export_menu = grid.element('div.w2p_export_menu',replace=None)
  new_export_menu = DIV(
   A( T('Exports'),
  SPAN(_class='caret'),

Re: [web2py] Re: routes.py not working in 2.0.9

2012-10-25 Thread LightOfMooN
Current pattern-based system is perfect. We made more than 20 projects with 
it.
But it does not work on new web2py version (2.2.1). We used 1.99.7 before.

четверг, 25 октября 2012 г., 18:23:13 UTC+5 пользователь Massimo Di Pierro 
написал:
>
> We'll change them in web3py. Suggestions?
>
> On Thursday, 25 October 2012 06:10:44 UTC-5, Vasile Ermicioi wrote:
>>
>> since I started with web2py routes were the most uneasy and unstable part 
>> of web2py,
>> and how awesome is web2py in all other parts - dal, template, sql forms, 
>> authentication, building services(json,xml)
>> but with routes always had problems - no unicode support, very hard to 
>> 'rewrite' urls, not quite easy to match subdomains, 
>> I found flask routes so much easier to use :( but they are not fitting 
>> web2py design
>>
>>

-- 





Re: [web2py] BUG: appadmin cannot save to db

2012-10-25 Thread lyn2py
Good point. I will update and try it later. I need to replace appadmin.py only?

Thanks Richard. 

-- 





[web2py] IS_IN_SET(['Myriad, "Trebuchet MS", sans-serif','"Helvetica Neue", Helvetica' ...

2012-10-25 Thread Annet
I'd like to have an IS_IN_SET validator with font sets, this doesn't work:

fontset=IS_IN_SET(['myriad-pro-1, myriad-pro-2, Myriad, "Trebuchet MS", 
sans-serif','"Helvetica Neue", Helvetica, Arial, 
sans-serif'],zero=T('select a value'))

In a view this:

font-family: {{=session.customtheme.bodyFontFamily}};

turn into this:

font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;

Is there a way to replace the &qout; with "


Kind regards,

Annet.

-- 





Re: [web2py] BUG: appadmin cannot save to db

2012-10-25 Thread Richard Vézina
appadmin.html to

And by the way you should update :

All files from static/

all generic files form views/

Make sure you backup you app before, so you can revert if you brake
something.

If you have modify layout.html you will have to compare what change in the
new layout.html and replace the element in your own layout.html

Richard

On Thu, Oct 25, 2012 at 12:25 PM, lyn2py  wrote:

> Good point. I will update and try it later. I need to replace appadmin.py
> only?
>
> Thanks Richard.
>
> --
>
>
>
>

-- 





Re: [web2py] BUG: appadmin cannot save to db

2012-10-25 Thread Richard Vézina
view/

appadmin.html
generic.ics
generic.load
generic.rss
layout.html
generic.json
generic.map
generic.xml
web2py_ajax.html
generic.html
generic.jsonp
generic.pdf

controller/
appadmin.py

static/
css/*
images/*
js/*

You can do this like that :

>From web2py/applications

cp -R welcome/static/* YOURAPP/static/
cp welcome/controllers/appadmin.py  YOURAPP/controllers/
cp welcome/views/* test_copy_file/views/

Watch out the last command will override the layout.html...

Richard



On Thu, Oct 25, 2012 at 12:33 PM, Richard Vézina <
ml.richard.vez...@gmail.com> wrote:

> appadmin.html to
>
> And by the way you should update :
>
> All files from static/
>
> all generic files form views/
>
> Make sure you backup you app before, so you can revert if you brake
> something.
>
> If you have modify layout.html you will have to compare what change in the
> new layout.html and replace the element in your own layout.html
>
> Richard
>
> On Thu, Oct 25, 2012 at 12:25 PM, lyn2py  wrote:
>
>> Good point. I will update and try it later. I need to replace appadmin.py
>> only?
>>
>> Thanks Richard.
>>
>> --
>>
>>
>>
>>
>

-- 





[web2py] Re: browser request

2012-10-25 Thread patrick moon
exactly what i was looking for..was trying to get 
request.env.query_stringsince i have not add an intellisense ide to 
web2py, i didn't really know how to locate your suggestion and i missed it 
wading thru the doc.  Thanks a million!

On Thursday, October 25, 2012 1:25:47 AM UTC-7, Niphlod wrote:
>
> What are you expecting from a "raw request" ? Doesn't request.env suffice ?
>
> On Wednesday, October 24, 2012 11:33:52 PM UTC+2, patrick moon wrote:
>>
>> is it possible to get a raw "request" from a browser in web2py?  right 
>> now it looks like some of the request information is converted to 
>> gluon.storage.Storage.  I'm doing a parallel compare with django and am 
>> trying to keep the code base comparison as close as possible.  Thanks 
>>
>

-- 





[web2py] Instant Press CMS 2010?

2012-10-25 Thread António Ramos
no updates since 2010?

Is it going to die?

António

-- 





[web2py] Re: IS_IN_SET(['Myriad, "Trebuchet MS", sans-serif','"Helvetica Neue", Helvetica' ...

2012-10-25 Thread Niphlod
output in views is always escaped (meant to be a "printable" string). If 
you need the raw value, you can use XML() 

On Thursday, October 25, 2012 6:27:53 PM UTC+2, Annet wrote:
>
> I'd like to have an IS_IN_SET validator with font sets, this doesn't work:
>
> fontset=IS_IN_SET(['myriad-pro-1, myriad-pro-2, Myriad, "Trebuchet MS", 
> sans-serif','"Helvetica Neue", Helvetica, Arial, 
> sans-serif'],zero=T('select a value'))
>
> In a view this:
>
> font-family: {{=session.customtheme.bodyFontFamily}};
>
> turn into this:
>
> font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
>
> Is there a way to replace the &qout; with "
>
>
> Kind regards,
>
> Annet.
>

-- 





Re: [web2py] Re: Image Tutorial and linked_tables

2012-10-25 Thread David Simmons
Hi Jim/Leonel

tried both of your suggestions but still no luck. 

thanks

Dave

-- 





[web2py] page min height

2012-10-25 Thread Richard
Hello,

Consider adding this to welcome :

First suggestion (mycss.css to "make sure" that the user know where to put 
it app specific CSS rules and make easy the update of app web2py specific 
files) :
For application specific CSS to allow user override "all" the other CSS 
without having to touch the other files.
For example : static/mycss.css

That will load at last in layout.html :

  
  {{  
  response.files.append(URL('static','css/web2py.css'))
  response.files.append(URL('static','css/bootstrap.min.css'))
  response.files.append(URL('static','css/bootstrap-responsive.min.css'))
  response.files.append(URL('static','css/web2py_bootstrap.css'))
*  response.files.append(URL('static','css/mycss.css'))*
  }}

Second suggestion (min page height or fixed bottom footer) :
This could require that web2py.css load at last... I am not sure if it 
could break something though... I just try and it not seems to break 
anything, so I don't see why it was not already the lass CSS loaded into 
layout to allow overriding of certain bootstrap css rules... Anyway.

In order to send the footer at the bottom even if page is "empty" or not 
full...

1) Add a .fill class to page container... In the actual layout the second 
div with class container is the page container...

2) Add these rules to web2py.css (make sure that web2py.css load last in 
the layout.html) :
/* 
-- 
*/
/* In order to allow footer to stick at the bottom even if the page core
   is empty
   Help from there :
  
 
http://stackoverflow.com/questions/11677886/twitter-bootstrap-div-in-container-with-100-height
   Ex.: http://jsfiddle.net/S3Gvf/ 
*/
html, body {
height: 100%;
}

.fill {
min-height: 100%;
height: 100%;
}

#main {
height: 52%;
min-height: 52%;
}
/* 
-- 
*/

3) Reload "F5"

It may be improve, I didn't test to much to make sure that #main height and 
min-height are correct in every situation (different screen, etc.).

Richard



-- 





[web2py] Re: Formatter and values=None problem

2012-10-25 Thread Joe Barnhart
Actually Paolo, I have a custom Validator which contains the formatter 
function.  It is supplied automatically when I use the validator, so I do 
not get a chance to change its calling sequence as you show in the case of 
using "represents".  Here is the validator class:

class IS_ELAPSED_TIME(object):
def __init__(self,error_message='Must be MM:SS.hh or MMSShh (with no 
punctuation)'):
self.error_message=error_message
def __call__(self,value):
try:
if value and value.upper() != 'NT':
res = hms_to_int(value)
else:
res = None
return (res,None)
except:
return (value,self.error_message)
def formatter(self,value):
if value:
rtn = int_to_hms(value)
else:
rtn = 'NT'
return rtn

Since the Field is declared to use this validator, I have no explicit 
"formatter=" statement I cannot easily employ your solution.  I do not 
understand why "None" is not allowed to be formatted in the first place.

-- Joe B.

On Thursday, October 25, 2012 6:07:09 AM UTC-7, Paolo Caruccio wrote:
>
> or better
>
> def format_function (value)
>  formatted_value = .
>  return formatted_value
>
> db.tablename.fieldname.represent= lambda value,row: format_function(value) 
> if value else "Not Standard Time"
>
>
>
>
> Il giorno giovedì 25 ottobre 2012 13:31:43 UTC+2, Paolo Caruccio ha 
> scritto:
>>
>> Did you try:
>>
>> db.tablename.fieldname.represent= lambda value: value if value else 'NT"
>>
>> ?
>> web2py book reference 
>> http://web2py.com/books/default/chapter/29/06?search=represent#Record-representation
>>
>>
>> Il giorno giovedì 25 ottobre 2012 03:20:29 UTC+2, Joe Barnhart ha scritto:
>>>
>>> I have an application where I expect "None" items in my database and I 
>>> want to format them to "NT".  It is an app that uses time standards, and if 
>>> there is no standard present I expect a "None" in the database which 
>>> translates to a field of "No Time" or "NT".
>>>
>>> The problem is that the current implementation of formatter in the Field 
>>> class tests the value for "None" and escapes before the formatter is called.
>>>
>>> I can see why this behavior might be expected in a lot of cases, but it 
>>> seems extreme to deny the ability to format "None" into a more pleasing 
>>> form for those applications that could benefit from it.  Here is the 
>>> offending part of formatter (located in gluon/dal.py):
>>>
>>> def formatter(self, value):
>>> requires = self.requires
>>> if value is None or not requires:
>>> return value
>>>
>>> If I change the above to:
>>>
>>> def formatter(self, value):
>>> requires = self.requires
>>> if not requires:
>>> return value
>>>
>>> I get my desired behavior, which is to pass "None" to my formatter which 
>>> is implemented as part of a custom Validator object.  I realize the code 
>>> now has to go "further" for cases where the value is None, but is it really 
>>> safe to assume nobody will ever want to "format" None into another string?  
>>> Not in my case, at least!
>>>
>>> Joe B.
>>>
>>>
>>>

-- 





Re: [web2py] page min height

2012-10-25 Thread Richard Vézina
Forget about the example of the sticky footer I gave... I will be back with
a better implementation.

There were many issues.

Richard

On Thu, Oct 25, 2012 at 3:32 PM, Richard wrote:

> Hello,
>
> Consider adding this to welcome :
>
> First suggestion (mycss.css to "make sure" that the user know where to put
> it app specific CSS rules and make easy the update of app web2py specific
> files) :
> For application specific CSS to allow user override "all" the other CSS
> without having to touch the other files.
> For example : static/mycss.css
>
> That will load at last in layout.html :
>
>   
>   {{
>   response.files.append(URL('static','css/web2py.css'))
>   response.files.append(URL('static','css/bootstrap.min.css'))
>   response.files.append(URL('static','css/bootstrap-responsive.min.css'))
>   response.files.append(URL('static','css/web2py_bootstrap.css'))
> *  response.files.append(URL('static','css/mycss.css'))*
>   }}
>
> Second suggestion (min page height or fixed bottom footer) :
> This could require that web2py.css load at last... I am not sure if it
> could break something though... I just try and it not seems to break
> anything, so I don't see why it was not already the lass CSS loaded into
> layout to allow overriding of certain bootstrap css rules... Anyway.
>
> In order to send the footer at the bottom even if page is "empty" or not
> full...
>
> 1) Add a .fill class to page container... In the actual layout the second
> div with class container is the page container...
>
> 2) Add these rules to web2py.css (make sure that web2py.css load last in
> the layout.html) :
> /*
> --
> */
> /* In order to allow footer to stick at the bottom even if the page core
>is empty
>Help from there :
>
> http://stackoverflow.com/questions/11677886/twitter-bootstrap-div-in-container-with-100-height
>Ex.: http://jsfiddle.net/S3Gvf/
>   */
> html, body {
> height: 100%;
> }
>
> .fill {
> min-height: 100%;
> height: 100%;
> }
>
> #main {
> height: 52%;
> min-height: 52%;
> }
> /*
> --
> */
>
> 3) Reload "F5"
>
> It may be improve, I didn't test to much to make sure that #main height
> and min-height are correct in every situation (different screen, etc.).
>
> Richard
>
>
>
>  --
>
>
>
>

-- 





[web2py] Re: grid export button

2012-10-25 Thread Omi Chiba
It worked!!
Thanks again.

On Thursday, October 25, 2012 10:49:15 AM UTC-5, Paolo Caruccio wrote:
>
> This happens because the url has arguments.
>
> please try with:
>
> {{extend 'layout.html'}}
> {{
> if not request.args:
>  w2p_grid_tbl = grid.element('table')
>  if w2p_grid_tbl:
>  original_export_menu = grid.element('div.w2p_export_menu')
>  export_menu_links = original_export_menu.elements('a')
>  export_menu_items = []
>  for link in export_menu_links:
>  item = LI(link)
>  export_menu_items.append(item)
>  pass
>  new_export_menu = DIV(
>   A( T('Exports'),
>  SPAN(_class='caret'),
>  _href='#',
>  _class='btn dropdown-toggle',
>  **{'_data-toggle':"dropdown"}
> ),
>   UL(*export_menu_items,
>  _class='dropdown-menu'
> ),
> _class='w2p_export_menu btn-group'
> )
>  export_menu = grid.element('div.w2p_export_menu',replace=new_export_menu)
>  pass
> pass
> }}
>
>
> {{=grid}}
>
> Of course if the page with the grid has arguments in url you have to 
> change the first condition and check the acceptable cases.
>  
>  
>
> Il giorno giovedì 25 ottobre 2012 16:20:45 UTC+2, Omi Chiba ha scritto:
>>
>> I posted on this on my 
>> blog
>>  and 
>> someone pointed that it will get ticket when clicking View button. Do you 
>> know how to fix?
>>
>> Problem looks like here.
>> export_menu_links = original_export_menu.elements('a')
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>>
>> Traceback (most recent call last):
>>   File "C:\web2py\gluon\restricted.py", line 209, in restricted
>> exec ccode in environment
>>   File "C:\web2py\applications\grid\views\default/index.html", line 82, in 
>> 
>> AttributeError: 'NoneType' object has no attribute 'elements'
>>
>>
>>
>> 73.
>> 74.
>> 75.
>> 76.
>> 77.
>> 78.
>> 79.
>> 80.
>> 81.
>> 82.
>>
>> 83.
>> 84.
>> 85.
>> 86.
>> 87.
>> 88.
>> 89.
>> 90.
>> 91.
>> 92.
>>
>> pass
>> response.write('\n\n\n', escape=False)
>> response.write('\n', escape=False)
>> response.write('\r\n', escape=False)
>> w2p_grid_tbl = grid.element('table')
>> if w2p_grid_tbl:
>> original_export_menu = grid.element('div.w2p_export_menu')
>> export_menu_links = original_export_menu.elements('a')
>>
>> export_menu_items = []
>> for link in export_menu_links:
>> item = LI(link)
>> export_menu_items.append(item)
>> pass
>> new_export_menu = DIV(
>> A( T('Exports'),
>> SPAN(_class='caret'),
>> _href='#',
>> _class='btn dropdown-toggle',
>>
>>
>>
>>
>>
>>
>> On Tuesday, October 23, 2012 8:38:54 AM UTC-5, Omi Chiba wrote:
>>>
>>> It works! Thank you for sharing your code.
>>>
>>>
>>>
>>> On Monday, October 22, 2012 5:00:19 PM UTC-5, Paolo Caruccio wrote:

 My fault. I extrapoled the code from more complex one.

 Try this:

 {{extend 'layout.html'}}
 {{
 w2p_grid_tbl = grid.element('table')
 if w2p_grid_tbl:
  original_export_menu = grid.element('div.w2p_export_menu')
  export_menu_links = original_export_menu.elements('a')
  export_menu_items = []
  for link in export_menu_links:
  item = LI(link)
  export_menu_items.append(item)
  pass
  new_export_menu = DIV(
   A( T('Exports'),
  SPAN(_class='caret'),
  _href='#',
  _class='btn dropdown-toggle',
  **{'_data-toggle':"dropdown"}
 ),
   UL(*export_menu_items,
  _class='dropdown-menu'
 ),
 _class='w2p_export_menu btn-group'
 )
  export_menu = grid.element('div.w2p_export_menu',replace=
 new_export_menu)
 pass
 }}

 {{=grid}}

 Of course you could modify the DOM directly in the controller.



 Il giorno lunedì 22 ottobre 2012 22:56:48 UTC+2, Omi Chiba ha scritto:
>
> Wow! This is exactly what I wanted. I hope this will be the default 
> layout for grid.
>
> I copy and pasted your code between {{extend 'layout.html'}} and 
> {{=gird}}, then export labels are now disappeard...
> Maybe you should check your code with the latest (2.1.1). 
>
> {{left_sidebar_enabled,right_sidebar_enabled=False,('message' in 
> globals())}}
> {{extend 'layout.html'}}
> {{
> w2p_grid_tbl = grid.element('table')
> if w2p_grid_tbl:
>  export_menu = grid.element('div.w2p_export_menu')
>  export_menu_links = export_menu.elements('a')
>  export_menu_items

[web2py] Append to list:reference or list:string with update_record

2012-10-25 Thread Mark Li
Is it possible to append to a database list (like list:reference or 
list:string) with update_record, as opposed to explicitly stating the whole 
list for update_record?

-- 





[web2py] downloading a synthetic csv

2012-10-25 Thread Jonathan Lundell
I want to build a dataset (list of lists) in response to a user request and 
cause a csv of that dataset to be downloaded.

I have a working but ugly implementation that uses @service.csv. If I access 
the URL

http://domain.com/app/default/call/csv/foo

...it works OK and downloads a file named 'foo'.

A couple of questions. 

1. Is there a better way (considering that this is a user request, not really a 
web service per se)?

2. How do I make the downloaded file, above, be named foo.csv? Maybe set 
request.extension? (I tried call.csv in the URL, which still downloaded 'foo'.)

3. Can I combine @auth.requires_something with @service.csv?

Thanks!

-- 





[web2py] Re: Formatter and values=None problem

2012-10-25 Thread Paolo Caruccio
Why don't you manage None values in int_to_hms function?


Il giorno giovedì 25 ottobre 2012 21:56:17 UTC+2, Joe Barnhart ha scritto:
>
> Actually Paolo, I have a custom Validator which contains the formatter 
> function.  It is supplied automatically when I use the validator, so I do 
> not get a chance to change its calling sequence as you show in the case of 
> using "represents".  Here is the validator class:
>
> class IS_ELAPSED_TIME(object):
> def __init__(self,error_message='Must be MM:SS.hh or MMSShh (with no 
> punctuation)'):
> self.error_message=error_message
> def __call__(self,value):
> try:
> if value and value.upper() != 'NT':
> res = hms_to_int(value)
> else:
> res = None
> return (res,None)
> except:
> return (value,self.error_message)
> def formatter(self,value):
> if value:
> rtn = int_to_hms(value)
> else:
> rtn = 'NT'
> return rtn
>
> Since the Field is declared to use this validator, I have no explicit 
> "formatter=" statement I cannot easily employ your solution.  I do not 
> understand why "None" is not allowed to be formatted in the first place.
>
> -- Joe B.
>
> On Thursday, October 25, 2012 6:07:09 AM UTC-7, Paolo Caruccio wrote:
>>
>> or better
>>
>> def format_function (value)
>>  formatted_value = .
>>  return formatted_value
>>
>> db.tablename.fieldname.represent= lambda value,row: format_function(value
>> ) if value else "Not Standard Time"
>>
>>
>>
>>
>> Il giorno giovedì 25 ottobre 2012 13:31:43 UTC+2, Paolo Caruccio ha 
>> scritto:
>>>
>>> Did you try:
>>>
>>> db.tablename.fieldname.represent= lambda value: value if value else 'NT"
>>>
>>> ?
>>> web2py book reference 
>>> http://web2py.com/books/default/chapter/29/06?search=represent#Record-representation
>>>
>>>
>>> Il giorno giovedì 25 ottobre 2012 03:20:29 UTC+2, Joe Barnhart ha 
>>> scritto:

 I have an application where I expect "None" items in my database and I 
 want to format them to "NT".  It is an app that uses time standards, and 
 if 
 there is no standard present I expect a "None" in the database which 
 translates to a field of "No Time" or "NT".

 The problem is that the current implementation of formatter in the 
 Field class tests the value for "None" and escapes before the formatter is 
 called.

 I can see why this behavior might be expected in a lot of cases, but it 
 seems extreme to deny the ability to format "None" into a more pleasing 
 form for those applications that could benefit from it.  Here is the 
 offending part of formatter (located in gluon/dal.py):

 def formatter(self, value):
 requires = self.requires
 if value is None or not requires:
 return value

 If I change the above to:

 def formatter(self, value):
 requires = self.requires
 if not requires:
 return value

 I get my desired behavior, which is to pass "None" to my formatter 
 which is implemented as part of a custom Validator object.  I realize the 
 code now has to go "further" for cases where the value is None, but is it 
 really safe to assume nobody will ever want to "format" None into another 
 string?  Not in my case, at least!

 Joe B.




-- 





Re: [web2py] page min height

2012-10-25 Thread Paolo Caruccio
Bootstrap extensions for footer to stick at the bottom seem to work.

http://bootstrapfooter.codeplex.com/


Il giorno giovedì 25 ottobre 2012 23:29:20 UTC+2, Richard ha scritto:
>
> Forget about the example of the sticky footer I gave... I will be back 
> with a better implementation.
>
> There were many issues.
>
> Richard
>
> On Thu, Oct 25, 2012 at 3:32 PM, Richard 
> > wrote:
>
>> Hello,
>>
>> Consider adding this to welcome :
>>
>> First suggestion (mycss.css to "make sure" that the user know where to 
>> put it app specific CSS rules and make easy the update of app web2py 
>> specific files) :
>> For application specific CSS to allow user override "all" the other CSS 
>> without having to touch the other files.
>> For example : static/mycss.css
>>
>> That will load at last in layout.html :
>>
>>   
>>   {{  
>>   response.files.append(URL('static','css/web2py.css'))
>>   response.files.append(URL('static','css/bootstrap.min.css'))
>>   response.files.append(URL('static','css/bootstrap-responsive.min.css'))
>>   response.files.append(URL('static','css/web2py_bootstrap.css'))
>> *  response.files.append(URL('static','css/mycss.css'))*
>>   }}
>>
>> Second suggestion (min page height or fixed bottom footer) :
>> This could require that web2py.css load at last... I am not sure if it 
>> could break something though... I just try and it not seems to break 
>> anything, so I don't see why it was not already the lass CSS loaded into 
>> layout to allow overriding of certain bootstrap css rules... Anyway.
>>
>> In order to send the footer at the bottom even if page is "empty" or not 
>> full...
>>
>> 1) Add a .fill class to page container... In the actual layout the second 
>> div with class container is the page container...
>>
>> 2) Add these rules to web2py.css (make sure that web2py.css load last in 
>> the layout.html) :
>> /* 
>> -- 
>> */
>> /* In order to allow footer to stick at the bottom even if the page core
>>is empty
>>Help from there :
>>
>> http://stackoverflow.com/questions/11677886/twitter-bootstrap-div-in-container-with-100-height
>>Ex.: http://jsfiddle.net/S3Gvf/   
>>   */
>> html, body {
>> height: 100%;
>> }
>>
>> .fill {
>> min-height: 100%;
>> height: 100%;
>> }
>>
>> #main {
>> height: 52%;
>> min-height: 52%;
>> }
>> /* 
>> -- 
>> */
>>
>> 3) Reload "F5"
>>
>> It may be improve, I didn't test to much to make sure that #main height 
>> and min-height are correct in every situation (different screen, etc.).
>>
>> Richard
>>
>>
>>
>>  -- 
>>  
>>  
>>  
>>
>
>

-- 





[web2py] Re: Error accessing users in Instant Press

2012-10-25 Thread Andrew W
I logged that one, and I emailed Martin with details of a fix.

Hoping to here from him. 



On Sunday, September 30, 2012 5:47:22 AM UTC+13, Jimi wrote:
>
> Never mind, I see now it's been logged as an issue.
>
> On Sunday, September 23, 2012 11:17:49 AM UTC-4, Jimi wrote:
>>
>>
>> New to web2py, so learning by looking at an app and taking it apart.  I 
>> pulled down the latest Instant Press and when accessing users, I'm getting 
>> the error:
>>
>>  'Row' object has no attribute 
>> 'registration_key'
>> I have not seen other references to this, so assume it's me, but I've 
>> tried various install combos (on Windows initally, then Ubuntu, package 
>> then source) all with same results.
>>
>> Thanks.
>
>

-- 





[web2py] Re: Instant Press CMS 2010?

2012-10-25 Thread Andrew W
You may be looking at the wrong version.  
There is one at   https://bitbucket.org/mulonemartin/instantpress , last 
updated early 2012.

You are probably looking at http://code.google.com/p/instant-press/. which 
I believe is the old version.

Martin, could you remove the second one please (if it has ben superceded).

Would love to hear from Martin on future plans.  I've logged a few issues 
and sent some emails - looking for feedback.

Thanks.



On Friday, October 26, 2012 6:20:59 AM UTC+13, Ramos wrote:
>
> no updates since 2010?
>
> Is it going to die?
>
> António
>

-- 





[web2py] Re: Formatter and values=None problem

2012-10-25 Thread Joe Barnhart
I do manage the "None" value in my formatter, Paulo.  

But it never gets called because the built-in code of the Field class tests 
the value for None and then exits before calling my formatter.  So it 
doesn't matter that my formatter can handle None -- it is never called.

That's why I posted the change to the Field class in the first message of 
this thread.

-- Joe B.

On Thursday, October 25, 2012 5:53:43 PM UTC-7, Paolo Caruccio wrote:
>
> Why don't you manage None values in int_to_hms function?
>
>
> Il giorno giovedì 25 ottobre 2012 03:20:29 UTC+2, Joe Barnhart ha scritto:
>
> I have an application where I expect "None" items in my database and I 
> want to format them to "NT".  It is an app that uses time standards, and 
> if 
> there is no standard present I expect a "None" in the database which 
> translates to a field of "No Time" or "NT".
>
> The problem is that the current implementation of formatter in the 
> Field class tests the value for "None" and escapes before the formatter 
> is 
> called.
>
> I can see why this behavior might be expected in a lot of cases, but 
> it seems extreme to deny the ability to format "None" into a more 
> pleasing 
> form for those applications that could benefit from it.  Here is the 
> offending part of formatter (located in gluon/dal.py):
>
> def formatter(self, value):
> requires = self.requires
> if value is None or not requires:
> return value
>
> If I change the above to:
>
> def formatter(self, value):
> requires = self.requires
> if not requires:
> return value
>
> I get my desired behavior, which is to pass "None" to my formatter 
> which is implemented as part of a custom Validator object.  I realize the 
> code now has to go "further" for cases where the value is None, but is it 
> really safe to assume nobody will ever want to "format" None into another 
> string?  Not in my case, at least!
>
> Joe B.
>
>
>

-- 





[web2py] Is the Windows download meant to have a wsgihandler.py file

2012-10-25 Thread Andrew W
Trying to run the windows app with Apache, but it doesn't have the 
wsgihandler.py file.

Can this version run with Apache, or do I need the source version.
What should WSGIScriptAlias in the Apache conf file be set to ?


-- 





[web2py] Re: IS_IN_SET(['Myriad, "Trebuchet MS", sans-serif','"Helvetica Neue", Helvetica' ...

2012-10-25 Thread Annet
Thanks for your reply.

font-family: {{=XML(session.customtheme.
bodyFontFamily)}};

... solves the problem.

Kind regards,

Annet

-- 





[web2py] SQLFORM.factory(db.table) date format problem.

2012-10-25 Thread Annet
In a table person I have the following validator on date of birth:

isdate = dict(type='date',requires=IS_DATE(format='%Y-%m-%d'),represent = 
lambda v: v.strftime('%d/%m/%Y') if v else '')

In appadmin and in form.crud.update(table=db.person, record=row) the date 
is represented correctly, however, in SQLFORM.factory(db.person) it is not. 
Instead of 21-09-1976 it is displayed the way it is formatted 1976-09-21, 
and when I submit the update form I get an error on the DoB field, because 
of the date is incorrect. I have to re-enter the DoB 21-09-1976 to be able 
to submit the form.

Is this intended behaviour, or isn't it? I am working with web2py version 
2.0.9.


Kind regards,

Annet

-- 





[web2py] on_define=set_requirement does not work

2012-10-25 Thread Annet
On a tabel tie:

db.define_table('tie',
Field('hubID','reference node',**isnode),
Field('nodeID','reference 
node',default='',ondelete='CASCADE',notnull=True),
...
on_define=set_requirement,
migrate=False)


I defined the following validator:

def set_requirement(tie): 
tie.nodeID.requires=[IS_IN_DB(db,'node.id','%(id)s',zero=T('select a 
value')),IS_NOT_IN_DB(db(db.tie.hubID==request.vars.hubID),'tie.nodeID',error_message=T('combination
 
hub and node already in database'))]


Again in appadmin when I enter hubID 11 and nodeID 3 the second time I get 
the error_message, however, in form=crud.update(db.tie) and 
form=SQLFORM.factory(db.tie,record=row) and  
db.tie.insert(hubID=id,nodeID=row.id) this combination is entered without 
this being prevented by the validator.

I defined my validators this way to make use of lazy_table=True. Does the 
fact that validators defined this way are ignored in the controller mean 
that I have to revert to my previous validator definitions and that I 
cannot make use of lazy_tables? (I am still working in web2py 2.0.9, maybe 
this issue has been resolved in 2.2.x)


Kind regards,

Annet.

--