[web2py] Re: Script for nginx/uWSGI/web2py install on Webfaction

2012-12-19 Thread Neil
Yup, it works, but I think I left out a key step. In more detail:

- In the webfaction control panel, set up two different applications. one 
is a "custom" type, and one is a "static" type.
- Put a link from the static folder under the web2py application to the 
static application's home folder
- In the control panel, create a website for your domain. A website can be 
handled by multiple applications. Set it up so that the root "/" is served 
by the custom app, and "/static" is served by the static app. I also have a 
wordpress app that serves "/blog". You can have any number of other 
applications.

For example, with my website any request to:
http://www.ai-therapy.com/
is handled by the custom app, which is uwsgi/web2py. All static content is 
under:
http://www.ai-therapy.com/static
Webfaction's nginx server knows to direct this to the static app, so uwsgi 
never even knows the request has occurred. Similarly, /blog/* goes directly 
to the wordpress app. Anything else handled by the "Custom on /" app, so 
gets mapped to web2py applications, controllers, functions, etc..

Hope that makes more sense.


On Wednesday, December 19, 2012 5:48:09 AM UTC, HittingSmoke wrote:
>
> So I've been thinking more and more about this over the past few days and 
> I'm 99% sure that would just serve the static content in the same exact way 
> it would otherwise (through uwsgi) just from the folder of the other app... 
> Can you confirm that nginx is actually serving the static 
> content separately?
>
> On Monday, December 17, 2012 11:34:51 AM UTC-8, Neil wrote:
>>
>> What I've done for that is set up another webfaction application of type 
>> "static" to server all the css, images, audio, videos, etc. That creates a 
>> new folder, for example:
>>
>> /home/[USER]/webapps/static_web2py_myapp
>>
>> Then, in my web2py/applications/[my_app]/ folder, I put a symbolic link 
>> called "static" to the above folder. Seems to do the trick.
>>
>> On Monday, December 17, 2012 7:17:35 PM UTC, HittingSmoke wrote:
>>>
>>> Bah, I actually asked a Webfaction staff member if this were possible 
>>> and I was told no, that the frontend Nginx server could only be used on 
>>> static/PHP sites.
>>>
>>> Now that I'm looking into it I'm seeing one major issue that without 
>>> proper configuration of Nginx for web2py, it would be serving static files 
>>> through uwsgi instead of directly though Nginx. That requires a special 
>>> entry in nginx.conf. Would that not mean reduced performance and higher RAM 
>>> usage from uwsgi?
>>>
>>> On Monday, December 17, 2012 4:32:21 AM UTC-8, Neil wrote:

 I'm also not a sysadmin, but I did go through the process of setting up 
 web2py on webfaction recently as well. I also found that script but it 
 seemed to be overly complicated. In particular, there is no need to 
 download, build & run nginx, as you can use webfaction's instance. If 
 there 
 is an advantage to running your own I'd be curious to hear about it. 
 Simplified steps I followed:

 1. download & build latest uwsgi
 2. download & unpack latest web2py
 3. set up a "custom app" using webfaction's control panel, taking note 
 of the port
 4. run the uwsgi binary, specifying parameters in the command line. For 
 the socket parameter use 127.0.0.1 and the port webfaction assigned for 
 your custom app. There are a few other posts in this group about selecting 
 good uwsgi parameters so that you don't run out of memory (seems to be a 
 common pitfall on webfaction)

 Hope that's useful.

 Neil


 On Monday, December 17, 2012 6:53:31 AM UTC, HittingSmoke wrote:
>
> I've been learning web2py on Webfaction off and on for a while now. 
> The web2py install script on the Webfaction wiki is quite outdated and 
> runs 
> on an Apache instance that can barely stay within the default memory 
> limits 
> without serious tweaking. Responsiveness with web2py/apache out of the 
> box 
> with the default install script is unimpressive as well.
>
> A while back I tried a lighttpd setup with web2py on Webfaction. The 
> memory usage went way down and responsiveness was better but the web 
> server 
> was quite unstable. I found myself having to restart it constantly and I 
> couldn't track down the cause of the breakages. After the host upped the 
> default RAM limit on CentOS6 systems to 256MB things got better as it 
> made 
> Apache more manageable on custom installs but it still sucked overall.
>
> So I found an install script for nginx/uWSGI on the WF community 
> support 
> forumbut
>  it was horribly outdated and had multiple issues pointed out in the 
> comments that went unfixed. I spent a couple hours today fixing the 
> ignored 
> errors, updating it to the latest ngi

Re: [web2py] Re: RFC: web2py-based workflow engine

2012-12-19 Thread Andrew W
Does anyone know if there has been any progress on this ?
Hello Ross ?



On Tuesday, September 25, 2012 1:52:46 AM UTC+12, Ramos wrote:
>
> Same question here 
> Ross,
> How's the workflow engine going ?
>
> Cheers
> António
>
> 2012/7/6 Andrew >
>
>> Hi Ross,
>> How's the workflow engine going ?
>>
>> Regards
>> Andrew W
>>
>
>

-- 





[web2py] Multiple or in where clause using dal

2012-12-19 Thread Rocco
Dear all,

I need to extract multiple records from a table, the number of selected 
records is variable (from 1 to hundreds).

The user form returns a list of selected ids, f.e.:
myset=[1,15,22,44,56]

In the raw sql way, I used a for loop to generate the where clause of the 
sql statement, to get f.e.:

SELECT * from table
WHERE (id=1 or id=15 or id=22 or id=44 or id=56)

I expected to find some DAL tool to avoid the db.executesql usage, but I 
wasn't able to do it.

I hoped that I could pass the list as argument, in this way:

db(db.table.id==myset).select()
but doens't work...

any suggestions?

-- 





[web2py] Re: The book updates and status

2012-12-19 Thread Andrew W
Just checking in on how the 5th edition is going ?
Thanks

On Thursday, November 29, 2012 11:58:29 PM UTC+13, Kostas M wrote:
>
> I have bought the (printed) web2py book (editions 3rd and 4th) from Lulu, 
> and my note is that the black & white printouts are much less attractive 
> from
> the web css book layout. The coloring helps understanding the syntax as 
> well. I wish the printed book could look as nice as the web version...
> I once printed some chapters in a color printer to have this nice layout. 
> Couldn't the Lulu book follow a better printing style?
>
> Kostas
>
> On Wednesday, November 28, 2012 7:08:48 PM UTC, Massimo Di Pierro wrote:
>>
>> Almost everything is documented except: 1) auth.wiki; 2) some of the new 
>> grid parameters.
>>
>> Along with these changes I am planning some minor book refactoring before 
>> publishing to 5th edition.
>>
>> Massimo
>>
>>>
>

-- 





Re: [web2py] Re: tuple to gluon.dal.Rows conversion

2012-12-19 Thread Muhammad Atif Ayaz
Thanks a lot for a very useful tip

Regards

On Tue, Dec 18, 2012 at 9:18 PM, Anthony  wrote:

> t will automatically convert the res

-- 





[web2py] Re: Scheduler tasks stuck in ASSIGNED state

2012-12-19 Thread Niphlod
sorry, just tried, can't reproduce the issue. Can you post the logs of the 
schedulers ?
Maybe start them adding *-D 0* to activate the DEBUG level
What normally goes on is:
- you start "dir", it's the first one so it becomes the "TICKER", but it 
doesn't see any "metrics" worker so it doesn't assign tasks
- you start "metrics", after a while the "dir" worker sees it and starts 
assigning tasks to "metrics"
- etc.


Il giorno mercoledì 19 dicembre 2012 04:31:32 UTC+1, JimK ha scritto:
>
> I'm not sure what the issue was but replacing the gluon/scheduler.py file 
> with the older one fixed the problem.  There were a lot of changes in 2.3.2 
> so it's hard to pinpoint what broke things.
>
> On Tuesday, December 18, 2012 6:36:29 PM UTC-8, JimK wrote:
>>
>> There appears to be a major bug with the scheduler workers with 2.3.2 in 
>> tasks are stuck in the ASSIGNED state if that worker group was not the 
>> first one started.  This problem did not exist until I upgraded to 2.3.2 
>> this morning.
>>
>> I have 2 task groups in my service (dir, metrics).  
>>
>> I start the workers after starting the server like so (art is the 
>> application name):
>> /usr/bin/python2.6 /var/www/web2py/web2py.py -K art:dir
>> /usr/bin/python2.6 /var/www/web2py/web2py.py -K art:metrics
>> /usr/bin/python2.6 /var/www/web2py/web2py.py -K art:rap
>>
>> If I start the "dir" worker first and the "metrics", my "dir" group tasks 
>> complete fine but the "metrics" group tasks are stuck in the ASSIGNED state.
>> To prove my theory, I then killed all of the workers and stared the 
>> "metrics" worker first and then "dir" worker.  As hypothesized, the 
>> "metrics" group tasks complete but the "dir" group tasks are stuck in the 
>> ASSIGNED state.
>>
>> Any ideas???
>>
>

-- 





[web2py] Re: Edit or delete not committing in sqlform.grid for custom query

2012-12-19 Thread Mandar Vaze
Problem still persists in 2.3.2

On Tuesday, October 9, 2012 6:05:08 AM UTC+5:30, Derek wrote:
>
> did you open an issue?
> http://code.google.com/p/web2py/issues/list
>

Done. http://code.google.com/p/web2py/issues/detail?id=1234

-Mandar 

-- 





[web2py] Re: Multiple or in where clause using dal

2012-12-19 Thread Niphlod
db(db.table.id.belongs(myset)).select()

Il giorno mercoledì 19 dicembre 2012 10:07:33 UTC+1, Rocco ha scritto:
>
> Dear all,
>
> I need to extract multiple records from a table, the number of selected 
> records is variable (from 1 to hundreds).
>
> The user form returns a list of selected ids, f.e.:
> myset=[1,15,22,44,56]
>
> In the raw sql way, I used a for loop to generate the where clause of the 
> sql statement, to get f.e.:
>
> SELECT * from table
> WHERE (id=1 or id=15 or id=22 or id=44 or id=56)
>
> I expected to find some DAL tool to avoid the db.executesql usage, but I 
> wasn't able to do it.
>
> I hoped that I could pass the list as argument, in this way:
>
> db(db.table.id==myset).select()
> but doens't work...
>
> any suggestions?
>

-- 





[web2py] Re: Multiple or in where clause using dal

2012-12-19 Thread Rocco
Thank you!

Il giorno mercoledì 19 dicembre 2012 10:41:33 UTC+1, Niphlod ha scritto:
>
> db(db.table.id.belongs(myset)).select()
>
>
>>

-- 





[web2py] Re: Edit or delete not committing in sqlform.grid for custom query

2012-12-19 Thread Niphlod
I can't reproduce the issue. Can you post a packed application showing the 
problem ? Both edit and deleteare working fine for me, either with a custom 
query or a table name.

On Wednesday, December 19, 2012 10:40:58 AM UTC+1, Mandar Vaze wrote:
>
> Problem still persists in 2.3.2
>
> On Tuesday, October 9, 2012 6:05:08 AM UTC+5:30, Derek wrote:
>>
>> did you open an issue?
>> http://code.google.com/p/web2py/issues/list
>>
>
> Done. http://code.google.com/p/web2py/issues/detail?id=1234
>
> -Mandar 
>

-- 





[web2py] change id?

2012-12-19 Thread Aurelijus Useckas
is it possible to change row id or null it so it starts sequential counting 
starting from 0?

thank you

-- 





Re: [web2py] change id?

2012-12-19 Thread Vinicius Assef
I think it depends on you RDBMS.


On Wed, Dec 19, 2012 at 10:00 AM, Aurelijus Useckas
 wrote:
> is it possible to change row id or null it so it starts sequential counting
> starting from 0?
>
> thank you
>
> --
>
>
>

-- 





[web2py] REF: SQLFORM.grid column width and content length

2012-12-19 Thread Teddy Nyambe
Hi,

I have noticed SQLFORM.grid column content is not wraping if its long
instead the content is cut and three dots (...) are appended to the
content. How do i allow more text to be displayed or adjust the width of
the grid?

Teddy L.

-- 





[web2py] Re: how to hide a field until another field is chosen using SQLFORM.smartgrid

2012-12-19 Thread Jose


El martes, 11 de diciembre de 2012 21:50:07 UTC-3, JimK escribió:
>
> I have a table defined with many columns but some are only relevant if a 
> previous one is chosen.  How would I hide a field like this 
> with SQLFORM.smartgrid?
>
> model:
> db.define_table('t_schedule_frat_query',
> Field('f_recurring', type='boolean', notnull=True,
>   label=T('Recurring schedule?'),
> Field('f_schedule_frequency', type='string',
>   label=T('Schedule Frequency'),
> auth.signature,
> format='%(f_query_name)s',
> migrate=True)
>
> controller:
> def foo():
> form = SQLFORM.smartgrid(db.t_frat_query)
> return locals()
>
> view:
> default view
>
> On the webpage, t_schedule_frat_query. f_schedule_frequency should only 
> show up if t_schedule_frat_query. f_recurring is checked.  How would I do 
> this?
>
>
> Jim
>

Hi Jim

maybe this [1] will help

Jose

[1] 
http://www.web2py.com/books/default/chapter/29/11#Conditional-fields-in-forms
 

-- 





Re: [web2py] Re: Aren't we not able to translate SQLFORM.grid buttons?

2012-12-19 Thread Tito Garrido
Thanks!


On Tue, Dec 18, 2012 at 11:28 PM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> Yes, that was missing. I now added it.
>
>
> On Tuesday, 18 December 2012 16:23:02 UTC-6, Tito Garrido wrote:
>>
>> Hi Folks!
>>
>> I am trying to find the 'Add' string on the translation file but I
>> couldn't find anything related to SQLFORM.grid to translate, is it expected?
>>
>> Thanks!
>>
>> Tito
>>
>> --
>>
>> Linux User #387870
>> .
>>  _/_õ|__|
>> ..º[ .-.___.-._| . . . .
>> .__( o)__( o).:___
>>
>  --
>
>
>
>



-- 

Linux User #387870
.
 _/_õ|__|
..º[ .-.___.-._| . . . .
.__( o)__( o).:___

-- 





Re: [web2py] change id?

2012-12-19 Thread Aurelijus Useckas
I''m using an SQlite btw. 

autoincrement resets with this command: print db.executesql('UPDATE 
SQLITE_SEQUENCE SET seq = 0 WHERE name = \'auth_user\'')

On Wednesday, December 19, 2012 2:20:49 PM UTC+2, viniciusban wrote:
>
> I think it depends on you RDBMS. 
>
>
> On Wed, Dec 19, 2012 at 10:00 AM, Aurelijus Useckas 
> > wrote: 
> > is it possible to change row id or null it so it starts sequential 
> counting 
> > starting from 0? 
> > 
> > thank you 
> > 
> > -- 
> > 
> > 
> > 
>

-- 





[web2py] Re: REF: SQLFORM.grid column width and content length

2012-12-19 Thread Niphlod
By default, maxtextlength is 20. maxtextlength=150 will truncate all 
columns only if they are longer than 150 chars.

maxtextlength*s* instead allows to pass a dictionary of {'tablename.field' 
: length} to set this limit for every column.


Il giorno mercoledì 19 dicembre 2012 13:24:04 UTC+1, software.ted ha 
scritto:
>
> Hi,
>
> I have noticed SQLFORM.grid column content is not wraping if its long 
> instead the content is cut and three dots (...) are appended to the 
> content. How do i allow more text to be displayed or adjust the width of 
> the grid?
>
> Teddy L.
>

-- 





[web2py] help please

2012-12-19 Thread Aurelijus Useckas
I've deleted user information from auth_users and suddenly all my data 
(from other table views) disapears.. Yes, other tables are linked to this 
one. Specifically for info on updates and simillar...

If I restore the same data in auth_users other table still doesn't show 
anything... I event reset the autoincrement and make it appear totally 
identical.. still nothing :(

did i mess up??? :(

-- 





[web2py] Re: help please

2012-12-19 Thread Aurelijus Useckas
i'm on SQLite

On Wednesday, December 19, 2012 3:21:27 PM UTC+2, Aurelijus Useckas wrote:
>
> I've deleted user information from auth_users and suddenly all my data 
> (from other table views) disapears.. Yes, other tables are linked to this 
> one. Specifically for info on updates and simillar...
>
> If I restore the same data in auth_users other table still doesn't show 
> anything... I event reset the autoincrement and make it appear totally 
> identical.. still nothing :(
>
> did i mess up??? :(
>

-- 





[web2py] Re: help please

2012-12-19 Thread Niphlod
definitely messed up. no way they will "return back". That's why referenced 
tables are for.

Il giorno mercoledì 19 dicembre 2012 14:25:01 UTC+1, Aurelijus Useckas ha 
scritto:
>
> i'm on SQLite
>
> On Wednesday, December 19, 2012 3:21:27 PM UTC+2, Aurelijus Useckas wrote:
>>
>> I've deleted user information from auth_users and suddenly all my data 
>> (from other table views) disapears.. Yes, other tables are linked to this 
>> one. Specifically for info on updates and simillar...
>>
>> If I restore the same data in auth_users other table still doesn't show 
>> anything... I event reset the autoincrement and make it appear totally 
>> identical.. still nothing :(
>>
>> did i mess up??? :(
>>
>

-- 





[web2py] Re: help please

2012-12-19 Thread Aurelijus Useckas
is there any way to extract data from sqlite? The file is still full of 
data...

I don't understand, if you delete somthing that is linked, everything 
messes up?

On Wednesday, December 19, 2012 3:34:31 PM UTC+2, Niphlod wrote:
>
> definitely messed up. no way they will "return back". That's why 
> referenced tables are for.
>
> Il giorno mercoledì 19 dicembre 2012 14:25:01 UTC+1, Aurelijus Useckas ha 
> scritto:
>>
>> i'm on SQLite
>>
>> On Wednesday, December 19, 2012 3:21:27 PM UTC+2, Aurelijus Useckas wrote:
>>>
>>> I've deleted user information from auth_users and suddenly all my data 
>>> (from other table views) disapears.. Yes, other tables are linked to this 
>>> one. Specifically for info on updates and simillar...
>>>
>>> If I restore the same data in auth_users other table still doesn't show 
>>> anything... I event reset the autoincrement and make it appear totally 
>>> identical.. still nothing :(
>>>
>>> did i mess up??? :(
>>>
>>

-- 





[web2py] Re: help please

2012-12-19 Thread Niphlod
I said *messed up* just to use part of your sentence.
With referenced table, if you used the default ondelete attribute of the 
field, every "child" record gets deleted as soon as the "parent" is deleted.
You can't fetch the data drom sqlite, it's definitely gone. For goods. 
The fact that the sqlite file is still "large" is because by default SQLite 
doesn't "release" the space: it keeps it for future records.

On Wednesday, December 19, 2012 2:38:32 PM UTC+1, Aurelijus Useckas wrote:
>
> is there any way to extract data from sqlite? The file is still full of 
> data...
>
> I don't understand, if you delete somthing that is linked, everything 
> messes up?
>
> On Wednesday, December 19, 2012 3:34:31 PM UTC+2, Niphlod wrote:
>>
>> definitely messed up. no way they will "return back". That's why 
>> referenced tables are for.
>>
>> Il giorno mercoledì 19 dicembre 2012 14:25:01 UTC+1, Aurelijus Useckas ha 
>> scritto:
>>>
>>> i'm on SQLite
>>>
>>> On Wednesday, December 19, 2012 3:21:27 PM UTC+2, Aurelijus Useckas 
>>> wrote:

 I've deleted user information from auth_users and suddenly all my data 
 (from other table views) disapears.. Yes, other tables are linked to this 
 one. Specifically for info on updates and simillar...

 If I restore the same data in auth_users other table still doesn't show 
 anything... I event reset the autoincrement and make it appear totally 
 identical.. still nothing :(

 did i mess up??? :(

>>>

-- 





[web2py] Re: help please

2012-12-19 Thread Aurelijus Useckas
but I can see the records inside the storage.sqlite file, so they must be 
accessible somehow

On Wednesday, December 19, 2012 3:51:37 PM UTC+2, Niphlod wrote:
>
> I said *messed up* just to use part of your sentence.
> With referenced table, if you used the default ondelete attribute of the 
> field, every "child" record gets deleted as soon as the "parent" is deleted.
> You can't fetch the data drom sqlite, it's definitely gone. For goods. 
> The fact that the sqlite file is still "large" is because by default 
> SQLite doesn't "release" the space: it keeps it for future records.
>
> On Wednesday, December 19, 2012 2:38:32 PM UTC+1, Aurelijus Useckas wrote:
>>
>> is there any way to extract data from sqlite? The file is still full of 
>> data...
>>
>> I don't understand, if you delete somthing that is linked, everything 
>> messes up?
>>
>> On Wednesday, December 19, 2012 3:34:31 PM UTC+2, Niphlod wrote:
>>>
>>> definitely messed up. no way they will "return back". That's why 
>>> referenced tables are for.
>>>
>>> Il giorno mercoledì 19 dicembre 2012 14:25:01 UTC+1, Aurelijus Useckas 
>>> ha scritto:

 i'm on SQLite

 On Wednesday, December 19, 2012 3:21:27 PM UTC+2, Aurelijus Useckas 
 wrote:
>
> I've deleted user information from auth_users and suddenly all my data 
> (from other table views) disapears.. Yes, other tables are linked to this 
> one. Specifically for info on updates and simillar...
>
> If I restore the same data in auth_users other table still doesn't 
> show anything... I event reset the autoincrement and make it appear 
> totally 
> identical.. still nothing :(
>
> did i mess up??? :(
>


-- 





[web2py] how to cleanse field value

2012-12-19 Thread wwwgong
Hi, 
I like to store youtube videos into a table:

db.define_table('youtube',
Field('code'),
Field('description')
) 

def youtube_repr(code,width=400,height=250):
return XML("""
 
http://www.youtube.com/v/%(code)s&hl=en_US&fs=1&">


http://www.youtube.com/v/%(code)s&hl=en_US&fs=1&" 
type="application/x-shockwave-flash" allowscriptaccess="always" 
allowfullscreen="true" width="%(width)s" 
height="%(height)s">
""" % dict(code=code, width=width, height=height)
) 

db.youtube.code.represent = youtube_repr

with this controller:
def youtube_video(): 
form = SQLFORM.grid(db.youtube)
return dict(form=form)

If the "description" field contains double quote char {"}, it will messes 
up,
see screenshot at 
http://dl.dropbox.com/u/54552252/cleanse-web2py-field-value.jpg

I know web2py offers custom validator to detect special char in Form field,
but is it possible to attach a pre-process function at DAL layer to cleanse 
field value before db operation?

Something like:

db.youtube.description.preprocess = cleanse_special_char

where "cleanse_special_char" is a function to 
cleanse db.youtube.description field value

Can someone offer a solution or workaround?

Thanks,
Wen


-- 





[web2py] Re: Edit or delete not committing in sqlform.grid for custom query

2012-12-19 Thread Mandar Vaze


On Wednesday, December 19, 2012 3:24:31 PM UTC+5:30, Niphlod wrote:
>
> I can't reproduce the issue. 


I know it is a bit tough one. Even I too wasn't able to pinpoint the exact 
problem. I debugged till the dal.py as well. Not sure when does the 
db.commit() get called.
 

> Can you post a packed application showing the problem ? 


Can't. Anyway, I'm pasting some relevant code below. BTW, if it matters, I 
started the development with 2.0.x and upgrade just the web2py code to 
current stable release i.e. After I upgrade web2py I do not go by to my 
application and make any changes (like web2py.css or any other)

In a file under modules :

from gluon import current
import datetime

def modify_grid(grid, hide_adv_search=False,
bootstrap_pagination=False, rename_view_btn=False,
non_web2py_table=False):
T = current.T
if hide_adv_search:
# Remove Advanced Query Slideout
if len(grid.elements('input[id=web2py_keywords]')):
grid.elements('input[id=web2py_keywords]')[0]['_onfocus'] = ""


if bootstrap_pagination:
if len(grid.elements('.web2py_paginator')):
grid.elements('.web2py_paginator')[0]['_class'] = 'pagination'


if non_web2py_table:
if len(grid.elements('.web2py_table')):
grid.elements('.web2py_table')[0]['_class'] = \
'table table-striped'


if rename_view_btn:
# Change from "View" to "Details"
# When using Buttons
for btn in grid.elements('span'):
if btn['_title'] == "View":
btn['_title'] = T('Details')
for y in btn.elements():
y[0] = T("Details")


# When NOT using Buttons
for a in grid.elements('a[title=View]'):
a.elements()[0]['_title'] = T('Details')



Following are in same file under controllers:

def delete_record(table, record_id):
record = db(table[table._id.name] == record_id).select().first()
if 'name' in record:
print "User [%s] is Deleting [%s] from [%s]" % (auth.user.first_name
,
record['name'],table
)
else:
print "User [%s] is Deleting [%s] from [%s]" % (auth.user.first_name
,
record_id, table)
db(table[table._id.name] == record_id).delete()
db.commit()

@auth.requires_login()
@auth.requires_membership('some_role')
def my_method():
textlengths = {'table.column1': 100, 'table.column2': 60,
'table.column2': 60}
grid = SQLFORM.grid(db.table, user_signature=False, csv=False,
   ondelete=delete_record,
   maxtextlengths=textlengths, showbuttontext=False)
modify_grid(grid, hide_adv_search=True, bootstrap_pagination=True,
rename_view_btn=True, non_web2py_table=True)

return dict(grid=grid)

I hope this helps. As I mentioned in the bug report, the table has 
"db.table.id.readble=False" in models. But that conclusively did not tell 
me anything. But might help you.

-Mandar

-- 





[web2py] No module named plural_rules, end emtpy db in DAL connection

2012-12-19 Thread Kostas M
Trying to use DAL in my functional_tests.py (sitting in the application 
directory), I get the following warning:

In [1]: from gluon import DAL
WARNING:root:Unable to import plural rules: No module named plural_rules

Furthermore, the db seems to be empty, although it has proper tables, as 
seen by Sqliteman.
"test.sqlite" is a copy from the storage.sqlite 'normal' database.
For instance:

In [9]: db = DAL('sqlite://test.sqlite', folder='databases', 
migrate_enabled=False)

In [10]: db.tables
Out[10]: []

What am I doing wrong?

-- 





[web2py] Re: No module named plural_rules, end emtpy db in DAL connection

2012-12-19 Thread Niphlod
if you don't define table and you don't have auto_import=True, why are you 
expecting db.tables to show something ?

Il giorno mercoledì 19 dicembre 2012 15:11:51 UTC+1, Kostas M ha scritto:
>
> Trying to use DAL in my functional_tests.py (sitting in the application 
> directory), I get the following warning:
>
> In [1]: from gluon import DAL
> WARNING:root:Unable to import plural rules: No module named plural_rules
>
> Furthermore, the db seems to be empty, although it has proper tables, as 
> seen by Sqliteman.
> "test.sqlite" is a copy from the storage.sqlite 'normal' database.
> For instance:
>
> In [9]: db = DAL('sqlite://test.sqlite', folder='databases', 
> migrate_enabled=False)
>
> In [10]: db.tables
> Out[10]: []
>
> What am I doing wrong?
>

-- 





[web2py] Re: Webassets in web2py

2012-12-19 Thread Arnon Marcus
I'm starting to fall in love with TypeScript...

http://www.youtube.com/watch?v=3dqZW_DqHIQ

On Tuesday, December 18, 2012 1:21:33 AM UTC+2, Arnon Marcus wrote:
>
> That sounds very cool, thanks for the detailed answered, this makes my 
> head a little calmer now...
>
> BTW, I actually DID mean coffeCup, It refers to the python module that 
> does coffeeScript-to-javascript transipling.
>
> https://github.com/dsc/coffeecup
>
> Apparently, it also depends on node...
>
> Anyways, I think i'm sarting to lean more towards TypeScript anyways, so...
>
> On Monday, December 17, 2012 2:26:38 PM UTC-8, Niphlod wrote:
>>
>>
>>
>> On Monday, December 17, 2012 2:50:09 PM UTC+1, Arnon Marcus wrote:
>>>
>>> Holy shit...
>>>
>>> Where did you say you got all that info from?
>>
>>
>> quoted the link and scanning the source code 
>>  
>>
>>> Is this what that module needs?
>>>
>>> I thought it's just a stand-alone pythonic-module doing everything...
>>> Guess I was a bit optimistic...
>>>
>>> little bit too much :P
>>  
>>
>>> What about coffeeCup?
>>>
>>
>> meaning coffeescript ? 
>>  
>>
>>> - is it just something like "edit the less file in static/less/file.less 
>>> and have it recompiled as /static/css/file.css"
>>> Well, either that and/or sass/scss, as well as coffescript transpiling, 
>>> with optional minification/zipping for the resaulting js/css, yeah, 
>>> basically that.
>>>
>>
>> I'm not that much advanced, but as long as there is a "list of 
>> extensions" that follow the same rule, a contrib script continuosly 
>> checking for changed files is not hard to do.
>>  
>>
>>> But if there is ANY need for node.js in this kind of solution, than 
>>> forget it.
>>>
>>
>> I gave you the list of what webasset provide with python modules. I think 
>> the author researched a lot and resorted to external binaries only when 
>> needed  
>>
>> Is web2py minifying css/js scripts by default? If so, in what 
>>> circumstances? And since what version?
>>>
>>
>> nope. Web2py includes contrib.minify (containing jsmin and cssmin) that 
>> is activated by response.optimize_css and response.optimize_js . It's a 
>> feature I think since 1.99.7.
>>
>> Gzipping is not done within web2py. Usually that is something done only 
>> one-time-only before releasing to production and for that there is 
>> scripts/zip_static_files.py (meant to be run from shell as web2py.py -S 
>> yourapp -R scripts/zip_static_files.py). It creates automatically .gz files 
>> with the same mtime in order to be recognized as valid replacement by 
>> apache, nginx & co. Standalone web2py serves automatically gz files in the 
>> static folder with the same mtime without any configuration at all (meaning 
>> that a request for /app/static/js/jquery.js as long as there is a 
>> /app/static/js/jquery.js.gz with the same mtime will serve the gzipped one 
>> automatically)
>>
>>  
>>
>

-- 





Re: [web2py] how to cleanse field value

2012-12-19 Thread Vinicius Assef
Try a custom validator to sanitize your description field.


On Wed, Dec 19, 2012 at 12:06 PM, wwwgong  wrote:
> Hi,
> I like to store youtube videos into a table:
>
> db.define_table('youtube',
> Field('code'),
> Field('description')
> )
>
> def youtube_repr(code,width=400,height=250):
> return XML("""
> 
>  value="http://www.youtube.com/v/%(code)s&hl=en_US&fs=1&">
> 
> 
> http://www.youtube.com/v/%(code)s&hl=en_US&fs=1&"
> type="application/x-shockwave-flash" allowscriptaccess="always"
> allowfullscreen="true" width="%(width)s"
> height="%(height)s">
> """ % dict(code=code, width=width, height=height)
> )
>
> db.youtube.code.represent = youtube_repr
>
> with this controller:
> def youtube_video():
> form = SQLFORM.grid(db.youtube)
> return dict(form=form)
>
> If the "description" field contains double quote char {"}, it will messes
> up,
> see screenshot at
> http://dl.dropbox.com/u/54552252/cleanse-web2py-field-value.jpg
>
> I know web2py offers custom validator to detect special char in Form field,
> but is it possible to attach a pre-process function at DAL layer to cleanse
> field value before db operation?
>
> Something like:
>
> db.youtube.description.preprocess = cleanse_special_char
>
> where "cleanse_special_char" is a function to cleanse db.youtube.description
> field value
>
> Can someone offer a solution or workaround?
>
> Thanks,
> Wen
>
>
> --
>
>
>

-- 





Re: [web2py] Re: No module named plural_rules, end emtpy db in DAL connection

2012-12-19 Thread Vinicius Assef
In other words (concerning missing tables), you must have
define_table() calls or auto_import=True in your DAL instantiation.

Otherwise, your db object won't recognize your tables.



On Wed, Dec 19, 2012 at 12:43 PM, Niphlod  wrote:
> if you don't define table and you don't have auto_import=True, why are you
> expecting db.tables to show something ?
>
> Il giorno mercoledì 19 dicembre 2012 15:11:51 UTC+1, Kostas M ha scritto:
>>
>> Trying to use DAL in my functional_tests.py (sitting in the application
>> directory), I get the following warning:
>>
>> In [1]: from gluon import DAL
>> WARNING:root:Unable to import plural rules: No module named plural_rules
>>
>> Furthermore, the db seems to be empty, although it has proper tables, as
>> seen by Sqliteman.
>> "test.sqlite" is a copy from the storage.sqlite 'normal' database.
>> For instance:
>>
>> In [9]: db = DAL('sqlite://test.sqlite', folder='databases',
>> migrate_enabled=False)
>>
>> In [10]: db.tables
>> Out[10]: []
>>
>> What am I doing wrong?
>
> --
>
>
>

-- 





[web2py] Re: Edit or delete not committing in sqlform.grid for custom query

2012-12-19 Thread Niphlod

>
>
> Can't. Anyway, I'm pasting some relevant code below. BTW, if it matters, I 
> started the development with 2.0.x and upgrade just the web2py code to 
> current stable release i.e. After I upgrade web2py I do not go by to my 
> application and make any changes (like web2py.css or any other)

 
>
 
Really not relevant all the modify_grid() part. That doesn't belong to 
web2py, which you are addressing the bug to. 
Without the table model, all code is quite useless. We don't need your app. 
Just *an* app showing the problem.

As I mentioned in the bug report, the table has "db.table.id.readble=False" 
> in models
>

Setting table.id.readable = False works with grid (that fetches the id from 
the arguments)

-- 





[web2py] Re: help please

2012-12-19 Thread Niphlod
do you see them in appadmin ? if yes, then it's a no-issue: the data is 
there but I'm not sure what are you pointing to saying "*all my data (from 
other table views) disapears*" .

If it's not there in appadmin but you see the records on sqlite with some 
other tool, than you're app is using a different database than the one 
you're examining with the external tool. Appadmin lets you see all the 
records for all your defined tables, without filters.


Il giorno mercoledì 19 dicembre 2012 14:55:14 UTC+1, Aurelijus Useckas ha 
scritto:
>
> but I can see the records inside the storage.sqlite file, so they must be 
> accessible somehow
>
> On Wednesday, December 19, 2012 3:51:37 PM UTC+2, Niphlod wrote:
>>
>> I said *messed up* just to use part of your sentence.
>> With referenced table, if you used the default ondelete attribute of the 
>> field, every "child" record gets deleted as soon as the "parent" is deleted.
>> You can't fetch the data drom sqlite, it's definitely gone. For goods. 
>> The fact that the sqlite file is still "large" is because by default 
>> SQLite doesn't "release" the space: it keeps it for future records.
>>
>> On Wednesday, December 19, 2012 2:38:32 PM UTC+1, Aurelijus Useckas wrote:
>>>
>>> is there any way to extract data from sqlite? The file is still full of 
>>> data...
>>>
>>> I don't understand, if you delete somthing that is linked, everything 
>>> messes up?
>>>
>>> On Wednesday, December 19, 2012 3:34:31 PM UTC+2, Niphlod wrote:

 definitely messed up. no way they will "return back". That's why 
 referenced tables are for.

 Il giorno mercoledì 19 dicembre 2012 14:25:01 UTC+1, Aurelijus Useckas 
 ha scritto:
>
> i'm on SQLite
>
> On Wednesday, December 19, 2012 3:21:27 PM UTC+2, Aurelijus Useckas 
> wrote:
>>
>> I've deleted user information from auth_users and suddenly all my 
>> data (from other table views) disapears.. Yes, other tables are linked 
>> to 
>> this one. Specifically for info on updates and simillar...
>>
>> If I restore the same data in auth_users other table still doesn't 
>> show anything... I event reset the autoincrement and make it appear 
>> totally 
>> identical.. still nothing :(
>>
>> did i mess up??? :(
>>
>

-- 





[web2py] Re: Webassets in web2py

2012-12-19 Thread Niphlod
anoher node.js dependancy ^_^

Il giorno mercoledì 19 dicembre 2012 15:53:45 UTC+1, Arnon Marcus ha 
scritto:
>
> I'm starting to fall in love with TypeScript...
>
> http://www.youtube.com/watch?v=3dqZW_DqHIQ
>
> On Tuesday, December 18, 2012 1:21:33 AM UTC+2, Arnon Marcus wrote:
>>
>> That sounds very cool, thanks for the detailed answered, this makes my 
>> head a little calmer now...
>>
>> BTW, I actually DID mean coffeCup, It refers to the python module that 
>> does coffeeScript-to-javascript transipling.
>>
>> https://github.com/dsc/coffeecup
>>
>> Apparently, it also depends on node...
>>
>> Anyways, I think i'm sarting to lean more towards TypeScript anyways, 
>> so...
>>
>> On Monday, December 17, 2012 2:26:38 PM UTC-8, Niphlod wrote:
>>>
>>>
>>>
>>> On Monday, December 17, 2012 2:50:09 PM UTC+1, Arnon Marcus wrote:

 Holy shit...

 Where did you say you got all that info from?
>>>
>>>
>>> quoted the link and scanning the source code 
>>>  
>>>
 Is this what that module needs?

 I thought it's just a stand-alone pythonic-module doing everything...
 Guess I was a bit optimistic...

 little bit too much :P
>>>  
>>>
 What about coffeeCup?

>>>
>>> meaning coffeescript ? 
>>>  
>>>
 - is it just something like "edit the less file in 
 static/less/file.less and have it recompiled as /static/css/file.css"
 Well, either that and/or sass/scss, as well as coffescript transpiling, 
 with optional minification/zipping for the resaulting js/css, yeah, 
 basically that.

>>>
>>> I'm not that much advanced, but as long as there is a "list of 
>>> extensions" that follow the same rule, a contrib script continuosly 
>>> checking for changed files is not hard to do.
>>>  
>>>
 But if there is ANY need for node.js in this kind of solution, than 
 forget it.

>>>
>>> I gave you the list of what webasset provide with python modules. I 
>>> think the author researched a lot and resorted to external binaries only 
>>> when needed  
>>>
>>> Is web2py minifying css/js scripts by default? If so, in what 
 circumstances? And since what version?

>>>
>>> nope. Web2py includes contrib.minify (containing jsmin and cssmin) that 
>>> is activated by response.optimize_css and response.optimize_js . It's a 
>>> feature I think since 1.99.7.
>>>
>>> Gzipping is not done within web2py. Usually that is something done only 
>>> one-time-only before releasing to production and for that there is 
>>> scripts/zip_static_files.py (meant to be run from shell as web2py.py -S 
>>> yourapp -R scripts/zip_static_files.py). It creates automatically .gz files 
>>> with the same mtime in order to be recognized as valid replacement by 
>>> apache, nginx & co. Standalone web2py serves automatically gz files in the 
>>> static folder with the same mtime without any configuration at all (meaning 
>>> that a request for /app/static/js/jquery.js as long as there is a 
>>> /app/static/js/jquery.js.gz with the same mtime will serve the gzipped one 
>>> automatically)
>>>
>>>  
>>>
>>

-- 





Re: [web2py] Re: help please

2012-12-19 Thread Aurelijus
Thanks Niphlod for supporting me on this one.

The problem is that appadmin doesn't see any records but if I'm accessing
the same storage.sqlite db with VIM or even word processor, I can still see
all the data in there, it's just that something doesn't allow appadmin or
sqlite viewer to see it.. I wonder why and what possibly could be done..


On Wed, Dec 19, 2012 at 5:09 PM, Niphlod  wrote:

> do you see them in appadmin ? if yes, then it's a no-issue: the data is
> there but I'm not sure what are you pointing to saying "*all my data
> (from other table views) disapears*" .
>
> If it's not there in appadmin but you see the records on sqlite with some
> other tool, than you're app is using a different database than the one
> you're examining with the external tool. Appadmin lets you see all the
> records for all your defined tables, without filters.
>
>
> Il giorno mercoledì 19 dicembre 2012 14:55:14 UTC+1, Aurelijus Useckas ha
> scritto:
>
>> but I can see the records inside the storage.sqlite file, so they must be
>> accessible somehow
>>
>> On Wednesday, December 19, 2012 3:51:37 PM UTC+2, Niphlod wrote:
>>>
>>> I said *messed up* just to use part of your sentence.
>>> With referenced table, if you used the default ondelete attribute of the
>>> field, every "child" record gets deleted as soon as the "parent" is deleted.
>>> You can't fetch the data drom sqlite, it's definitely gone. For goods.
>>> The fact that the sqlite file is still "large" is because by default
>>> SQLite doesn't "release" the space: it keeps it for future records.
>>>
>>> On Wednesday, December 19, 2012 2:38:32 PM UTC+1, Aurelijus Useckas
>>> wrote:

 is there any way to extract data from sqlite? The file is still full of
 data...

 I don't understand, if you delete somthing that is linked, everything
 messes up?

 On Wednesday, December 19, 2012 3:34:31 PM UTC+2, Niphlod wrote:
>
> definitely messed up. no way they will "return back". That's why
> referenced tables are for.
>
> Il giorno mercoledì 19 dicembre 2012 14:25:01 UTC+1, Aurelijus Useckas
> ha scritto:
>>
>> i'm on SQLite
>>
>> On Wednesday, December 19, 2012 3:21:27 PM UTC+2, Aurelijus Useckas
>> wrote:
>>>
>>> I've deleted user information from auth_users and suddenly all my
>>> data (from other table views) disapears.. Yes, other tables are linked 
>>> to
>>> this one. Specifically for info on updates and simillar...
>>>
>>> If I restore the same data in auth_users other table still doesn't
>>> show anything... I event reset the autoincrement and make it appear 
>>> totally
>>> identical.. still nothing :(
>>>
>>> did i mess up??? :(
>>>
>>  --
>
>
>
>

-- 





Re: [web2py] Re: help please

2012-12-19 Thread Niphlod
did you try with some app that has sqlite support such as sqliteman or the 
sqlite3 command line ? I hardly doubt that if sqlite3 commandline can't 
fetch your records, what you're seeing with VIM is your actual records

Il giorno mercoledì 19 dicembre 2012 16:12:31 UTC+1, Aurelijus Useckas ha 
scritto:
>
> Thanks Niphlod for supporting me on this one. 
>
> The problem is that appadmin doesn't see any records but if I'm accessing 
> the same storage.sqlite db with VIM or even word processor, I can still see 
> all the data in there, it's just that something doesn't allow appadmin or 
> sqlite viewer to see it.. I wonder why and what possibly could be done..
>
>
> On Wed, Dec 19, 2012 at 5:09 PM, Niphlod  >wrote:
>
>> do you see them in appadmin ? if yes, then it's a no-issue: the data is 
>> there but I'm not sure what are you pointing to saying "*all my data 
>> (from other table views) disapears*" .
>>
>> If it's not there in appadmin but you see the records on sqlite with some 
>> other tool, than you're app is using a different database than the one 
>> you're examining with the external tool. Appadmin lets you see all the 
>> records for all your defined tables, without filters.
>>
>>
>> Il giorno mercoledì 19 dicembre 2012 14:55:14 UTC+1, Aurelijus Useckas ha 
>> scritto:
>>
>>> but I can see the records inside the storage.sqlite file, so they must 
>>> be accessible somehow
>>>
>>> On Wednesday, December 19, 2012 3:51:37 PM UTC+2, Niphlod wrote:

 I said *messed up* just to use part of your sentence.
 With referenced table, if you used the default ondelete attribute of 
 the field, every "child" record gets deleted as soon as the "parent" is 
 deleted.
 You can't fetch the data drom sqlite, it's definitely gone. For goods. 
 The fact that the sqlite file is still "large" is because by default 
 SQLite doesn't "release" the space: it keeps it for future records.

 On Wednesday, December 19, 2012 2:38:32 PM UTC+1, Aurelijus Useckas 
 wrote:
>
> is there any way to extract data from sqlite? The file is still full 
> of data...
>
> I don't understand, if you delete somthing that is linked, everything 
> messes up?
>
> On Wednesday, December 19, 2012 3:34:31 PM UTC+2, Niphlod wrote:
>>
>> definitely messed up. no way they will "return back". That's why 
>> referenced tables are for.
>>
>> Il giorno mercoledì 19 dicembre 2012 14:25:01 UTC+1, Aurelijus 
>> Useckas ha scritto:
>>>
>>> i'm on SQLite
>>>
>>> On Wednesday, December 19, 2012 3:21:27 PM UTC+2, Aurelijus Useckas 
>>> wrote:

 I've deleted user information from auth_users and suddenly all my 
 data (from other table views) disapears.. Yes, other tables are linked 
 to 
 this one. Specifically for info on updates and simillar...

 If I restore the same data in auth_users other table still doesn't 
 show anything... I event reset the autoincrement and make it appear 
 totally 
 identical.. still nothing :(

 did i mess up??? :(

>>>  -- 
>>  
>>  
>>  
>>
>
>

-- 





Re: [web2py] Re: help please

2012-12-19 Thread Aurelijus
I've tried Sqlite database browser. Same results.. but still it's strange,
records are really there


On Wed, Dec 19, 2012 at 5:22 PM, Niphlod  wrote:

> did you try with some app that has sqlite support such as sqliteman or the
> sqlite3 command line ? I hardly doubt that if sqlite3 commandline can't
> fetch your records, what you're seeing with VIM is your actual records
>
> Il giorno mercoledì 19 dicembre 2012 16:12:31 UTC+1, Aurelijus Useckas ha
> scritto:
>>
>> Thanks Niphlod for supporting me on this one.
>>
>> The problem is that appadmin doesn't see any records but if I'm accessing
>> the same storage.sqlite db with VIM or even word processor, I can still see
>> all the data in there, it's just that something doesn't allow appadmin or
>> sqlite viewer to see it.. I wonder why and what possibly could be done..
>>
>>
>> On Wed, Dec 19, 2012 at 5:09 PM, Niphlod  wrote:
>>
>>> do you see them in appadmin ? if yes, then it's a no-issue: the data is
>>> there but I'm not sure what are you pointing to saying "*all my data
>>> (from other table views) disapears*" .
>>>
>>> If it's not there in appadmin but you see the records on sqlite with
>>> some other tool, than you're app is using a different database than the one
>>> you're examining with the external tool. Appadmin lets you see all the
>>> records for all your defined tables, without filters.
>>>
>>>
>>> Il giorno mercoledì 19 dicembre 2012 14:55:14 UTC+1, Aurelijus Useckas
>>> ha scritto:
>>>
 but I can see the records inside the storage.sqlite file, so they must
 be accessible somehow

 On Wednesday, December 19, 2012 3:51:37 PM UTC+2, Niphlod wrote:
>
> I said *messed up* just to use part of your sentence.
> With referenced table, if you used the default ondelete attribute of
> the field, every "child" record gets deleted as soon as the "parent" is
> deleted.
> You can't fetch the data drom sqlite, it's definitely gone. For goods.
> The fact that the sqlite file is still "large" is because by default
> SQLite doesn't "release" the space: it keeps it for future records.
>
> On Wednesday, December 19, 2012 2:38:32 PM UTC+1, Aurelijus Useckas
> wrote:
>>
>> is there any way to extract data from sqlite? The file is still full
>> of data...
>>
>> I don't understand, if you delete somthing that is linked, everything
>> messes up?
>>
>> On Wednesday, December 19, 2012 3:34:31 PM UTC+2, Niphlod wrote:
>>>
>>> definitely messed up. no way they will "return back". That's why
>>> referenced tables are for.
>>>
>>> Il giorno mercoledì 19 dicembre 2012 14:25:01 UTC+1, Aurelijus
>>> Useckas ha scritto:

 i'm on SQLite

 On Wednesday, December 19, 2012 3:21:27 PM UTC+2, Aurelijus Useckas
 wrote:
>
> I've deleted user information from auth_users and suddenly all my
> data (from other table views) disapears.. Yes, other tables are 
> linked to
> this one. Specifically for info on updates and simillar...
>
> If I restore the same data in auth_users other table still doesn't
> show anything... I event reset the autoincrement and make it appear 
> totally
> identical.. still nothing :(
>
> did i mess up??? :(
>
  --
>>>
>>>
>>>
>>>
>>
>>  --
>
>
>
>

-- 





Re: [web2py] Re: No module named plural_rules, end emtpy db in DAL connection

2012-12-19 Thread Kostas M
Thank you both, for the heads up!

As Niphlod have said at:
https://groups.google.com/forum/#!searchin/web2py/auto_import=True/web2py/bwCYiQcE59I/D1IkGFC55eEJ
   * Remember that DAL does NOT introspect databases.*

Any hints on the Warning?




-- 





Re: [web2py] Re: new setup-web2py-nginx-uwsgi-ubuntu.sh

2012-12-19 Thread Paolo
Hi all, I've just tried to run the script on a VM (ubuntu 12.04.1). The 
compilation of uwsgi failed:

*** uWSGI linking ***

gcc -pthread -o /usr/local/bin/uwsgi  core/utils.o core/protocol.o 
core/socket.o core/logging.o core/master.o core/master_utils.o 
core/emperor.o core/notify.o core/mule.o core/subscription.o core/stats.o 
core/sendfile.o core/offload.o core/setup_utils.o core/clock.o core/init.o 
core/buffer.o core/plugins.o core/lock.o core/cache.o core/daemons.o 
core/queue.o core/event.o core/signal.o core/cluster.o core/rpc.o 
core/gateway.o core/loop.o lib/rbtree.o core/rb_timers.o core/uwsgi.o 
proto/base.o proto/uwsgi.o proto/http.o proto/fastcgi.o lib/linux_ns.o 
core/async.o core/ini.o core/yaml.o core/snmp.o core/xmlconf.o 
core/spooler.o plugins/python/python_plugin.o plugins/python/pyutils.o 
plugins/python/pyloader.o plugins/python/wsgi_handlers.o 
plugins/python/wsgi_headers.o plugins/python/wsgi_subhandler.o 
plugins/python/web3_subhandler.o plugins/python/pump_subhandler.o 
plugins/python/gil.o plugins/python/uwsgi_pymodule.o 
plugins/python/profiler.o plugins/python/symimporter.o 
plugins/python/tracebacker.o plugins/gevent/gevent.o 
plugins/ping/ping_plugin.o plugins/cache/cache.o plugins/nagios/nagios.o 
plugins/rrdtool/rrdtool.o plugins/carbon/carbon.o plugins/rpc/rpc_plugin.o 
plugins/corerouter/cr_common.o plugins/corerouter/cr_map.o 
plugins/corerouter/corerouter.o plugins/fastrouter/fastrouter.o 
plugins/http/http.o plugins/ugreen/ugreen.o plugins/signal/signal_plugin.o 
plugins/syslog/syslog_plugin.o plugins/rsyslog/rsyslog_plugin.o 
plugins/logsocket/logsocket_plugin.o plugins/router_uwsgi/router_uwsgi.o 
plugins/router_redirect/router_redirect.o 
plugins/router_basicauth/router_basicauth.o plugins/zergpool/zergpool.o 
plugins/redislog/redislog_plugin.o plugins/mongodblog/mongodblog_plugin.o 
plugins/router_rewrite/router_rewrite.o plugins/router_http/router_http.o 
plugins/logfile/logfile.o plugins/router_cache/router_cache.o 
plugins/rawrouter/rawrouter.o -lpthread -lm -rdynamic -ldl -lssl -lcrypto 
-L/usr/lib/x86_64-linux-gnu -lxml2 -lpthread -ldl -lutil -lm 
-L/usr/lib/python2.7/config -lpython2.7 -lcrypt

*** error linking uWSGI ***


Command /usr/bin/python -c "import 
setuptools;__file__='/tmp/pip-build/uwsgi/setup.py';exec(compile(open(__file__).read().replace('\r\n',
 
'\n'), __file__, 'exec'))" install --record 
/tmp/pip-lRnXgl-record/install-record.txt 
--single-version-externally-managed failed with error code 1 in 
/tmp/pip-build/uwsgi

Exception information:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/pip/basecommand.py", line 
107, in main
status = self.run(options, args)
  File "/usr/local/lib/python2.7/dist-packages/pip/commands/install.py", 
line 261, in run
requirement_set.install(install_options, global_options)
  File "/usr/local/lib/python2.7/dist-packages/pip/req.py", line 1166, in 
install
requirement.install(install_options, global_options)
  File "/usr/local/lib/python2.7/dist-packages/pip/req.py", line 589, in 
install
cwd=self.source_dir, filter_stdout=self._filter_install, 
show_stdout=False)
  File "/usr/local/lib/python2.7/dist-packages/pip/util.py", line 612, in 
call_subprocess
% (command_desc, proc.returncode, cwd))
InstallationError: Command /usr/bin/python -c "import 
setuptools;__file__='/tmp/pip-build/uwsgi/setup.py';exec(compile(open(__file__).read().replace('\r\n',
 
'\n'), __file__, 'exec'))" install --record 
/tmp/pip-lRnXgl-record/install-record.txt 
--single-version-externally-managed failed with error code 1 in 
/tmp/pip-build/uwsgi


Maybe something is missing?
Moreover, I don't like the fact that it tries to make a dist-upgrade

Regards, 
Paolo


On Wednesday, December 19, 2012 1:11:06 AM UTC+1, Arnon Marcus wrote:
>
> Hey guys, I'm also using web2py and redmine, and was concidering moving 
> it into a linux-based VM and running it with nginx. Good to know your on 
> it. Keep up the good work - I'm a neub in linux-land...
>
> Couple of questions:
> 1. Are you using postgreSQL in this thing?
> 2. How can one replicate your achievement ones it works?
> 3. I saw that BitNami has an ubuntu image of RedMine with MySQL with 
> optionally choosing nginex as the web-server, and also a PostgreSQL 
> plugin for these stacks (they also have a "Redmine on Postgres" stack, if I 
> remember, but I think that combination doesn't exist for the ubuntu-image 
> flavor, oddly enough...). Can that be used as a base for your configuration 
> for integrating web2py support on-top of it?
>
> On Tuesday, December 18, 2012 6:23:18 AM UTC-8, Richard wrote:
>>
>> I will, when I finish my research.
>>
>> I am planning to write a slice about deployment of Redmine beside Web2py 
>> with Nginx. So until I finish my Nginx config in case I found other tweaks, 
>> I wait for testing the script again. But I have a fresh VM in place that I 
>> can clone rapidly to 

[web2py] Re: help please

2012-12-19 Thread Mark
Do you have any kind of backup files for the database? Or, do your 
server/computer backup daily or weekly? If there are any backup files, you 
can restore the deleted data easily.

Mark 

On Wednesday, December 19, 2012 8:21:27 AM UTC-5, Aurelijus Useckas wrote:
>
> I've deleted user information from auth_users and suddenly all my data 
> (from other table views) disapears.. Yes, other tables are linked to this 
> one. Specifically for info on updates and simillar...
>
> If I restore the same data in auth_users other table still doesn't show 
> anything... I event reset the autoincrement and make it appear totally 
> identical.. still nothing :(
>
> did i mess up??? :(
>

-- 





[web2py] impersonate and 2.3.2

2012-12-19 Thread Martin Weissenboeck
@auth.requires_login()
@auth.requires_permission('impersonate','auth_user')
def imitieren_id():
auth.impersonate(request.args[0])
redirect(URL('index'))

This is the function "imitieren_id" for impersonate. I think (but I am not
sure) yesterday there has been no problem, but today (after updating to
2.3.2) I get:

1.
2.

3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.


Traceback (most recent call last):
  File "H:\\web2py\gluon\restricted.py", line 212, in restricted

exec ccode in environment
  File "H:/web2py/applications/bewerbung/controllers/default.py"
,
line 1291, in 

  File "H:\web2py\gluon\globals.py", line 193, in 

self._caller = lambda f: f()

  File "H:\web2py\gluon\tools.py", line 2929, in f

return action(*a, **b)

  File "H:\web2py\gluon\tools.py", line 2929, in f

return action(*a, **b)

  File "H:/web2py/applications/bewerbung/controllers/default.py"
,
line 124, in imitieren_id

auth.impersonate(request.args[0])

  File "H:\\web2py\gluon\tools.py", line 2830, in impersonate

for callback in self.settings.login_onaccept:
TypeError: 'function' object is not iterable



Regards, Martin

-- 





Re: [web2py] Re: help please

2012-12-19 Thread Aurelijus
Yeah I know.. I have an old backup only :( me bad


On Wed, Dec 19, 2012 at 5:51 PM, Mark  wrote:

> Do you have any kind of backup files for the database? Or, do your
> server/computer backup daily or weekly? If there are any backup files, you
> can restore the deleted data easily.
>
> Mark
>
>
> On Wednesday, December 19, 2012 8:21:27 AM UTC-5, Aurelijus Useckas wrote:
>>
>> I've deleted user information from auth_users and suddenly all my data
>> (from other table views) disapears.. Yes, other tables are linked to this
>> one. Specifically for info on updates and simillar...
>>
>> If I restore the same data in auth_users other table still doesn't show
>> anything... I event reset the autoincrement and make it appear totally
>> identical.. still nothing :(
>>
>> did i mess up??? :(
>>
>  --
>
>
>
>

-- 





Re: [web2py] Re: help please

2012-12-19 Thread Paolo Caruccio
Mine is a very stupid question but sometime...

Is there an "active" field in your db tables? 

Il giorno mercoledì 19 dicembre 2012 16:54:50 UTC+1, Aurelijus Useckas ha 
scritto:
>
> Yeah I know.. I have an old backup only :( me bad
>
>
> On Wed, Dec 19, 2012 at 5:51 PM, Mark >wrote:
>
>> Do you have any kind of backup files for the database? Or, do your 
>> server/computer backup daily or weekly? If there are any backup files, you 
>> can restore the deleted data easily.
>>
>> Mark 
>>
>>
>> On Wednesday, December 19, 2012 8:21:27 AM UTC-5, Aurelijus Useckas wrote:
>>>
>>> I've deleted user information from auth_users and suddenly all my data 
>>> (from other table views) disapears.. Yes, other tables are linked to this 
>>> one. Specifically for info on updates and simillar...
>>>
>>> If I restore the same data in auth_users other table still doesn't show 
>>> anything... I event reset the autoincrement and make it appear totally 
>>> identical.. still nothing :(
>>>
>>> did i mess up??? :(
>>>
>>  -- 
>>  
>>  
>>  
>>
>
>

-- 





Re: [web2py] Re: help please

2012-12-19 Thread LightDot
First, make a couple of physical copies of the database and do not write 
into it anymore. Then, working on a copy, you could try restoring / 
extracting the data by using forensic tools, etc.

I'm not aware of a straightforward sqlite restore tool, but there might be 
one or two out there... I'm sure you're not the first to have such an issue.

I guess it comes down to the question of is it worth the time and effort.

Regards,
Ales


On Wednesday, December 19, 2012 4:54:50 PM UTC+1, Aurelijus Useckas wrote:
>
> Yeah I know.. I have an old backup only :( me bad
>
>
> On Wed, Dec 19, 2012 at 5:51 PM, Mark >wrote:
>
>> Do you have any kind of backup files for the database? Or, do your 
>> server/computer backup daily or weekly? If there are any backup files, you 
>> can restore the deleted data easily.
>>
>> Mark 
>>
>>
>> On Wednesday, December 19, 2012 8:21:27 AM UTC-5, Aurelijus Useckas wrote:
>>>
>>> I've deleted user information from auth_users and suddenly all my data 
>>> (from other table views) disapears.. Yes, other tables are linked to this 
>>> one. Specifically for info on updates and simillar...
>>>
>>> If I restore the same data in auth_users other table still doesn't show 
>>> anything... I event reset the autoincrement and make it appear totally 
>>> identical.. still nothing :(
>>>
>>> did i mess up??? :(
>>>
>>  -- 
>>  
>>  
>>  
>>
>
>

-- 





Re: [web2py] Re: new setup-web2py-nginx-uwsgi-ubuntu.sh

2012-12-19 Thread Richard Vézina
@Paolo, I don't see dist-upgrade anymore you should have a wrong version
look at the drop box of Simone Niphold :
https://www.dropbox.com/s/n7chteos9sh6p2h/setup-web2py-nginx-uwsgi-ubuntu.sh

@Arnon, I don't know bitnami I heard about, but didn't have a look, but I
guest it will not works because ubuntu nginx package doesn'st include
passenger module support, so we have to compile nginx because it is not
modular as apache. Actually I found a PPA, but I am not sure if it will be
maintained for a wild, so I use a script include in ruby to automated the
configuration, compilation and installation of an appropriate version of
nginx... I am in the process of writing a tutorial about that. I will
inform the list here when it done and publish. Notice, someone could just
use FastCGI instead of uWSGI and Phussion Passenger in tamdem to serve the
web2py apps and Redmine together with Nginx, but I prefer using uWSGI.
Also, recently Phussion project report to be polyglot and say that
Passenger can handle both WSGI (Python) and Ruby at the same time, but I
don't know if it could work with uWSGI... Anyway. As soon as I get my
tutorial ready, I get back here.

@Simone, an other improvement to the script could be to combine into a
single server the 80, and 443 to avoid duplicating configuration, as stated
here :
http://nginx.org/en/docs/http/configuring_https_servers.html#single_http_https_server
I don't had test this.

Also, here the code for permanent redirection
server {
  server_name $hostname;
  listen  80;
  return 301 http*s*://$hostname$request_uri; # NOTE: I am not sure for
$hostname here, because I didn't set hostname for my VM until now, as in
the example (URL below) we can use domainName.com instead if properly
configure in nginx
...
}

In accordance with the pitfalls page suggested best practice :
http://wiki.nginx.org/Pitfalls#Taxing_Rewrites


Richard






On Wed, Dec 19, 2012 at 10:45 AM, Paolo  wrote:

> Hi all, I've just tried to run the script on a VM (ubuntu 12.04.1). The
> compilation of uwsgi failed:
>
> *** uWSGI linking ***
>
> gcc -pthread -o /usr/local/bin/uwsgi  core/utils.o core/protocol.o
> core/socket.o core/logging.o core/master.o core/master_utils.o
> core/emperor.o core/notify.o core/mule.o core/subscription.o core/stats.o
> core/sendfile.o core/offload.o core/setup_utils.o core/clock.o core/init.o
> core/buffer.o core/plugins.o core/lock.o core/cache.o core/daemons.o
> core/queue.o core/event.o core/signal.o core/cluster.o core/rpc.o
> core/gateway.o core/loop.o lib/rbtree.o core/rb_timers.o core/uwsgi.o
> proto/base.o proto/uwsgi.o proto/http.o proto/fastcgi.o lib/linux_ns.o
> core/async.o core/ini.o core/yaml.o core/snmp.o core/xmlconf.o
> core/spooler.o plugins/python/python_plugin.o plugins/python/pyutils.o
> plugins/python/pyloader.o plugins/python/wsgi_handlers.o
> plugins/python/wsgi_headers.o plugins/python/wsgi_subhandler.o
> plugins/python/web3_subhandler.o plugins/python/pump_subhandler.o
> plugins/python/gil.o plugins/python/uwsgi_pymodule.o
> plugins/python/profiler.o plugins/python/symimporter.o
> plugins/python/tracebacker.o plugins/gevent/gevent.o
> plugins/ping/ping_plugin.o plugins/cache/cache.o plugins/nagios/nagios.o
> plugins/rrdtool/rrdtool.o plugins/carbon/carbon.o plugins/rpc/rpc_plugin.o
> plugins/corerouter/cr_common.o plugins/corerouter/cr_map.o
> plugins/corerouter/corerouter.o plugins/fastrouter/fastrouter.o
> plugins/http/http.o plugins/ugreen/ugreen.o plugins/signal/signal_plugin.o
> plugins/syslog/syslog_plugin.o plugins/rsyslog/rsyslog_plugin.o
> plugins/logsocket/logsocket_plugin.o plugins/router_uwsgi/router_uwsgi.o
> plugins/router_redirect/router_redirect.o
> plugins/router_basicauth/router_basicauth.o plugins/zergpool/zergpool.o
> plugins/redislog/redislog_plugin.o plugins/mongodblog/mongodblog_plugin.o
> plugins/router_rewrite/router_rewrite.o plugins/router_http/router_http.o
> plugins/logfile/logfile.o plugins/router_cache/router_cache.o
> plugins/rawrouter/rawrouter.o -lpthread -lm -rdynamic -ldl -lssl -lcrypto
> -L/usr/lib/x86_64-linux-gnu -lxml2 -lpthread -ldl -lutil -lm
> -L/usr/lib/python2.7/config -lpython2.7 -lcrypt
>
> *** error linking uWSGI ***
>
> 
> Command /usr/bin/python -c "import
> setuptools;__file__='/tmp/pip-build/uwsgi/setup.py';exec(compile(open(__file__).read().replace('\r\n',
> '\n'), __file__, 'exec'))" install --record
> /tmp/pip-lRnXgl-record/install-record.txt
> --single-version-externally-managed failed with error code 1 in
> /tmp/pip-build/uwsgi
>
> Exception information:
> Traceback (most recent call last):
>   File "/usr/local/lib/python2.7/dist-packages/pip/basecommand.py", line
> 107, in main
> status = self.run(options, args)
>   File "/usr/local/lib/python2.7/dist-packages/pip/commands/install.py",
> line 261, in run
> requirement_set.install(install_options, global_options)
>   File "/usr/local/lib/python2.7/dist-packages/pip/req.py", line 1166, in
> in

[web2py] Re: default/user/profile onaccept ?

2012-12-19 Thread Annet
Massimo,

Thanks for your reply, problem solved.


Kind regards,

Annet

-- 





Re: [web2py] Re: Edit or delete not committing in sqlform.grid for custom query

2012-12-19 Thread Mandar Vaze / मंदार वझे
I know it is a tough one, but can you guess what "could" be the problem ?
As I mentioned, "explicitly" adding db.commit() helps "resolve" the problem
(Whether in gluon/sqlhtml.py or separately in my custom ondelete)

Does that give you any hints ? I debugged but (obviously) couldn't find the
culprit.

Any pointers on how to troubleshoot/debug this ? I think at least one more
person has similar problem (One that started this thread)


> Really not relevant all the modify_grid() part. That doesn't belong to
> web2py, which you are addressing the bug to.
>

I know. But it was something different - so I thought it may be relevant.


> Without the table model, all code is quite useless. We don't need your
> app. Just *an* app showing the problem.
>

Ahh, I see. Let me try to create that (app)

-Mandar

-- 





[web2py] Re: Webassets in web2py

2012-12-19 Thread Arnon Marcus
Hmmm, not exactly.

You CAN use node for/with it, but there are also IDE plugins.
I'm using Visual Studio 2012 (trial) and it compiles-on-save automatically, 
with a side-by-side updating javascript target file view. that is being 
generated as I save.
All the material needed to make such a plugin for any other IDE is 
open-sourced, and does not NEED node.js to work at all...
It even minimizes my files for me as well (generates another *-min.js file).
I can even configure the compiler in the IDE to also auto-generate 
source-maps as it auto-compiles-on-save.
This is just another option in the options window of VS, that gets added 
when I install the "web-essentials" extension of VS.
This is a huge extension, that also provides auto-compilation of 
LESS-to-CSS files, and also minifiezes the resulting CSS files as well

In a nut-shell:

Visual Studio 2012 + TypeScript (plugin) + Web-Essentials (extension) = 
Auto-Compilation/Source-Map-Generation/Minification of 
TypeScript->JavaScript + LESS->CSS
:)
All this with ZERO dependencies and without node.js
:) :)
And I can now debug in Chrome using the original TypeScript files 
themselves, using the auto-generated-source-maps-on-save, via the "Use 
Source Maps" feature in chrome.
:) :) :)
I can also use use the LESS files in chrome, by using the "Support for 
SASS" feature.
:) :) :) :)
Adding the LivePage (auto-reload) chrome-extension rounds up the 
real-time-feedback-with-transipling experience.
:) :) :) :) :)
All the above, without web2py or node.js (!)

Here is a better video-presentation for TypeScript:
http://channel9.msdn.com/posts/Anders-Hejlsberg-Introducing-TypeScript

Here is how Source-Maps work:
http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/

LivePage extension:
https://chrome.google.com/webstore/detail/livepage/pilnojpmdoofaelbinaeodfpjheijkbh?hl=en

On Wednesday, December 19, 2012 5:12:26 PM UTC+2, Niphlod wrote:
>
> anoher node.js dependancy ^_^
>
> Il giorno mercoledì 19 dicembre 2012 15:53:45 UTC+1, Arnon Marcus ha 
> scritto:
>>
>> I'm starting to fall in love with TypeScript...
>>
>> http://www.youtube.com/watch?v=3dqZW_DqHIQ
>>
>> On Tuesday, December 18, 2012 1:21:33 AM UTC+2, Arnon Marcus wrote:
>>>
>>> That sounds very cool, thanks for the detailed answered, this makes my 
>>> head a little calmer now...
>>>
>>> BTW, I actually DID mean coffeCup, It refers to the python module that 
>>> does coffeeScript-to-javascript transipling.
>>>
>>> https://github.com/dsc/coffeecup
>>>
>>> Apparently, it also depends on node...
>>>
>>> Anyways, I think i'm sarting to lean more towards TypeScript anyways, 
>>> so...
>>>
>>> On Monday, December 17, 2012 2:26:38 PM UTC-8, Niphlod wrote:



 On Monday, December 17, 2012 2:50:09 PM UTC+1, Arnon Marcus wrote:
>
> Holy shit...
>
> Where did you say you got all that info from?


 quoted the link and scanning the source code 
  

> Is this what that module needs?
>
> I thought it's just a stand-alone pythonic-module doing everything...
> Guess I was a bit optimistic...
>
> little bit too much :P
  

> What about coffeeCup?
>

 meaning coffeescript ? 
  

> - is it just something like "edit the less file in 
> static/less/file.less and have it recompiled as /static/css/file.css"
> Well, either that and/or sass/scss, as well as coffescript 
> transpiling, with optional minification/zipping for the resaulting 
> js/css, 
> yeah, basically that.
>

 I'm not that much advanced, but as long as there is a "list of 
 extensions" that follow the same rule, a contrib script continuosly 
 checking for changed files is not hard to do.
  

> But if there is ANY need for node.js in this kind of solution, than 
> forget it.
>

 I gave you the list of what webasset provide with python modules. I 
 think the author researched a lot and resorted to external binaries only 
 when needed  

 Is web2py minifying css/js scripts by default? If so, in what 
> circumstances? And since what version?
>

 nope. Web2py includes contrib.minify (containing jsmin and cssmin) that 
 is activated by response.optimize_css and response.optimize_js . It's a 
 feature I think since 1.99.7.

 Gzipping is not done within web2py. Usually that is something done only 
 one-time-only before releasing to production and for that there is 
 scripts/zip_static_files.py (meant to be run from shell as web2py.py -S 
 yourapp -R scripts/zip_static_files.py). It creates automatically .gz 
 files 
 with the same mtime in order to be recognized as valid replacement by 
 apache, nginx & co. Standalone web2py serves automatically gz files in the 
 static folder with the same mtime without any configuration at all 
 (meaning 
 that a request for /app/static/js/jquery.js as long as there is

[web2py] Re: Login manually

2012-12-19 Thread Massimo Di Pierro
Can you please show me the complete traceback?
I cannot reproduce this and I this error is not generated from a web2py 
function.

On Tuesday, 18 December 2012 11:11:51 UTC-6, Massimo Di Pierro wrote:
>
> Can I see you models? Are you changing the validator for 
> db.auth_user.password?
> Your error says:
>
>  unsupported hash type 
> |pbkdf2(1000,20,sha512)
>
> I do not understand where | in  |pbkdf2 would come from.
>
>
> On Tuesday, 18 December 2012 09:33:12 UTC-6, Wonton wrote:
>>
>> Hi Massimo!!
>>
>> I'm using version 2.2.1 (2012-10-21 16:57:04) stable. I dowloaded it last 
>> week.
>>
>> El martes, 18 de diciembre de 2012 16:26:29 UTC+1, Massimo Di Pierro 
>> escribió:
>>>
>>> Which web2py version? The error suggests you are using an older web2py 
>>> version with newly created database of records.
>>>
>>> Massimo
>>>
>>> On Monday, 17 December 2012 14:59:02 UTC-6, Wonton wrote:

 Hello everyone,

 I'm developing a backend site with web2py. I have 2 web services, one 
 to register a user and a second one to login the user.
 This is the first one:

 def register(user, email, password):
  db.auth_user.insert(username=user, email=email, 
 password=db.auth_user.password.validate(password)) 
 ...
  return 'OK'

 It's working ok and the users are created without problem.

 This is the second one:

 def login(user, password):
 response = auth.login_bare(user, password)
  if not response:
 message = 'Error'
 else:
  message = 'OK'
return message

 With this service I have the following error:
  unsupported hash type 
 |pbkdf2(1000,20,sha512)

 I've tried to find any solution to this problem without success.

 Any of you has any idea of what is happening?

 Thank you very much and kind regards!

 Wonton

>>>

-- 





[web2py] Re: Customizing auth login form but unable to set the form class name

2012-12-19 Thread Anthony
form['_class'] = 'myclass'

or

form.update(_class='myclass')

A form is an HTML helper object, just like any other HTML helper, so the 
usual rules apply: 
http://web2py.com/books/default/chapter/29/05#HTML-helpers

Anthony

On Tuesday, December 18, 2012 11:33:32 PM UTC-5, Bhaskar Ramachandran wrote:
>
> As listed in the "view" code below, i am trying to customize the form 
> returned by auth.login(). Note that i have in my controller "return 
> dict(form=auth.login()). Then in the view code pasted below i am 
> customizing the login form.
> It seems to work fine except that i am unable to assign a class name to 
> this form. So my question is " How to set the class name for a form object 
> ?. There are posts in the mailing list to specify class name for elements 
> within the form object but i couldn't find one that explains how the class 
> name for the form object itself can be assinged. 
> Please let me know if my question needs more explanation. Thank you.
>   {{
> if not auth.is_logged_in() :
>   if not 'register' in auth.settings.
> actions_disabled:
>form.add_button(T('Register'),URL(args=
> 'register'),_class='btn')
>pass
>if not 'request_reset_password' in auth
> .settings.actions_disabled:
>  form.add_button(T('Lost Password'),
> URL(args='request_reset_password'),_class='btn')
> pass 
>  }}
> 
> {{=form.custom.begin}}
> "/myscienceapp/default/register?_next=/default/index" style="margin-right: 
> 10px">Sign Up
>   
>   class="input-small" style="margin-right: 5px; border-radius: 5px 5px 5px 
> 5px;" type="text" name="email" placeholder="Email"/>
>  ="margin-right: 2px; border-radius: 5px 5px 5px 5px;" type="password" name
> ="password" placeholder="Password"/>
>style="margin-right: 
> 5px; margin-bottom: 0px;border-radius: 5px 5px 5px 5px;" size="5" type=
> "submit" name="commit" value="Go!" />
> style="margin-right: 
> 5px; margin-bottom: 16px;" type="checkbox" name="remember" value="1" />
>style="margin-right: 
> 10px;" for="user_remember_me">Remember me
>   Forgot? 
>  
>  {{=form.custom.end}}
>
>  {{form.element('div').parent['_class']='navbar-form pull-right 
> form-inline'}}
> 
> {{pass}}
>   
>
>

-- 





[web2py] Re: The book updates and status

2012-12-19 Thread Massimo Di Pierro
It would help me if people could add to this thread some comments about:
- what needs clarification?
- what is poorly undocumented?
- what do you expect in the 5th edition?
Please when making comments refers to the online english version.

Massimo

On Wednesday, 19 December 2012 03:11:37 UTC-6, Andrew W wrote:
>
> Just checking in on how the 5th edition is going ?
> Thanks
>
> On Thursday, November 29, 2012 11:58:29 PM UTC+13, Kostas M wrote:
>>
>> I have bought the (printed) web2py book (editions 3rd and 4th) from Lulu, 
>> and my note is that the black & white printouts are much less attractive 
>> from
>> the web css book layout. The coloring helps understanding the syntax as 
>> well. I wish the printed book could look as nice as the web version...
>> I once printed some chapters in a color printer to have this nice layout. 
>> Couldn't the Lulu book follow a better printing style?
>>
>> Kostas
>>
>> On Wednesday, November 28, 2012 7:08:48 PM UTC, Massimo Di Pierro wrote:
>>>
>>> Almost everything is documented except: 1) auth.wiki; 2) some of the new 
>>> grid parameters.
>>>
>>> Along with these changes I am planning some minor book refactoring 
>>> before publishing to 5th edition.
>>>
>>> Massimo
>>>

>>

-- 





[web2py] Re: change id?

2012-12-19 Thread Massimo Di Pierro
Even if possible this may break web2py.

On Wednesday, 19 December 2012 06:00:35 UTC-6, Aurelijus Useckas wrote:
>
> is it possible to change row id or null it so it starts sequential counting 
> starting from 0?
>
> thank you
>

-- 





Re: [web2py] Re: No module named plural_rules, end emtpy db in DAL connection

2012-12-19 Thread Massimo Di Pierro
The warning comes from the internationalization. By importing from gluon it 
expects that you are in the web2py folder and it will try preload 
pluralization rules.

Try instead:

from gluon.dal import DAL, Field

On Wednesday, 19 December 2012 09:27:51 UTC-6, Kostas M wrote:
>
> Thank you both, for the heads up!
>
> As Niphlod have said at:
>
> https://groups.google.com/forum/#!searchin/web2py/auto_import=True/web2py/bwCYiQcE59I/D1IkGFC55eEJ
>* Remember that DAL does NOT introspect databases.*
>
> Any hints on the Warning?
>
>
>
>
>

-- 





[web2py] Re: impersonate and 2.3.2

2012-12-19 Thread Massimo Di Pierro
Fixed in trunk. Please check it.

On Wednesday, 19 December 2012 09:52:52 UTC-6, mweissen wrote:
>
> @auth.requires_login()
> @auth.requires_permission('impersonate','auth_user')
> def imitieren_id():
> auth.impersonate(request.args[0])
> redirect(URL('index'))
>
> This is the function "imitieren_id" for impersonate. I think (but I am not 
> sure) yesterday there has been no problem, but today (after updating to 
> 2.3.2) I get:
>
>
>
> 1.
> 2.
>
>
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
> 13.
> 14.
> 15.
> 16.
>
> Traceback (most recent call last):
>   File "H:\\web2py\gluon\restricted.py", line 212, in restricted
>
>
> exec ccode in environment
>   File "H:/web2py/applications/bewerbung/controllers/default.py" 
> , 
> line 1291, in 
>
>
>   File "H:\web2py\gluon\globals.py", line 193, in 
>
>
> self._caller = lambda f: f()
>
>
>   File "H:\web2py\gluon\tools.py", line 2929, in f
>
>
> return action(*a, **b)
>
>
>   File "H:\web2py\gluon\tools.py", line 2929, in f
>
>
> return action(*a, **b)
>
>
>   File "H:/web2py/applications/bewerbung/controllers/default.py" 
> , 
> line 124, in imitieren_id
>
>
> auth.impersonate(request.args[0])
>
>
>   File "H:\\web2py\gluon\tools.py", line 2830, in impersonate
>
>
> for callback in self.settings.login_onaccept:
>
> TypeError: 'function' object is not iterable
>
>
> Regards, Martin
>
>
>
>
>

-- 





Re: [web2py] Re: REF: SQLFORM.grid column width and content length

2012-12-19 Thread Teddy Nyambe
Can you show an example on how that dictionary is passed to the grid?
On Dec 19, 2012 3:18 PM, "Niphlod"  wrote:

> By default, maxtextlength is 20. maxtextlength=150 will truncate all
> columns only if they are longer than 150 chars.
>
> maxtextlength*s* instead allows to pass a dictionary of
> {'tablename.field' : length} to set this limit for every column.
>
>
> Il giorno mercoledì 19 dicembre 2012 13:24:04 UTC+1, software.ted ha
> scritto:
>>
>> Hi,
>>
>> I have noticed SQLFORM.grid column content is not wraping if its long
>> instead the content is cut and three dots (...) are appended to the
>> content. How do i allow more text to be displayed or adjust the width of
>> the grid?
>>
>> Teddy L.
>>
>  --
>
>
>
>

-- 





[web2py] Re: Login manually

2012-12-19 Thread Wonton
Yes, of course. This is my ticket:

Error ticket for "dianaappv1" Ticket ID 

127.0.0.1.2012-12-19.18-24-12.5d2b292c-7e9a-4281-a9f7-bb9aa17bbd0c
 unsupported hash type |pbkdf2(1000,20,sha512) 
Versión  web2py™ (2, 2, 1, datetime.datetime(2012, 10, 21, 16, 57, 4), 
'stable')  Python Python 2.7.1: /usr/bin/python  Traceback 

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.

Traceback (most recent call last):
  File "/Applications/web2py/gluon/restricted.py", line 212, in restricted
exec ccode in environment
  File "/Applications/web2py/applications/dianaappv1/controllers/default.py" 
, 
line 101, in 
  File "/Applications/web2py/gluon/globals.py", line 188, in 
self._caller = lambda f: f()
  File "/Applications/web2py/applications/dianaappv1/controllers/default.py" 
, 
line 27, in public_call
return servicios_publicos()
  File "/Applications/web2py/gluon/tools.py", line 4387, in __call__
return self.serve_json(request.args[1:])
  File "/Applications/web2py/gluon/tools.py", line 4197, in serve_json
s = universal_caller(self.json_procedures[args[0]], *args[1:], **d)
  File "/Applications/web2py/gluon/tools.py", line 3889, in universal_caller
return f(**arg_dict)
  File "/Applications/web2py/applications/dianaappv1/controllers/default.py" 
, 
line 65, in login
user = auth.login_bare(usuario, password)
  File "/Applications/web2py/gluon/tools.py", line 1789, in login_bare
if not user.registration_key and password == user[passfield]:
  File "/Applications/web2py/gluon/validators.py", line 2636, in __eq__
h = simple_hash(self.password, key, salt, digest_alg)
  File "/Applications/web2py/gluon/utils.py", line 74, in simple_hash
h = hashlib.new(digest_alg)
  File 
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py",
 line 121, in __hash_new
return __get_builtin_constructor(name)(string)
  File 
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py",
 line 88, in __get_builtin_constructor
raise ValueError('unsupported hash type %s' % name)
ValueError: unsupported hash type |pbkdf2(1000,20,sha512)

 Error snapshot [image: help]  

(unsupported hash type 
|pbkdf2(1000,20,sha512)) 

inspect attributes 
 Frames 
   
   -  
   
   *File /Applications/web2py/gluon/restricted.py in restricted at line 212* 
   código argumentos variables 
-  
   
   *File 
   /Applications/web2py/applications/dianaappv1/controllers/default.py in 
at line 101* código argumentos variables 
-  
   
   *File /Applications/web2py/gluon/globals.py in  at line 188* 
   código argumentos variables 
-  
   
   *File 
   /Applications/web2py/applications/dianaappv1/controllers/default.py in 
   public_call at line 27* código argumentos variables 
-  
   
   *File /Applications/web2py/gluon/tools.py in __call__ at line 4387* 
   código argumentos variables 
-  
   
   *File /Applications/web2py/gluon/tools.py in serve_json at line 4197* 
   código argumentos variables 
-  
   
   *File /Applications/web2py/gluon/tools.py in universal_caller at line 
   3889* código argumentos variables 
-  
   
   *File 
   /Applications/web2py/applications/dianaappv1/controllers/default.py in 
   login at line 65* código argumentos variables 
-  
   
   *File /Applications/web2py/gluon/tools.py in login_bare at line 1789* 
   código argumentos variables 
-  
   
   *File /Applications/web2py/gluon/validators.py in __eq__ at line 2636* 
   código argumentos variables 
-  
   
   *File /Applications/web2py/gluon/utils.py in simple_hash at line 74* 
   código argumentos variables 
-  
   
   *File 
   
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py
 
   in __hash_new at line 121* código argumentos variables 
-  
   
   *File 
   
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py
 
   in __get_builtin_constructor at line 88* código argumentos variables 
Function argument list 
   
   (name='|pbkdf2(1000,20,sha512)')
Code listing 
   
   83.
   84.
   85.
   86.
   87.
   88.
   
   89.
   90.
   91.
   92.
   
   if bs == '512':
   return _sha512.sha512
   elif bs == '384':
   return _sha512.sha384
   
   raise ValueError('unsupported hash type %s' % name)
   
   
   
   def __get_openssl_constructor(name):
   try:
   
Variables  name '|pbkdf2(1000,20,sha512)'  builtinValueError   

 Context 

locals request session response 
 In file: 
/Applications/web2py/applications/dianaappv1/controllers/default.py 

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28

[web2py] edit a record does not show uploaded files

2012-12-19 Thread António Ramos
hello this is my controller

def edittrab():
record = db.trabalhador(request.args(0)) or redirect(URL('index'))
form = SQLFORM(db.trabalhador, record)
if form.accepts(request.vars, session):
response.flash = 'registo actualizado com sucesso'
redirect(URL())
elif form.errors:
response.flash = 'erros detectados'
return dict(form=form)


my view

{{extend 'layout.html'}}

{{=form}}

my upload fields do no show the link to the file.

Why?

thank you

António

-- 





[web2py] Re: edit a record does not show uploaded files

2012-12-19 Thread António Ramos
read the source luke!!!

in sqlform, add upload=URL('download')

Thanks
António

2012/12/19 António Ramos 

> hello this is my controller
>
> def edittrab():
> record = db.trabalhador(request.args(0)) or redirect(URL('index'))
> form = SQLFORM(db.trabalhador, record)
> if form.accepts(request.vars, session):
> response.flash = 'registo actualizado com sucesso'
> redirect(URL())
> elif form.errors:
> response.flash = 'erros detectados'
> return dict(form=form)
>
>
> my view
>
> {{extend 'layout.html'}}
>
> {{=form}}
>
> my upload fields do no show the link to the file.
>
> Why?
>
> thank you
>
> António
>

-- 





Re: [web2py] Re: bootstrap themes generator

2012-12-19 Thread António Ramos
i downloaded web2py from trunk and copied my code to a new app


2012/12/18 Vinicius Assef 

> What was the problem? How did you solve it?
>
>
>
> On Tue, Dec 18, 2012 at 3:19 PM, António Ramos 
> wrote:
> > Done.thank you.
> >
> > 2012/12/18 Vinicius Assef 
> >>
> >> Well, if you started your app based on welcome app in Web2py 2.2.1 you
> >> should have your default layout.html view linking bootstrap css.
> >>
> >>
> >> On Tue, Dec 18, 2012 at 12:56 PM, António Ramos 
> >> wrote:
> >> > 2.2.1!
> >> > windows version
> >> >
> >> > 2012/12/18 Vinicius Assef 
> >> >>
> >> >> What version are you using?
> >> >>
> >> >> Bootstrap came in version 2.0.1
> >> >>
> >> >>
> >> >>
> >> >> On Tue, Dec 18, 2012 at 12:12 PM, António Ramos <
> ramstei...@gmail.com>
> >> >> wrote:
> >> >> > I dont see it in my app static folder nor through web inspection...
> >> >> >
> >> >> > Where is it?
> >> >> >
> >> >> > 2012/12/18 Vinicius Assef 
> >> >> >>
> >> >> >> It's already embedded.
> >> >> >>
> >> >> >> On Tue, Dec 18, 2012 at 11:46 AM, António Ramos
> >> >> >> 
> >> >> >> wrote:
> >> >> >> > Hello, just a simple question
> >> >> >> > how do i use twitter bootstrap with web2py?
> >> >> >> > thank you
> >> >> >> > António
> >> >> >> >
> >> >> >> >
> >> >> >> > 2012/12/18 LightDot 
> >> >> >> >>
> >> >> >> >> Looks nice. There are also:
> >> >> >> >>
> >> >> >> >> http://bootswatchr.com/
> >> >> >> >> and
> >> >> >> >> http://bootswatcher.com/
> >> >> >> >>
> >> >> >> >> Names are similar, but they're not related. The latter allows
> you
> >> >> >> >> to
> >> >> >> >> start
> >> >> >> >> with an existing Bootswatch theme and go from there.
> >> >> >> >>
> >> >> >> >> Regards,
> >> >> >> >> Ales
> >> >> >> >>
> >> >> >> >>
> >> >> >> >> On Tuesday, December 18, 2012 4:24:48 AM UTC+1, Massimo Di
> Pierro
> >> >> >> >> wrote:
> >> >> >> >>>
> >> >> >> >>> http://www.boottheme.com/#generatetheme
> >> >> >> >>
> >> >> >> >> --
> >> >> >> >>
> >> >> >> >>
> >> >> >> >>
> >> >> >> >
> >> >> >> >
> >> >> >> > --
> >> >> >> >
> >> >> >> >
> >> >> >> >
> >> >> >>
> >> >> >> --
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >
> >> >> > --
> >> >> >
> >> >> >
> >> >> >
> >> >>
> >> >> --
> >> >>
> >> >>
> >> >>
> >> >
> >> > --
> >> >
> >> >
> >> >
> >>
> >> --
> >>
> >>
> >>
> >
> > --
> >
> >
> >
>
> --
>
>
>
>

-- 





Re: [web2py] Re: Graph Model (proposal to contribute)

2012-12-19 Thread António Ramos
Is this in trunk?



2012/12/16 Ovidio Marinho 

> Very Well Jose.
>
>
>
>Ovidio Marinho Falcao Neto
> Web Developer
>  ovidio...@gmail.com
>   ovidiomari...@itjp.net.br
>  ITJP - itjp.net.br
>83   8826 9088 - Oi
>83   9336 3782 - Claro
> Brasil
>
>
>
>
> 2012/12/15 Jose 
>
>> new patch with small changes
>>
>> Jose
>>
>> --
>>
>>
>>
>>
>
>  --
>
>
>
>

-- 





[web2py] Re: The book updates and status

2012-12-19 Thread Massimo Di Pierro
One more thing is important. Please check the page:

http://web2py.com/examples/default/who.html

If you have contributed and your name is not there or you are there but 
your work is not properly represented please email me. DO NOT BE SHY. I 
need the names in the book acknowledgement page.

Massimo

On Wednesday, 19 December 2012 11:11:55 UTC-6, Massimo Di Pierro wrote:
>
> It would help me if people could add to this thread some comments about:
> - what needs clarification?
> - what is poorly undocumented?
> - what do you expect in the 5th edition?
> Please when making comments refers to the online english version.
>
> Massimo
>
> On Wednesday, 19 December 2012 03:11:37 UTC-6, Andrew W wrote:
>>
>> Just checking in on how the 5th edition is going ?
>> Thanks
>>
>> On Thursday, November 29, 2012 11:58:29 PM UTC+13, Kostas M wrote:
>>>
>>> I have bought the (printed) web2py book (editions 3rd and 4th) from 
>>> Lulu, and my note is that the black & white printouts are much less 
>>> attractive from
>>> the web css book layout. The coloring helps understanding the syntax as 
>>> well. I wish the printed book could look as nice as the web version...
>>> I once printed some chapters in a color printer to have this nice 
>>> layout. Couldn't the Lulu book follow a better printing style?
>>>
>>> Kostas
>>>
>>> On Wednesday, November 28, 2012 7:08:48 PM UTC, Massimo Di Pierro wrote:

 Almost everything is documented except: 1) auth.wiki; 2) some of the 
 new grid parameters.

 Along with these changes I am planning some minor book refactoring 
 before publishing to 5th edition.

 Massimo

>
>>>

-- 





[web2py] Re: web2py book now free in PDF

2012-12-19 Thread Lewis
Nice!

-- 





[web2py] Re: Scheduler tasks stuck in ASSIGNED state

2012-12-19 Thread JimK
I'll give it a try with debug mode later this afternoon and send along the 
logs.

I'm certain that there's a real bug here and not user error as I tested it 
quite thoroughly from a blackbox perspective (I didn't know how to turn on 
logging, doh!).  Again, with all other criteria being equal, switching out 
the schedule.py file out with the 2.12(?) version fixed the problem.

Jim

On Wednesday, December 19, 2012 1:32:09 AM UTC-8, Niphlod wrote:
>
> sorry, just tried, can't reproduce the issue. Can you post the logs of the 
> schedulers ?
> Maybe start them adding *-D 0* to activate the DEBUG level
> What normally goes on is:
> - you start "dir", it's the first one so it becomes the "TICKER", but it 
> doesn't see any "metrics" worker so it doesn't assign tasks
> - you start "metrics", after a while the "dir" worker sees it and starts 
> assigning tasks to "metrics"
> - etc.
>
>
> Il giorno mercoledì 19 dicembre 2012 04:31:32 UTC+1, JimK ha scritto:
>>
>> I'm not sure what the issue was but replacing the gluon/scheduler.py file 
>> with the older one fixed the problem.  There were a lot of changes in 2.3.2 
>> so it's hard to pinpoint what broke things.
>>
>> On Tuesday, December 18, 2012 6:36:29 PM UTC-8, JimK wrote:
>>>
>>> There appears to be a major bug with the scheduler workers with 2.3.2 in 
>>> tasks are stuck in the ASSIGNED state if that worker group was not the 
>>> first one started.  This problem did not exist until I upgraded to 2.3.2 
>>> this morning.
>>>
>>> I have 2 task groups in my service (dir, metrics).  
>>>
>>> I start the workers after starting the server like so (art is the 
>>> application name):
>>> /usr/bin/python2.6 /var/www/web2py/web2py.py -K art:dir
>>> /usr/bin/python2.6 /var/www/web2py/web2py.py -K art:metrics
>>> /usr/bin/python2.6 /var/www/web2py/web2py.py -K art:rap
>>>
>>> If I start the "dir" worker first and the "metrics", my "dir" group 
>>> tasks complete fine but the "metrics" group tasks are stuck in the ASSIGNED 
>>> state.
>>> To prove my theory, I then killed all of the workers and stared the 
>>> "metrics" worker first and then "dir" worker.  As hypothesized, the 
>>> "metrics" group tasks complete but the "dir" group tasks are stuck in the 
>>> ASSIGNED state.
>>>
>>> Any ideas???
>>>
>>

-- 





[web2py] Re: Scheduler tasks stuck in ASSIGNED state

2012-12-19 Thread Niphlod
yep, I started with "sorry" because I can't reproduce with the newer one 
and the older one. But let me (us) know as soon as logs are filled.

On Wednesday, December 19, 2012 7:52:44 PM UTC+1, JimK wrote:
>
> I'll give it a try with debug mode later this afternoon and send along the 
> logs.
>
> I'm certain that there's a real bug here and not user error as I tested it 
> quite thoroughly from a blackbox perspective (I didn't know how to turn on 
> logging, doh!).  Again, with all other criteria being equal, switching out 
> the schedule.py file out with the 2.12(?) version fixed the problem.
>
> Jim
>
> On Wednesday, December 19, 2012 1:32:09 AM UTC-8, Niphlod wrote:
>>
>> sorry, just tried, can't reproduce the issue. Can you post the logs of 
>> the schedulers ?
>> Maybe start them adding *-D 0* to activate the DEBUG level
>> What normally goes on is:
>> - you start "dir", it's the first one so it becomes the "TICKER", but it 
>> doesn't see any "metrics" worker so it doesn't assign tasks
>> - you start "metrics", after a while the "dir" worker sees it and starts 
>> assigning tasks to "metrics"
>> - etc.
>>
>>
>> Il giorno mercoledì 19 dicembre 2012 04:31:32 UTC+1, JimK ha scritto:
>>>
>>> I'm not sure what the issue was but replacing the gluon/scheduler.py 
>>> file with the older one fixed the problem.  There were a lot of changes in 
>>> 2.3.2 so it's hard to pinpoint what broke things.
>>>
>>> On Tuesday, December 18, 2012 6:36:29 PM UTC-8, JimK wrote:

 There appears to be a major bug with the scheduler workers with 2.3.2 
 in tasks are stuck in the ASSIGNED state if that worker group was not the 
 first one started.  This problem did not exist until I upgraded to 2.3.2 
 this morning.

 I have 2 task groups in my service (dir, metrics).  

 I start the workers after starting the server like so (art is the 
 application name):
 /usr/bin/python2.6 /var/www/web2py/web2py.py -K art:dir
 /usr/bin/python2.6 /var/www/web2py/web2py.py -K art:metrics
 /usr/bin/python2.6 /var/www/web2py/web2py.py -K art:rap

 If I start the "dir" worker first and the "metrics", my "dir" group 
 tasks complete fine but the "metrics" group tasks are stuck in the 
 ASSIGNED 
 state.
 To prove my theory, I then killed all of the workers and stared the 
 "metrics" worker first and then "dir" worker.  As hypothesized, the 
 "metrics" group tasks complete but the "dir" group tasks are stuck in the 
 ASSIGNED state.

 Any ideas???

>>>

-- 





Re: [web2py] Re: REF: SQLFORM.grid column width and content length

2012-12-19 Thread Niphlod
db.define_table('testtable'
Field('averylongtext', length=256)
)

grid = SQLFROM.grid(db.testtable, maxtextlenghts={
'testtable.averylongtextfield' : 256})



Clearer ?

On Wednesday, December 19, 2012 7:04:29 PM UTC+1, software.ted wrote:
>
> Can you show an example on how that dictionary is passed to the grid?
> On Dec 19, 2012 3:18 PM, "Niphlod" > wrote:
>
>> By default, maxtextlength is 20. maxtextlength=150 will truncate all 
>> columns only if they are longer than 150 chars.
>>
>> maxtextlength*s* instead allows to pass a dictionary of 
>> {'tablename.field' : length} to set this limit for every column.
>>
>>
>> Il giorno mercoledì 19 dicembre 2012 13:24:04 UTC+1, software.ted ha 
>> scritto:
>>>
>>> Hi,
>>>
>>> I have noticed SQLFORM.grid column content is not wraping if its long 
>>> instead the content is cut and three dots (...) are appended to the 
>>> content. How do i allow more text to be displayed or adjust the width of 
>>> the grid?
>>>
>>> Teddy L.
>>>
>>  -- 
>>  
>>  
>>  
>>
>

-- 





[web2py] Re: Webassets in web2py

2012-12-19 Thread Niphlod
so develop web2py in VS and not in the integrated admin interface :P

I was referring to the fact that there is no python compiler for typescript 
(other IDE "advertised" have only the syntax highlight feature, not the 
auto-compile feature)

On Wednesday, December 19, 2012 5:40:31 PM UTC+1, Arnon Marcus wrote:
>
> Hmmm, not exactly.
>
> You CAN use node for/with it, but there are also IDE plugins.
> I'm using Visual Studio 2012 (trial) and it compiles-on-save 
> automatically, with a side-by-side updating javascript target file view. 
> that is being generated as I save.
> All the material needed to make such a plugin for any other IDE is 
> open-sourced, and does not NEED node.js to work at all...
> It even minimizes my files for me as well (generates another *-min.js 
> file).
> I can even configure the compiler in the IDE to also auto-generate 
> source-maps as it auto-compiles-on-save.
> This is just another option in the options window of VS, that gets added 
> when I install the "web-essentials" extension of VS.
> This is a huge extension, that also provides auto-compilation of 
> LESS-to-CSS files, and also minifiezes the resulting CSS files as well
>
> In a nut-shell:
>
> Visual Studio 2012 + TypeScript (plugin) + Web-Essentials (extension) = 
> Auto-Compilation/Source-Map-Generation/Minification of 
> TypeScript->JavaScript + LESS->CSS
> :)
> All this with ZERO dependencies and without node.js
> :) :)
> And I can now debug in Chrome using the original TypeScript files 
> themselves, using the auto-generated-source-maps-on-save, via the "Use 
> Source Maps" feature in chrome.
> :) :) :)
> I can also use use the LESS files in chrome, by using the "Support for 
> SASS" feature.
> :) :) :) :)
> Adding the LivePage (auto-reload) chrome-extension rounds up the 
> real-time-feedback-with-transipling experience.
> :) :) :) :) :)
> All the above, without web2py or node.js (!)
>
> Here is a better video-presentation for TypeScript:
> http://channel9.msdn.com/posts/Anders-Hejlsberg-Introducing-TypeScript
>
> Here is how Source-Maps work:
> http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/
>
> LivePage extension:
>
> https://chrome.google.com/webstore/detail/livepage/pilnojpmdoofaelbinaeodfpjheijkbh?hl=en
>
> On Wednesday, December 19, 2012 5:12:26 PM UTC+2, Niphlod wrote:
>>
>> anoher node.js dependancy ^_^
>>
>> Il giorno mercoledì 19 dicembre 2012 15:53:45 UTC+1, Arnon Marcus ha 
>> scritto:
>>>
>>> I'm starting to fall in love with TypeScript...
>>>
>>> http://www.youtube.com/watch?v=3dqZW_DqHIQ
>>>
>>> On Tuesday, December 18, 2012 1:21:33 AM UTC+2, Arnon Marcus wrote:

 That sounds very cool, thanks for the detailed answered, this makes my 
 head a little calmer now...

 BTW, I actually DID mean coffeCup, It refers to the python module that 
 does coffeeScript-to-javascript transipling.

 https://github.com/dsc/coffeecup

 Apparently, it also depends on node...

 Anyways, I think i'm sarting to lean more towards TypeScript anyways, 
 so...

 On Monday, December 17, 2012 2:26:38 PM UTC-8, Niphlod wrote:
>
>
>
> On Monday, December 17, 2012 2:50:09 PM UTC+1, Arnon Marcus wrote:
>>
>> Holy shit...
>>
>> Where did you say you got all that info from?
>
>
> quoted the link and scanning the source code 
>  
>
>> Is this what that module needs?
>>
>> I thought it's just a stand-alone pythonic-module doing everything...
>> Guess I was a bit optimistic...
>>
>> little bit too much :P
>  
>
>> What about coffeeCup?
>>
>
> meaning coffeescript ? 
>  
>
>> - is it just something like "edit the less file in 
>> static/less/file.less and have it recompiled as /static/css/file.css"
>> Well, either that and/or sass/scss, as well as coffescript 
>> transpiling, with optional minification/zipping for the resaulting 
>> js/css, 
>> yeah, basically that.
>>
>
> I'm not that much advanced, but as long as there is a "list of 
> extensions" that follow the same rule, a contrib script continuosly 
> checking for changed files is not hard to do.
>  
>
>> But if there is ANY need for node.js in this kind of solution, than 
>> forget it.
>>
>
> I gave you the list of what webasset provide with python modules. I 
> think the author researched a lot and resorted to external binaries only 
> when needed  
>
> Is web2py minifying css/js scripts by default? If so, in what 
>> circumstances? And since what version?
>>
>
> nope. Web2py includes contrib.minify (containing jsmin and cssmin) 
> that is activated by response.optimize_css and response.optimize_js . 
> It's 
> a feature I think since 1.99.7.
>
> Gzipping is not done within web2py. Usually that is something done 
> only one-time-only before releasing to production and fo

Re: [web2py] Re: REF: SQLFORM.grid column width and content length

2012-12-19 Thread Teddy Nyambe
Very! thanx buddy!
On Dec 19, 2012 9:48 PM, "Niphlod"  wrote:

> db.define_table('testtable'
> Field('averylongtext', length=256)
> )
>
> grid = SQLFROM.grid(db.testtable, maxtextlenghts={
> 'testtable.averylongtextfield' : 256})
>
>
>
> Clearer ?
>
> On Wednesday, December 19, 2012 7:04:29 PM UTC+1, software.ted wrote:
>>
>> Can you show an example on how that dictionary is passed to the grid?
>> On Dec 19, 2012 3:18 PM, "Niphlod"  wrote:
>>
>>> By default, maxtextlength is 20. maxtextlength=150 will truncate all
>>> columns only if they are longer than 150 chars.
>>>
>>> maxtextlength*s* instead allows to pass a dictionary of
>>> {'tablename.field' : length} to set this limit for every column.
>>>
>>>
>>> Il giorno mercoledì 19 dicembre 2012 13:24:04 UTC+1, software.ted ha
>>> scritto:

 Hi,

 I have noticed SQLFORM.grid column content is not wraping if its long
 instead the content is cut and three dots (...) are appended to the
 content. How do i allow more text to be displayed or adjust the width of
 the grid?

 Teddy L.

>>>  --
>>>
>>>
>>>
>>>
>>  --
>
>
>
>

-- 





Re: [web2py] Re: new setup-web2py-nginx-uwsgi-ubuntu.sh

2012-12-19 Thread Niphlod


> @Simone, an other improvement to the script could be to combine into a 
> single server the 80, and 443 to avoid duplicating configuration, as stated 
> here :
>
> http://nginx.org/en/docs/http/configuring_https_servers.html#single_http_https_server
> I don't had test this.
>
> Also, here the code for permanent redirection 
> server {
>   server_name $hostname;
>   listen  80;
>   return 301 http*s*://$hostname$request_uri; # NOTE: I am not sure for 
> $hostname here, because I didn't set hostname for my VM until now, as in 
> the example (URL below) we can use domainName.com instead if properly 
> configure in nginx
> ...
> }
>
>
People may want separate configs for http and https. The script objective 
is to have a working copy of web2py. If we start to follow such requests, 
we'd end up installing postgresql and redis too :P 

@Paolo: try the script found at the dropbox link. If the same error happens 
I think we need the log of pip and a hand by Roberto on the specific 
error...

-- 





[web2py] Re: The book updates and status

2012-12-19 Thread Anthony
This document is a bit old, so some of the items may already have been 
added: 
https://docs.google.com/document/d/1yQy0F5HcxiecBOBLblrLmAAAsAK6sL37wSL527yssGk/edit

Anthony

On Wednesday, December 19, 2012 12:11:55 PM UTC-5, Massimo Di Pierro wrote:
>
> It would help me if people could add to this thread some comments about:
> - what needs clarification?
> - what is poorly undocumented?
> - what do you expect in the 5th edition?
> Please when making comments refers to the online english version.
>
> Massimo
>
> On Wednesday, 19 December 2012 03:11:37 UTC-6, Andrew W wrote:
>>
>> Just checking in on how the 5th edition is going ?
>> Thanks
>>
>> On Thursday, November 29, 2012 11:58:29 PM UTC+13, Kostas M wrote:
>>>
>>> I have bought the (printed) web2py book (editions 3rd and 4th) from 
>>> Lulu, and my note is that the black & white printouts are much less 
>>> attractive from
>>> the web css book layout. The coloring helps understanding the syntax as 
>>> well. I wish the printed book could look as nice as the web version...
>>> I once printed some chapters in a color printer to have this nice 
>>> layout. Couldn't the Lulu book follow a better printing style?
>>>
>>> Kostas
>>>
>>> On Wednesday, November 28, 2012 7:08:48 PM UTC, Massimo Di Pierro wrote:

 Almost everything is documented except: 1) auth.wiki; 2) some of the 
 new grid parameters.

 Along with these changes I am planning some minor book refactoring 
 before publishing to 5th edition.

 Massimo

>
>>>

-- 





Re: [web2py] Re: new setup-web2py-nginx-uwsgi-ubuntu.sh

2012-12-19 Thread Richard Vézina
Agree...

Richard

On Wed, Dec 19, 2012 at 2:59 PM, Niphlod  wrote:

> ry the script found at the dropbox link. If the same error happens I th

-- 





[web2py] hello3.xml question

2012-12-19 Thread lucas
hello one and all,

i am trying to understand the hello3 function under simple_examples and i 
don't understand adding .xml to the url directs web2py to convert it into 
an xml doc instead of the default html file when the .xml is not included 
in the url.  i tried adding .xml to a few of my html returned functions and 
it doesn't convert it into xml. so how is that done because i want to be 
able to have some data sent as an xml doc as hello3 function?  because to 
me it seems that hello3 just looks like a regular html template with dict 
returned from the function.

thanx in advance, lucas

-- 





Re: [web2py] Re: impersonate and 2.3.2

2012-12-19 Thread Martin Weissenboeck
it's ok now - thank you!

2012/12/19 Massimo Di Pierro 

> Fixed in trunk. Please check it.
>
>
> On Wednesday, 19 December 2012 09:52:52 UTC-6, mweissen wrote:
>>
>> @auth.requires_login()
>> @auth.requires_permission('**impersonate','auth_user')
>> def imitieren_id():
>> auth.impersonate(request.**args[0])
>> redirect(URL('index'))
>>
>> This is the function "imitieren_id" for impersonate. I think (but I am
>> not sure) yesterday there has been no problem, but today (after updating to
>> 2.3.2) I get:
>>
>>
>>
>>
>>
>> 1.
>> 2.
>>
>>
>>
>> 3.
>> 4.
>> 5.
>> 6.
>> 7.
>> 8.
>> 9.
>> 10.
>> 11.
>> 12.
>> 13.
>> 14.
>> 15.
>> 16.
>>
>>
>> Traceback (most recent call last):
>>   File "H:\\web2py\gluon\restricted.**py", line 212, in restricted
>>
>>
>>
>> exec ccode in environment
>>   File "H:/web2py/applications/**bewerbung/controllers/default.**py" 
>> , 
>> line 1291, in 
>>
>>
>>
>>   File "H:\web2py\gluon\globals.py", line 193, in 
>>
>>
>>
>> self._caller = lambda f: f()
>>
>>
>>
>>   File "H:\web2py\gluon\tools.py", line 2929, in f
>>
>>
>>
>> return action(*a, **b)
>>
>>
>>
>>   File "H:\web2py\gluon\tools.py", line 2929, in f
>>
>>
>>
>> return action(*a, **b)
>>
>>
>>
>>   File "H:/web2py/applications/**bewerbung/controllers/default.**py" 
>> , 
>> line 124, in imitieren_id
>>
>>
>>
>> auth.impersonate(request.args[**0])
>>
>>
>>
>>   File "H:\\web2py\gluon\tools.py", line 2830, in impersonate
>>
>>
>>
>> for callback in self.settings.login_onaccept:
>>
>>
>> TypeError: 'function' object is not iterable
>>
>>
>>
>> Regards, Martin
>>
>>
>>
>>
>>
>>
>>  --
>
>

-- 





[web2py] Limits on controller names?

2012-12-19 Thread Wes Hall
I was successfully working with a controller 'b.py'. 

I am no longer able to use the included editor to edit this controller. 
Attempting to access the controller results in a never-ending attempt to 
load.

Suspecting the file contents, I renamed the controller and .bak to c.py and 
c.py.bak (there was a b.py.1 file that I renamed as well), then created a 
new b.py controller with default contents. It opens, but after saving, I 
can not access it with the editor, even with the default controller 
content.  Moving the working code to a controller 'bard.py' works fine, so 
I doubt it has anything to do with the controller code itself.

I'm not sure this is easily reproducible as it was working for an extended 
period of time. The only thing I can think of is that I possibly had b.py 
open in two different browsers.  Restarting the machine and the web2py 
server did not resolve, however.

Any suggestions as to where should I start looking?

Thanks.

Version 2.2.1 (2012-10-21 16:57:04) stable

-- 





[web2py] Re: The book updates and status

2012-12-19 Thread Andrew W
The #1 thing I am waiting on is the addition of auth.wiki.

On Thursday, December 20, 2012 9:15:46 AM UTC+13, Anthony wrote:
>
> This document is a bit old, so some of the items may already have been 
> added: 
> https://docs.google.com/document/d/1yQy0F5HcxiecBOBLblrLmAAAsAK6sL37wSL527yssGk/edit
>
> Anthony
>
> On Wednesday, December 19, 2012 12:11:55 PM UTC-5, Massimo Di Pierro wrote:
>>
>> It would help me if people could add to this thread some comments about:
>> - what needs clarification?
>> - what is poorly undocumented?
>> - what do you expect in the 5th edition?
>> Please when making comments refers to the online english version.
>>
>> Massimo
>>
>> On Wednesday, 19 December 2012 03:11:37 UTC-6, Andrew W wrote:
>>>
>>> Just checking in on how the 5th edition is going ?
>>> Thanks
>>>
>>> On Thursday, November 29, 2012 11:58:29 PM UTC+13, Kostas M wrote:

 I have bought the (printed) web2py book (editions 3rd and 4th) from 
 Lulu, and my note is that the black & white printouts are much less 
 attractive from
 the web css book layout. The coloring helps understanding the syntax as 
 well. I wish the printed book could look as nice as the web version...
 I once printed some chapters in a color printer to have this nice 
 layout. Couldn't the Lulu book follow a better printing style?

 Kostas

 On Wednesday, November 28, 2012 7:08:48 PM UTC, Massimo Di Pierro wrote:
>
> Almost everything is documented except: 1) auth.wiki; 2) some of the 
> new grid parameters.
>
> Along with these changes I am planning some minor book refactoring 
> before publishing to 5th edition.
>
> Massimo
>
>>


-- 





Re: [web2py] Re: help please

2012-12-19 Thread Derek
The data is gone. Let this be a reminder to all of you out there, back up 
your data and back it up often. Also, it's not backed up if you can't 
restore it, so test out restores as well.

On Wednesday, December 19, 2012 9:08:47 AM UTC-7, LightDot wrote:
>
> First, make a couple of physical copies of the database and do not write 
> into it anymore. Then, working on a copy, you could try restoring / 
> extracting the data by using forensic tools, etc.
>
> I'm not aware of a straightforward sqlite restore tool, but there might be 
> one or two out there... I'm sure you're not the first to have such an issue.
>
> I guess it comes down to the question of is it worth the time and effort.
>
> Regards,
> Ales
>
>
> On Wednesday, December 19, 2012 4:54:50 PM UTC+1, Aurelijus Useckas wrote:
>>
>> Yeah I know.. I have an old backup only :( me bad
>>
>>
>> On Wed, Dec 19, 2012 at 5:51 PM, Mark  wrote:
>>
>>> Do you have any kind of backup files for the database? Or, do your 
>>> server/computer backup daily or weekly? If there are any backup files, you 
>>> can restore the deleted data easily.
>>>
>>> Mark 
>>>
>>>
>>> On Wednesday, December 19, 2012 8:21:27 AM UTC-5, Aurelijus Useckas 
>>> wrote:

 I've deleted user information from auth_users and suddenly all my data 
 (from other table views) disapears.. Yes, other tables are linked to this 
 one. Specifically for info on updates and simillar...

 If I restore the same data in auth_users other table still doesn't show 
 anything... I event reset the autoincrement and make it appear totally 
 identical.. still nothing :(

 did i mess up??? :(

>>>  -- 
>>>  
>>>  
>>>  
>>>
>>
>>

-- 





[web2py] Re: hello3.xml question

2012-12-19 Thread Derek
Yeah, I got the same issue as you. I have a site called 'customers2' and a 
controller 'customer' and a function 'index' - when i add a '.xml' onto 
'index' i get this:
 
invalid view (customer/index.xml)
On Wednesday, December 19, 2012 2:38:36 PM UTC-7, lucas wrote:
>
> hello one and all,
>
> i am trying to understand the hello3 function under simple_examples and i 
> don't understand adding .xml to the url directs web2py to convert it into 
> an xml doc instead of the default html file when the .xml is not included 
> in the url.  i tried adding .xml to a few of my html returned functions and 
> it doesn't convert it into xml. so how is that done because i want to be 
> able to have some data sent as an xml doc as hello3 function?  because to 
> me it seems that hello3 just looks like a regular html template with dict 
> returned from the function.
>
> thanx in advance, lucas
>

-- 





[web2py] Getting Apache 2.4 to work on Suse Linux

2012-12-19 Thread Andrew W
Hi all,

Just a note on Apache that may help others:

I've battled for days with getting web2py working with apache (2.4) on a 
Suse linux server.   I kept on getting Forbidden errors.
I eventually stumbled onto the "Require all granted" statement - once I 
added this then everything works fine.


  # I don't need the next line
  # Allow from all
  # The following line is REQUIRED (for me anyway)
  Require all granted


So,  Does the documentation need updating ?  I assume it has worked as is 
for others.  Perhaps is should be as there are obviously situations when it 
is required.
I can comment out the "Allow from all"  and it still works.  
Is this just for Apache 2.4 as opposed to version 2.2 ?


-- 





Re: [web2py] Re: Graph Model (proposal to contribute)

2012-12-19 Thread Massimo Di Pierro
Not yet. It is the queue.

On Wednesday, 19 December 2012 09:49:04 UTC-6, Ramos wrote:
>
> Is this in trunk?
>
>
>
> 2012/12/16 Ovidio Marinho >
>
>> Very Well Jose.
>>   
>>
>>
>>Ovidio Marinho Falcao Neto
>> Web Developer
>>  ovid...@gmail.com  
>>   ovidio...@itjp.net.br 
>>  ITJP - itjp.net.br
>>83   8826 9088 - Oi
>>83   9336 3782 - Claro
>> Brasil
>>   
>>
>>
>>
>> 2012/12/15 Jose >
>>
>>> new patch with small changes
>>>
>>> Jose
>>>
>>> -- 
>>>  
>>>  
>>>  
>>>
>>
>>  -- 
>>  
>>  
>>  
>>
>
>

-- 





Re: [web2py] how to cleanse field value

2012-12-19 Thread wwwgong
I thought validator only validates, can you show me how to update field 
with the sanitized value.
Thanks,

On Wednesday, December 19, 2012 9:57:48 AM UTC-5, viniciusban wrote:
>
> Try a custom validator to sanitize your description field. 
>
>
> On Wed, Dec 19, 2012 at 12:06 PM, wwwgong > 
> wrote: 
> > Hi, 
> > I like to store youtube videos into a table: 
> > 
> > db.define_table('youtube', 
> > Field('code'), 
> > Field('description') 
> > ) 
> > 
> > def youtube_repr(code,width=400,height=250): 
> > return XML(""" 
> >  
> >  > value="http://www.youtube.com/v/%(code)s&hl=en_US&fs=1&"> 
> >  
> >  
> > http://www.youtube.com/v/%(code)s&hl=en_US&fs=1&" 
> > type="application/x-shockwave-flash" 
> allowscriptaccess="always" 
> > allowfullscreen="true" width="%(width)s" 
> > height="%(height)s"> 
> > """ % dict(code=code, width=width, height=height) 
> > ) 
> > 
> > db.youtube.code.represent = youtube_repr 
> > 
> > with this controller: 
> > def youtube_video(): 
> > form = SQLFORM.grid(db.youtube) 
> > return dict(form=form) 
> > 
> > If the "description" field contains double quote char {"}, it will 
> messes 
> > up, 
> > see screenshot at 
> > http://dl.dropbox.com/u/54552252/cleanse-web2py-field-value.jpg 
> > 
> > I know web2py offers custom validator to detect special char in Form 
> field, 
> > but is it possible to attach a pre-process function at DAL layer to 
> cleanse 
> > field value before db operation? 
> > 
> > Something like: 
> > 
> > db.youtube.description.preprocess = cleanse_special_char 
> > 
> > where "cleanse_special_char" is a function to cleanse 
> db.youtube.description 
> > field value 
> > 
> > Can someone offer a solution or workaround? 
> > 
> > Thanks, 
> > Wen 
> > 
> > 
> > -- 
> > 
> > 
> > 
>

-- 





[web2py] Re: The book updates and status

2012-12-19 Thread Massimo Di Pierro
I have been going over that document. The things in gray were not in the 
published 4th edition but are in the online version. 

I also have this file:
https://github.com/mdipierro/web2py-book/blob/master/sources/29-web2py-english/README
things checked [x] were not in the published 4th edition but are in the 
online edition.
I plan to complete covering items marked [ ] over christmas and publish the 
5th edition short after.

There is not too much left to write (I think) but I will need some 
volunteers for some proofreading when done.

Massimo



On Wednesday, 19 December 2012 14:15:46 UTC-6, Anthony wrote:
>
> This document is a bit old, so some of the items may already have been 
> added: 
> https://docs.google.com/document/d/1yQy0F5HcxiecBOBLblrLmAAAsAK6sL37wSL527yssGk/edit
>
> Anthony
>
> On Wednesday, December 19, 2012 12:11:55 PM UTC-5, Massimo Di Pierro wrote:
>>
>> It would help me if people could add to this thread some comments about:
>> - what needs clarification?
>> - what is poorly undocumented?
>> - what do you expect in the 5th edition?
>> Please when making comments refers to the online english version.
>>
>> Massimo
>>
>> On Wednesday, 19 December 2012 03:11:37 UTC-6, Andrew W wrote:
>>>
>>> Just checking in on how the 5th edition is going ?
>>> Thanks
>>>
>>> On Thursday, November 29, 2012 11:58:29 PM UTC+13, Kostas M wrote:

 I have bought the (printed) web2py book (editions 3rd and 4th) from 
 Lulu, and my note is that the black & white printouts are much less 
 attractive from
 the web css book layout. The coloring helps understanding the syntax as 
 well. I wish the printed book could look as nice as the web version...
 I once printed some chapters in a color printer to have this nice 
 layout. Couldn't the Lulu book follow a better printing style?

 Kostas

 On Wednesday, November 28, 2012 7:08:48 PM UTC, Massimo Di Pierro wrote:
>
> Almost everything is documented except: 1) auth.wiki; 2) some of the 
> new grid parameters.
>
> Along with these changes I am planning some minor book refactoring 
> before publishing to 5th edition.
>
> Massimo
>
>>


-- 





[web2py] Re: web2py 2.3.2 is OUT

2012-12-19 Thread Derek
clicking the 'demo' links, all the demo sites look like crap and have 
serious issues with navigation.

http://web2py.com/demo_app1/default/index
clicking on the 'categories' - nothing happens.

http://web2py.com/demo_app2/default/index
once again, clicking on the 'categories' does nothing,
and hovering over the 'edit' the options show up, but are barely readable, 
and quite ugly, I know it can't be intended this way.

http://web2py.com/demo_app3/default/index
no categories, but the menu on the right overlaps the text in the middle. 


On Monday, December 17, 2012 8:11:19 AM UTC-7, Massimo Di Pierro wrote:
>
> It is the same as 2.3.2 but fixed a major bug with NEWINSTALL being 
> ignored and therefore not creating the welcome.w2p for the new scaffolding 
> app.
>
> If you are using 2.3.1 you may still be using an older welcome instead of 
> the cool new one. Upgrade to 2.3.2 to fix this.
>
> Massimo
>

-- 





Re: [web2py] Re: new setup-web2py-nginx-uwsgi-ubuntu.sh

2012-12-19 Thread paolo.vall...@gmail.com
Hi
I was trying with the script that comes with the stable web2py. with the
one on dropbox I problem has gone.

Paolo


2012/12/19 Niphlod 

>
> @Simone, an other improvement to the script could be to combine into a
>> single server the 80, and 443 to avoid duplicating configuration, as stated
>> here :
>> http://nginx.org/en/docs/http/**configuring_https_servers.**
>> html#single_http_https_server
>> I don't had test this.
>>
>> Also, here the code for permanent redirection
>> server {
>>   server_name $hostname;
>>   listen  80;
>>   return 301 http*s*://$hostname$request_uri; # NOTE: I am not sure for
>> $hostname here, because I didn't set hostname for my VM until now, as in
>> the example (URL below) we can use domainName.com instead if properly
>> configure in nginx
>> ...
>> }
>>
>>
> People may want separate configs for http and https. The script objective
> is to have a working copy of web2py. If we start to follow such requests,
> we'd end up installing postgresql and redis too :P
>
> @Paolo: try the script found at the dropbox link. If the same error
> happens I think we need the log of pip and a hand by Roberto on the
> specific error...
>
> --
>
>
>
>



-- 
 Paolo

-- 





[web2py] Re: Webassets in web2py

2012-12-19 Thread Arnon Marcus
The auto-compile is just calling the JavaScript-based compiler on the code 
when the file is saved... Doesn't sound like a lot to implement for a 
plugin... Maybe there are even things one can wire manually in some IDEs, 
like binding the save short-key to a macro that runs a command line in the 
background or something...

TypeScript is extremely new, so broad IDE support is not here yet, but it 
will come soon, I'm sure. In the meantime, I think the TypeScript plugin 
and web-essentials extension, can be installed on the "Express" edition(s) 
of visual studio. And if you still wanna do it in any other IDE, well, 
there's always node.js and running some watcher on it...

I do still think that in general, one should be able to use web2py itself 
as a watcher, that can run transpilers/minifiers on-save. It should be easy 
enough to wire a new transpiler/minifier to such a watcher, as there are 
many javascript transpilers out there, and new ones seem to be popping up 
every now and then...

Hell, someone could write a plugin/app for web2py that runs unit-tests via 
some library (jasmin, qunit or whatever,,,) It could be a full-stack CI 
system, kinda like yeoman...
There is a growing need for such things as more logic is being developed 
in(and/or moved to) the client side. The "Single-Page-Apps" era has arrived, 
and web2py should adapt. It was a forerunner a few years back, and it 
should stay on the edge of innovation, or at the very least keep up with 
the trends.

On Wednesday, December 19, 2012 11:53:35 AM UTC-8, Niphlod wrote:
>
> so develop web2py in VS and not in the integrated admin interface :P
>
> I was referring to the fact that there is no python compiler for 
> typescript (other IDE "advertised" have only the syntax highlight feature, 
> not the auto-compile feature)
>
> On Wednesday, December 19, 2012 5:40:31 PM UTC+1, Arnon Marcus wrote:
>>
>> Hmmm, not exactly.
>>
>> You CAN use node for/with it, but there are also IDE plugins.
>> I'm using Visual Studio 2012 (trial) and it compiles-on-save 
>> automatically, with a side-by-side updating javascript target file view. 
>> that is being generated as I save.
>> All the material needed to make such a plugin for any other IDE is 
>> open-sourced, and does not NEED node.js to work at all...
>> It even minimizes my files for me as well (generates another *-min.js 
>> file).
>> I can even configure the compiler in the IDE to also auto-generate 
>> source-maps as it auto-compiles-on-save.
>> This is just another option in the options window of VS, that gets added 
>> when I install the "web-essentials" extension of VS.
>> This is a huge extension, that also provides auto-compilation of 
>> LESS-to-CSS files, and also minifiezes the resulting CSS files as well
>>
>> In a nut-shell:
>>
>> Visual Studio 2012 + TypeScript (plugin) + Web-Essentials (extension) = 
>> Auto-Compilation/Source-Map-Generation/Minification of 
>> TypeScript->JavaScript + LESS->CSS
>> :)
>> All this with ZERO dependencies and without node.js
>> :) :)
>> And I can now debug in Chrome using the original TypeScript files 
>> themselves, using the auto-generated-source-maps-on-save, via the "Use 
>> Source Maps" feature in chrome.
>> :) :) :)
>> I can also use use the LESS files in chrome, by using the "Support for 
>> SASS" feature.
>> :) :) :) :)
>> Adding the LivePage (auto-reload) chrome-extension rounds up the 
>> real-time-feedback-with-transipling experience.
>> :) :) :) :) :)
>> All the above, without web2py or node.js (!)
>>
>> Here is a better video-presentation for TypeScript:
>> http://channel9.msdn.com/posts/Anders-Hejlsberg-Introducing-TypeScript
>>
>> Here is how Source-Maps work:
>> http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/
>>
>> LivePage extension:
>>
>> https://chrome.google.com/webstore/detail/livepage/pilnojpmdoofaelbinaeodfpjheijkbh?hl=en
>>
>> On Wednesday, December 19, 2012 5:12:26 PM UTC+2, Niphlod wrote:
>>>
>>> anoher node.js dependancy ^_^
>>>
>>> Il giorno mercoledì 19 dicembre 2012 15:53:45 UTC+1, Arnon Marcus ha 
>>> scritto:

 I'm starting to fall in love with TypeScript...

 http://www.youtube.com/watch?v=3dqZW_DqHIQ

 On Tuesday, December 18, 2012 1:21:33 AM UTC+2, Arnon Marcus wrote:
>
> That sounds very cool, thanks for the detailed answered, this makes my 
> head a little calmer now...
>
> BTW, I actually DID mean coffeCup, It refers to the python module 
> that does coffeeScript-to-javascript transipling.
>
> https://github.com/dsc/coffeecup
>
> Apparently, it also depends on node...
>
> Anyways, I think i'm sarting to lean more towards TypeScript anyways, 
> so...
>
> On Monday, December 17, 2012 2:26:38 PM UTC-8, Niphlod wrote:
>>
>>
>>
>> On Monday, December 17, 2012 2:50:09 PM UTC+1, Arnon Marcus wrote:
>>>
>>> Holy shit...
>>>
>>> Where did you say you got all that info from?
>>
>>
>> quoted

[web2py] Re: hello3.xml question

2012-12-19 Thread villas
This may help...

In db.py:

response.generic_patterns = ['*.xml']


See this:
http://web2py.com/books/default/chapter/29/10#Generic-views


On Wednesday, December 19, 2012 10:31:58 PM UTC, Derek wrote:
>
> Yeah, I got the same issue as you. I have a site called 'customers2' and a 
> controller 'customer' and a function 'index' - when i add a '.xml' onto 
> 'index' i get this:
>  
> invalid view (customer/index.xml)
> On Wednesday, December 19, 2012 2:38:36 PM UTC-7, lucas wrote:
>>
>> hello one and all,
>>
>> i am trying to understand the hello3 function under simple_examples and i 
>> don't understand adding .xml to the url directs web2py to convert it into 
>> an xml doc instead of the default html file when the .xml is not included 
>> in the url.  i tried adding .xml to a few of my html returned functions and 
>> it doesn't convert it into xml. so how is that done because i want to be 
>> able to have some data sent as an xml doc as hello3 function?  because to 
>> me it seems that hello3 just looks like a regular html template with dict 
>> returned from the function.
>>
>> thanx in advance, lucas
>>
>

-- 





[web2py] Re: Limits on controller names?

2012-12-19 Thread Wes Hall
Packing and reinstalling the application solved the problem.

Any clues as to what might've happened?

On Wednesday, December 19, 2012 4:59:52 PM UTC-5, Wes Hall wrote:
>
> I was successfully working with a controller 'b.py'. 
>
> I am no longer able to use the included editor to edit this controller. 
> Attempting to access the controller results in a never-ending attempt to 
> load.
>
> Suspecting the file contents, I renamed the controller and .bak to c.py 
> and c.py.bak (there was a b.py.1 file that I renamed as well), then created 
> a new b.py controller with default contents. It opens, but after saving, I 
> can not access it with the editor, even with the default controller 
> content.  Moving the working code to a controller 'bard.py' works fine, so 
> I doubt it has anything to do with the controller code itself.
>
> I'm not sure this is easily reproducible as it was working for an extended 
> period of time. The only thing I can think of is that I possibly had b.py 
> open in two different browsers.  Restarting the machine and the web2py 
> server did not resolve, however.
>
> Any suggestions as to where should I start looking?
>
> Thanks.
>
> Version 2.2.1 (2012-10-21 16:57:04) stable

-- 





Re: [web2py] how to cleanse field value

2012-12-19 Thread Massimo Di Pierro
Here is a custom validator that replaces '-' with '_'

class MyValidator(obejct):
def __call__(self,value):
 return (value.replace('-','_'), None)

Field(..., requires=MyValidator()...)

On Wednesday, 19 December 2012 16:54:21 UTC-6, wwwgong wrote:
>
> I thought validator only validates, can you show me how to update field 
> with the sanitized value.
> Thanks,
>
> On Wednesday, December 19, 2012 9:57:48 AM UTC-5, viniciusban wrote:
>>
>> Try a custom validator to sanitize your description field. 
>>
>>
>> On Wed, Dec 19, 2012 at 12:06 PM, wwwgong  wrote: 
>> > Hi, 
>> > I like to store youtube videos into a table: 
>> > 
>> > db.define_table('youtube', 
>> > Field('code'), 
>> > Field('description') 
>> > ) 
>> > 
>> > def youtube_repr(code,width=400,height=250): 
>> > return XML(""" 
>> >  
>> > > > value="http://www.youtube.com/v/%(code)s&hl=en_US&fs=1&"> 
>> >  
>> >  
>> > http://www.youtube.com/v/%(code)s&hl=en_US&fs=1&" 
>> > type="application/x-shockwave-flash" 
>> allowscriptaccess="always" 
>> > allowfullscreen="true" width="%(width)s" 
>> > height="%(height)s"> 
>> > """ % dict(code=code, width=width, height=height) 
>> > ) 
>> > 
>> > db.youtube.code.represent = youtube_repr 
>> > 
>> > with this controller: 
>> > def youtube_video(): 
>> > form = SQLFORM.grid(db.youtube) 
>> > return dict(form=form) 
>> > 
>> > If the "description" field contains double quote char {"}, it will 
>> messes 
>> > up, 
>> > see screenshot at 
>> > http://dl.dropbox.com/u/54552252/cleanse-web2py-field-value.jpg 
>> > 
>> > I know web2py offers custom validator to detect special char in Form 
>> field, 
>> > but is it possible to attach a pre-process function at DAL layer to 
>> cleanse 
>> > field value before db operation? 
>> > 
>> > Something like: 
>> > 
>> > db.youtube.description.preprocess = cleanse_special_char 
>> > 
>> > where "cleanse_special_char" is a function to cleanse 
>> db.youtube.description 
>> > field value 
>> > 
>> > Can someone offer a solution or workaround? 
>> > 
>> > Thanks, 
>> > Wen 
>> > 
>> > 
>> > -- 
>> > 
>> > 
>> > 
>>
>

-- 





[web2py] Re: web2py interactive shell in windows does not start the browser

2012-12-19 Thread Bhaskar Ramachandran
Thanks Massimo. Again, i am so new to web development.  I learned from your 
web2py book that your framework goes through a series of actions and i am 
assuming it creates objects in memory and fills these objects with user 
data and then processes these objects according to the model, controller 
and view code written for that page request.

Is there a way of looking at the various web2py objects in memory at 
different instances of time for one http request ?. For example, when a 
user submits a login form from browser, it gets to web2py and then web2py 
sets up the enviroment (request, response, cache, session etc objects 
created in memory and populated with information contained in that post 
request from browser) . 
Now is the auth object created in memory with the user inputs of username 
and password  at this time ?. IF so, how can i see the contents of this 
objects at this time  before web2py proceeds further?.

Then web2py runs the model python code and then runs the controller. 
Finally the view. I could be changing the content of the objects, for 
example, the login form object anywhere in this chain - in model code, 
controller code or view code. Can i see how it is modified before it gets 
converted to html by the response object ?. And then can i see the final 
html code it generated at server side ?

Finally, when the html code from server reaches the client, the browser can 
show me the source code and i get to see what web2py has done. But i want 
to see the intermediate actions also

Regards,
Bhaskar


On Tuesday, December 18, 2012 11:20:02 PM UTC-6, Massimo Di Pierro wrote:
>
> You cannot do what you ask because it not logically possible. There is no 
> web2py global state. There is only a state per request for the duration of 
> an http request.
>
> When you open shell you are in a "simulated" http request which does not 
> require the server to be on. It is mostly used to programmatically interact 
> with the db.
>
> Imagine your web server being hit by many requests at the same time. How 
> would you select from the shell which one to interact with? Moreover each 
> request lasts ~5ms.
>
> Massimo
>
>
>
> On Tuesday, 18 December 2012 22:16:33 UTC-6, Bhaskar Ramachandran wrote:
>>
>> Thanks for the reply. But then how do i do interactive debug of the 
>> web2py objects from the shell...?
>> If I can either have the shell or the webserver running, but not both, 
>> then what if i want to run my application and then access the web2py 
>> objects in real time from the shell to know its state. ?
>> By the way, what makes it more interesting to learn web2py is this 
>> support from others  Thanks a lot.
>>
>> Regards,
>> Bhaskar
>>
>>
>>
>>
>> On Sunday, December 16, 2012 9:06:30 PM UTC-6, Massimo Di Pierro wrote:
>>>
>>> As you say -S  starts the shell but not the web server. Without 
>>> -S it starts the web server.
>>> The reason is that you may want one without the other.
>>>
>>>
>>> On Sunday, 16 December 2012 14:38:53 UTC-6, Bhaskar Ramachandran wrote:

 I am new to web2py but very excited to learn and use it on a long term 
 from now. 
 I am having trouble starting an interactive shell (I am using Windows 7 
 OS and have installed python2.5 and pywin32 but not ipython as i don't 
 want 
 ipython shell). 
 I have the latest web2py source copied to C:\. 

 C:\web2py>python web2py.py -S welcome -M
 Sorry, -K only supported for python 2.6-2.7
 web2py Web Framework
 Created by Massimo Di Pierro, Copyright 2007-2012
 Version 2.3.1 (2012-12-14 15:24:12) stable
 Database drivers available: SQLite(sqlite3), MySQL(pymysql), 
 PostgreSQL(pg8000), IMAP(imaplib)
 WARNING:web2py:import IPython error; use default python shell
 Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit 
 (Intel)] on win32
 Type "help", "copyright", "credits" or "license" for more information.
 (InteractiveConsole)
 >>>

 I get the shell but it does not start the browser. Even if i start the 
 browser and enter http://127.0.0.1:8000/welcome/default/index it 
 doesn't work.
 But if i try a non-interactive shell such as the following, i am able 
 to start the server and see the welcome page...

 C:\web2py>python web2py.py
 Sorry, -K only supported for python 2.6-2.7
 web2py Web Framework
 Created by Massimo Di Pierro, Copyright 2007-2012
 Version 2.3.1 (2012-12-14 15:24:12) stable
 Database drivers available: SQLite(sqlite3), MySQL(pymysql), 
 PostgreSQL(pg8000), IMAP(imaplib)
 --
 I get the pop up window to enter admin password and start the server 
 and everything works except an interactive shell...

 Please help.
 Thank you
 Bhaskar







-- 





[web2py] Re: Query results from 2 children tables from same parent ordered by date

2012-12-19 Thread Mamisoa Andriantafika
Best results to UNION I could have was using the mutex table trick:
http://www.xaprb.com/blog/2006/05/26/how-to-write-full-outer-join-in-mysql/
with this syntax:

exams_mutex = db().select(db.dataset1.ALL, db.dataset2.ALL, 
left=[db.dataset1.on(db.mutex.i==0),db.dataset2.on(db.mutex.i==1)])

Two problems left:

1- how to merge the 2 date columns
2- how to order then by date

SQL answer is there:
http://stackoverflow.com/questions/8245630/mysql-combine-two-date-fields-and-then-order-by

SELECT
[some info],
GREATEST( ticket_date, ticket_history_date ) as latest_date
FROM
[tables and join]
ORDER BY
latest_date


Is is possible using to process it using DAL?

Le dimanche 16 décembre 2012 17:40:22 UTC+1, Mamisoa Andriantafika a écrit :
>
> Sorry I still get: "Cannot | incompatible Rows objects".
>
> I'll change the field name "date" you are very right.
>
> Le dimanche 16 décembre 2012 15:49:57 UTC+1, Massimo Di Pierro a écrit :
>>
>> My bad. Thry this:
>>
>> fields1 = [db.dataset1.date, db.dataset1.param1, db.dateset1.patient_id]
>> fields2 = [db.dataset2.date, db.dataset2.test1, db.dateset2.patient_id]
>> rows = ( db(db.dataset1).select(*fields1) | 
>> db(db.dataset2).select(*fields2) ).sort(lambda row: row.date)
>>
>> Mind that having a column called "date" will result in major headaches in 
>> the future.
>>
>> On Sunday, 16 December 2012 03:15:46 UTC-6, Mamisoa Andriantafika wrote:
>>>
>>> Hi again,
>>>
>>> "|" seems not to work because the column numbers is different between 
>>> the 2 tables?
>>>
>>>
>>> Le samedi 15 décembre 2012 20:23:44 UTC+1, Massimo Di Pierro a écrit :

 If you have lots of records you may be able to do it with a database 
 view but that may be db specific.

 If you don't have too many records you can do:

 rows = ( db(db.dataset1).select() | db(db.dataset2).select() 
 ).sort(lambda row: row.date)



 On Saturday, 15 December 2012 08:43:35 UTC-6, Mamisoa Andriantafika 
 wrote:
>
> Hi,
>
> I have this db model:
>
> db.define_table('patients',
> Field('name', 'string', length=32),
> Field('firstname', 'string', length=32),
> Field('dob', 'date'),
> format='%(name)s')
>
> db.define_table('dataset1',
> Field('date', 'date', length=32),
> Field('param1', 'string', length=50),
> Field('param2', 'string', length=50),
> Field('patient_id', db.patients, writable=False, readable=False))
>
> db.define_table('dataset2',
> Field('date', 'date', notnull=True),
> Field('test1', 'text'),
> Field('patient_id', db.patients, writable=False, readable=True))
>
> I'd like to show in one view, for 1 patient_id, all the corresponding 
> dataset1 and dataset2 ordered by date.
>
> What query should I use? Do I have to use an intermediate table 
> 'history' to record each activity in dataset1/2 to get a result?
>
> Thanks for help.
>


-- 





[web2py] Re: Customizing auth login form but unable to set the form class name

2012-12-19 Thread Bhaskar Ramachandran
Hi Anthony,

  I tried that earlier also but that code didn't seem to work. I say so 
because my html page still has that login form on the left side of the 
navigation bar and looking at the source code, i see the following:
 
No class is added.
If I replace the custom form with a hard coded form with class name in the 

> form['_class'] = 'myclass'
>
> or
>
> form.update(_class='myclass')
>
> A form is an HTML helper object, just like any other HTML helper, so the 
> usual rules apply: 
> http://web2py.com/books/default/chapter/29/05#HTML-helpers
>
> Anthony
>
> On Tuesday, December 18, 2012 11:33:32 PM UTC-5, Bhaskar Ramachandran 
> wrote:
>>
>> As listed in the "view" code below, i am trying to customize the form 
>> returned by auth.login(). Note that i have in my controller "return 
>> dict(form=auth.login()). Then in the view code pasted below i am 
>> customizing the login form.
>> It seems to work fine except that i am unable to assign a class name to 
>> this form. So my question is " How to set the class name for a form object 
>> ?. There are posts in the mailing list to specify class name for elements 
>> within the form object but i couldn't find one that explains how the class 
>> name for the form object itself can be assinged. 
>> Please let me know if my question needs more explanation. Thank you.
>>   {{
>> if not auth.is_logged_in() :
>>   if not 'register' in auth.settings.
>> actions_disabled:
>>form.add_button(T('Register'),URL(args
>> ='register'),_class='btn')
>>pass
>>if not 'request_reset_password' inauth
>> .settings.actions_disabled:
>>  form.add_button(T('Lost Password'),
>> URL(args='request_reset_password'),_class='btn')
>> pass 
>>  }}
>> 
>> {{=form.custom.begin}}
>>> "/myscienceapp/default/register?_next=/default/index" style="margin-right: 
>> 10px">Sign Up
>>   
>>  > class="input-small" style="margin-right: 5px; border-radius: 5px 5px 5px 
>> 5px;" type="text" name="email" placeholder="Email"/>
>> > ="margin-right: 2px; border-radius: 5px 5px 5px 5px;" type="password"name
>> ="password" placeholder="Password"/>
>>   > style="margin-right: 
>> 5px; margin-bottom: 0px;border-radius: 5px 5px 5px 5px;" size="5" type=
>> "submit" name="commit" value="Go!" />
>>> style="margin-right: 
>> 5px; margin-bottom: 16px;" type="checkbox" name="remember" value="1" />
>>   > style="margin-right: 
>> 10px;" for="user_remember_me">Remember me
>>   Forgot? 
>>  
>>  {{=form.custom.end}}
>>
>>  {{form.element('div').parent['_class']='navbar-form pull-right 
>> form-inline'}}
>> 
>> {{pass}}
>>   
>>
>>

-- 





[web2py] Re: Customizing auth login form but unable to set the form class name

2012-12-19 Thread Anthony
Sorry, I forgot this doesn't work with form.custom.begin, which is an XML 
object rather than an HTML helper (because it includes only the opening 
form tag). Instead, you could do this:

{{=XML(form.custom.begin.replace('>', ' class="myclass">'))}}

but it's probably more straightforward to just manually code the HTML:



Anthony

On Wednesday, December 19, 2012 6:38:42 PM UTC-5, Bhaskar Ramachandran 
wrote:
>
> Hi Anthony,
>
>   I tried that earlier also but that code didn't seem to work. I say so 
> because my html page still has that login form on the left side of the 
> navigation bar and looking at the source code, i see the following:
>  
> No class is added.
> If I replace the custom form with a hard coded form with class name in the 
>  So, it looks like somehow those statements to set class name are 
> overridden by something else. I have these statements after the custom 
> begin and custom end block in my view file so this is the last thing that 
> is done to the form before it is rendered. 
>
> I tried both your statements below and both of them didn't do anything. If 
> you could also teach me how i can go and debug this situation, ( by looking 
> at the form object in real time if possible to see how it gets modified 
> during web2py execution on that page) it will help me in the long run... 
>
> Thanks! 
> -Bhaskar
>
>
> On Wednesday, December 19, 2012 11:09:48 AM UTC-6, Anthony wrote:
>>
>> form['_class'] = 'myclass'
>>
>> or
>>
>> form.update(_class='myclass')
>>
>> A form is an HTML helper object, just like any other HTML helper, so the 
>> usual rules apply: 
>> http://web2py.com/books/default/chapter/29/05#HTML-helpers
>>
>> Anthony
>>
>> On Tuesday, December 18, 2012 11:33:32 PM UTC-5, Bhaskar Ramachandran 
>> wrote:
>>>
>>> As listed in the "view" code below, i am trying to customize the form 
>>> returned by auth.login(). Note that i have in my controller "return 
>>> dict(form=auth.login()). Then in the view code pasted below i am 
>>> customizing the login form.
>>> It seems to work fine except that i am unable to assign a class name to 
>>> this form. So my question is " How to set the class name for a form object 
>>> ?. There are posts in the mailing list to specify class name for elements 
>>> within the form object but i couldn't find one that explains how the class 
>>> name for the form object itself can be assinged. 
>>> Please let me know if my question needs more explanation. Thank you.
>>>   {{
>>> if not auth.is_logged_in() :
>>>   if not 'register' in auth.settings.
>>> actions_disabled:
>>>form.add_button(T('Register'),URL(
>>> args='register'),_class='btn')
>>>pass
>>>if not 'request_reset_password' inauth
>>> .settings.actions_disabled:
>>>  form.add_button(T('Lost Password'),
>>> URL(args='request_reset_password'),_class='btn')
>>> pass 
>>>  }}
>>> 
>>> {{=form.custom.begin}}
>>>>> "/myscienceapp/default/register?_next=/default/index" style="margin-right: 
>>> 10px">Sign Up
>>>   
>>>  >> class="input-small" style="margin-right: 5px; border-radius: 5px 5px 5px 
>>> 5px;" type="text" name="email" placeholder="Email"/>
>>> >> ="margin-right: 2px; border-radius: 5px 5px 5px 5px;" type="password"name
>>> ="password" placeholder="Password"/>
>>>   >> style="margin-right: 
>>> 5px; margin-bottom: 0px;border-radius: 5px 5px 5px 5px;" size="5" type=
>>> "submit" name="commit" value="Go!" />
>>>>> style="margin-right: 
>>> 5px; margin-bottom: 16px;" type="checkbox" name="remember" value="1" />
>>>   >> style="margin-right: 
>>> 10px;" for="user_remember_me">Remember me
>>>   Forgot? 
>>>  
>>>  {{=form.custom.end}}
>>>
>>>  {{form.element('div').parent['_class']='navbar-form pull-right 
>>> form-inline'}}
>>> 
>>> {{pass}}
>>>   
>>>
>>>

-- 





[web2py] Re: The book updates and status

2012-12-19 Thread Anthony
On Wednesday, December 19, 2012 5:56:48 PM UTC-5, Massimo Di Pierro wrote:

> I have been going over that document. The things in gray were not in the 
> published 4th edition but are in the online version. 
>

Make sure you click the link below -- it's an updated version of the 
original document. All the gray items were removed, and some newer items 
have been added (though some of them may already be in the book).

Anthony

 On Wednesday, 19 December 2012 14:15:46 UTC-6, Anthony wrote:

> This document is a bit old, so some of the items may already have been 
>> added: 
>> https://docs.google.com/document/d/1yQy0F5HcxiecBOBLblrLmAAAsAK6sL37wSL527yssGk/edit
>
>

-- 





[web2py] Re: The book updates and status

2012-12-19 Thread Andrew W
I'm happy to proof read.   Send it through when ready.

Andrew W

On Thursday, December 20, 2012 2:46:41 PM UTC+13, Anthony wrote:
>
> On Wednesday, December 19, 2012 5:56:48 PM UTC-5, Massimo Di Pierro wrote:
>
>> I have been going over that document. The things in gray were not in the 
>> published 4th edition but are in the online version. 
>>
>
> Make sure you click the link below -- it's an updated version of the 
> original document. All the gray items were removed, and some newer items 
> have been added (though some of them may already be in the book).
>
> Anthony
>
>  On Wednesday, 19 December 2012 14:15:46 UTC-6, Anthony wrote:
>
>> This document is a bit old, so some of the items may already have been 
>>> added: 
>>> https://docs.google.com/document/d/1yQy0F5HcxiecBOBLblrLmAAAsAK6sL37wSL527yssGk/edit
>>
>>

-- 





[web2py] Re: web2py interactive shell in windows does not start the browser

2012-12-19 Thread Anthony
A few options:

   - The admin app includes an interactive debugger -- you can set 
   breakpoints in your code and then step through.
   - If you start web2py from the shell via python web2py.py, any print 
   statements in your code will print output to that shell.
   - At any point in your code, you can raise an HTTP 
exceptionto 
immediately return some value to the browser (if it is a compound Python 
   object, you can wrap it in the 
BEAUTIFYhelper for 
better display).
   - In the view, you can add {{=response.toolbar()}}, which will enable 
   you to see all the elements in request, response, and session as well as 
   db query timings.
   - appadmin allows you to see the current content of the cache as well as 
   cache statistics.

Anthony

On Wednesday, December 19, 2012 6:49:17 PM UTC-5, Bhaskar Ramachandran 
wrote:
>
> Thanks Massimo. Again, i am so new to web development.  I learned from 
> your web2py book that your framework goes through a series of actions and i 
> am assuming it creates objects in memory and fills these objects with user 
> data and then processes these objects according to the model, controller 
> and view code written for that page request.
>
> Is there a way of looking at the various web2py objects in memory at 
> different instances of time for one http request ?. For example, when a 
> user submits a login form from browser, it gets to web2py and then web2py 
> sets up the enviroment (request, response, cache, session etc objects 
> created in memory and populated with information contained in that post 
> request from browser) . 
> Now is the auth object created in memory with the user inputs of username 
> and password  at this time ?. IF so, how can i see the contents of this 
> objects at this time  before web2py proceeds further?.
>
> Then web2py runs the model python code and then runs the controller. 
> Finally the view. I could be changing the content of the objects, for 
> example, the login form object anywhere in this chain - in model code, 
> controller code or view code. Can i see how it is modified before it gets 
> converted to html by the response object ?. And then can i see the final 
> html code it generated at server side ?
>
> Finally, when the html code from server reaches the client, the browser 
> can show me the source code and i get to see what web2py has done. But i 
> want to see the intermediate actions also
>
> Regards,
> Bhaskar
>
>
> On Tuesday, December 18, 2012 11:20:02 PM UTC-6, Massimo Di Pierro wrote:
>>
>> You cannot do what you ask because it not logically possible. There is no 
>> web2py global state. There is only a state per request for the duration of 
>> an http request.
>>
>> When you open shell you are in a "simulated" http request which does not 
>> require the server to be on. It is mostly used to programmatically interact 
>> with the db.
>>
>> Imagine your web server being hit by many requests at the same time. How 
>> would you select from the shell which one to interact with? Moreover each 
>> request lasts ~5ms.
>>
>> Massimo
>>
>>
>>
>> On Tuesday, 18 December 2012 22:16:33 UTC-6, Bhaskar Ramachandran wrote:
>>>
>>> Thanks for the reply. But then how do i do interactive debug of the 
>>> web2py objects from the shell...?
>>> If I can either have the shell or the webserver running, but not both, 
>>> then what if i want to run my application and then access the web2py 
>>> objects in real time from the shell to know its state. ?
>>> By the way, what makes it more interesting to learn web2py is this 
>>> support from others  Thanks a lot.
>>>
>>> Regards,
>>> Bhaskar
>>>
>>>
>>>
>>>
>>> On Sunday, December 16, 2012 9:06:30 PM UTC-6, Massimo Di Pierro wrote:

 As you say -S  starts the shell but not the web server. 
 Without -S it starts the web server.
 The reason is that you may want one without the other.


 On Sunday, 16 December 2012 14:38:53 UTC-6, Bhaskar Ramachandran wrote:
>
> I am new to web2py but very excited to learn and use it on a long term 
> from now. 
> I am having trouble starting an interactive shell (I am using Windows 
> 7 OS and have installed python2.5 and pywin32 but not ipython as i don't 
> want ipython shell). 
> I have the latest web2py source copied to C:\. 
>
> C:\web2py>python web2py.py -S welcome -M
> Sorry, -K only supported for python 2.6-2.7
> web2py Web Framework
> Created by Massimo Di Pierro, Copyright 2007-2012
> Version 2.3.1 (2012-12-14 15:24:12) stable
> Database drivers available: SQLite(sqlite3), MySQL(pymysql), 
> PostgreSQL(pg8000), IMAP(imaplib)
> WARNING:web2py:import IPython error; use default python shell
> Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit 
> (Intel)] on win32
> Type "help", "copyright", "credits" or "lice

Re: [web2py] Re: web2py interactive shell in windows does not start the browser

2012-12-19 Thread Bruno Rocha
Alternativelly you can use WINGIDE which gives you an "real time" debugger
shell

http://www.wingware.com/doc/howtos/web2py

Woth this IDE you can have a breakpoint and so in a request you can
inspect the variables for that request.

-- 





[web2py] Re: hello3.xml question

2012-12-19 Thread lucas
oh yeah, that worked absolutely great.  thank you so much.  so cool, data 
can be stripped and sent so many different ways.  so sweet.  lucas

-- 





[web2py] Re: web2py 2.3.2 added "+ -" to some form elements

2012-12-19 Thread howesc
ooops.  i added the - and didn't test the "only 1 row case".  i'll try and 
create a patch tomorrow for it.

mind opening a ticket in google code?

thanks,

christian

On Tuesday, December 18, 2012 8:17:11 AM UTC-8, Daniele wrote:
>
> The newest version of web2py has added some + and - clickable links to 
> form elements so that it is possible to remove the element. However, if 
> there is only one element and one clicks the "-", the form disappears and 
> there's no way to get the form element back without refreshing the page.
>
> I'll post an image so that you can see what it looks like.
>
> I think this is a bug with the newest version because my code hasn't 
> changed at all. There was only a "+" before...
>

--