[web2py] Field.Lazy with SQLFORM.grid

2014-05-29 Thread Paolo Valleri
Hi all, 
I've just discovered that lazy virtual field (aka Field.Lazy) are not shown 
in a SQLFORM.grid neither implicitly (when all fields of a table are shown) 
nor explicitly (by selecting the lazy virtual field using fields).
In the latter case, the SQLFORM.grid raises an error.
The test example is:
def compute_total(row):
print 'compute_total'
return 0

def compute_total_lazy(row):
print 'compute_total_lazy'
return 1

def test():
db.define_table('test_virtual_fields',
Field('title','string', requires=[IS_NOT_EMPTY()]),
Field.Virtual('total', lambda row: compute_total(row)),
Field.Lazy('total_lazy', lambda row: compute_total_lazy(row)),
)
grid = SQLFORM.grid(db.test_virtual_fields)
return response.render('default/index.html', dict(grid=grid))
while by selecting explicitly the fields with

grid = SQLFORM.grid(db.test_virtual_fields, 
fields=[db.test_virtual_fields.title, db.test_virtual_fields.total, 
db.test_virtual_fields.total_lazy])
The following error is raised:

Traceback (most recent call last):
  File "/home/pvalleri/src/web2py/gluon/restricted.py", line 220, in restricted
exec ccode in environment
  File 
"/home/pvalleri/src/web2py/applications/consolrocce/controllers/default.py" 
, line 
266, in 
  File "/home/pvalleri/src/web2py/gluon/globals.py", line 389, in 
self._caller = lambda f: f()
  File 
"/home/pvalleri/src/web2py/applications/consolrocce/controllers/default.py" 
, line 
221, in test
grid = SQLFORM.grid(db.test_virtual_fields, 
fields=[db.test_virtual_fields.title, db.test_virtual_fields.total, 
db.test_virtual_fields.total_lazy])
  File "/home/pvalleri/src/web2py/gluon/sqlhtml.py", line 2024, in grid
columns = [f for f in fields if f.tablename in tablenames]
AttributeError: 'FieldMethod' object has no attribute 'tablename'



Paolo




-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: which version of bootstrap is web2py running?

2014-05-29 Thread Niphlod
source too.

https://github.com/web2py/web2py/blob/master/applications/welcome/static/css/bootstrap.min.css

On Thursday, May 29, 2014 5:52:56 AM UTC+2, weheh wrote:
>
> title says it all
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: sqlform.grid with linked tables

2014-05-29 Thread Mirek Zvolský
To see 2 table grids without any relationship - return from controller:
return dict(grid1 = grid(..), grid2 = grid(..))
and render it in view:
{{=grid1}}
{{=grid2}}
For grid(..) syntax you already have examples here.

To see parent grid with links to children tables, use smartgrid
return dict(grid = smartgrid(..))
syntax is very similar and rendering is the same

To see parent grid and dynamically child records based on current record in 
parent grid you could try use ajax.
Use standard grid(), see source code in browser, set javascript event 
(jaavscript or jquery) to record click, return second grid via ajax() call 
(see chapter about ajax).
I never made this but I think it is possible



Dne úterý, 20. května 2014 23:50:23 UTC+2 Juan Luis napsal(a):
>
> thank you stifan, represent is what I needed to know and your example 
> worked perfect.
>
> My primary problem is that i am not able to see my other table in 
> SQLFORM.grid. Here I try to create two columns; one from db.contact and the 
> other from db.task. 
>
> Can my error be noticed?
>
>
>
> On Tuesday, May 20, 2014 3:06:28 PM UTC-5, 黄祥 wrote:
>>
>> please try (not tested) :
>>
>> Field('email', 'list:string', represent = lambda email, field: \
>> XML(", ".join([A(mail, _title=T("Send to %s") % mail, 
>> _target="_blank", 
>>  _href="mailto:%s"; % mail).xml() for mail in 
>> email] ) ) if email else ''), 
>> Field('website', represent = lambda website, field: \
>> A(website, _title = T("View Website"), _target = "_blank", 
>> _href = "%s" % website) if website else ''), 
>>
>> and please take a look the book at dal chapter:
>>
>> http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer
>>
>> best regards,
>> stifan
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: requires IS_IN_DB set as a union of two queries

2014-05-29 Thread Carlos Costa
Sorry, I should have written:

db.owner.own_veh_fk.requires=IS_IN_DB(db(query),'vehicle.id',
'%(manufacturer)s %(vin)s')

If you need to pass a set so you need to call db(query) in order to execute
the query.



2014-05-28 21:46 GMT-03:00 <98uj...@gmail.com>:

> I did try:
> query =  query1 | guery2
> and received error: "Set | Set" or similar
>
>
> On Wednesday, May 28, 2014 7:47:36 PM UTC-4, 98u...@gmail.com wrote:
>>
>> Thank you Mr. Massimo and your colleagues for bringing the web2py to the
>> masses.
>> I need to have a field that will present a choice of values that result
>> from a union of query1 and query2
>> How can i create a set that would go where the question mark is? Thanks
>> for any help!
>>
>> query1=((db.vehicle.id==db.owner.own_veh_fk)&(db.owner.
>> own_end_date!=None))
>>
>> query2=(~db.vehicle.id.belongs(db(db.owner.own_veh_fk==db.vehicle.id
>> )._select(db.vehicle.id)))
>>
>> db.owner.own_veh_fk.requires=IS_IN_DB((db(?)),'vehicle.id',
>> '%(manufacturer)s %(vin)s')
>>
>>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Att.

Carlos J. Costa
Cientista da Computação
Esp. Gestão em Telecom

EL MELECH NEEMAN!
אָמֵן

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Javascript I use to LOAD forms in modals.

2014-05-29 Thread Leonel Câmara
Hey,

I have seen a few people using modals here. So this may be useful to 
someone.

function load_in_modal(url, modal_id, options) {
if (typeof options === 'undefined') {
  /* Example Options:   * {title: "Add Image", upload_form: true}   
*/
  options = {};
}

/* * You can remove this if you don't want to deal with file uploads.   
  * If you want to use this, the view/controller using this should * insert 
jquery.form.js on response.files. */
if (Boolean(options.upload_form)) {
$.web2py.trap_form = function (action, target) {
  /* traps any LOADed form */
  $('#' + target + ' form').each(function (i) {
var form = $(this);
if (form.hasClass('no_trap')) {
  return;
}

form.attr('data-w2p_target', target);
var url = form.attr('action');

if ((url === "") || (url === "#")) {
  /* form has no action. Use component url. */
  url = action;
}

if(form.find('.input-file').length>0) {
form.ajaxForm({
url: action,
success: function(data, statusText, xhr) {
jQuery('#'+target).html(xhr.responseText);
$.web2py.trap_form(action,target);
$.web2py.ajax_init();
}
});
}
else {
form.submit(function (e) {
  
$.web2py.disableElement(form.find($.web2py.formInputClickSelector));
  $.web2py.hide_flash();
  $.web2py.ajax_page('post', url, form.serialize(), target, 
form);
  e.preventDefault();
});
}
  });
};
}
/* end of file upload dealing code */


/* Remember to set an id in your modal's body */
$.web2py.component(url, $('#' + modal_id + ' .modal-body').attr('id'));

$('#' + modal_id).modal({show: true});
if (typeof options.title !== undefined) {
$('#' + modal_id + ' .modal-title').text(options.title);
}}



It's pretty self explanatory. You need to have the modal structure already 
in the HTML remembering to add an id attribute to the modal's body. Then 
you call load_in_modal usually in a onclick event.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: DAL/Decorator for specific data

2014-05-29 Thread Tom Russell
Works perfect, thanks Anthony.

On Wednesday, May 28, 2014 11:10:37 AM UTC-4, Anthony wrote:
>
> You can include logic to set the readable and writable attributes of 
> particular fields to True/False depending on Auth group membership. For 
> example:
>
> db.define_table('mytable', Field('myfield', readable=False, writable=False
> ))
>
> if auth.has_membership('admin'):
> db.mytable.myfield.readable = db.mytable.myfield.writable = True
>
> I suppose you could write a decorator that does that, but it's not clear 
> there would be any benefit over the simple approach above.
>
> Anthony
>
> On Wednesday, May 28, 2014 11:00:13 AM UTC-4, Tom Russell wrote:
>>
>> I have read through the docs but have not come across what I am trying to 
>> do, if its possible.
>>
>> I have a table with 40 columns of data, I want to use a decorator or 
>> similar to only allow some of them viewable while others in a different 
>> membership group can see all of the columns.
>>
>> Is this something that can be done?
>>
>> Thanks,
>>
>> Tom
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Google security patch progrem

2014-05-29 Thread Massimo Di Pierro
Find, report and fix a security issue in web2py (or other system) and 
google may pay you:

https://www.google.com/about/appsecurity/patch-rewards/

A rep from google emailed me about this.

Massimo

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Personalizar auth

2014-05-29 Thread Natalia Almeyda
Hola!

Quisiera averiguar cómo puedo modificar los campos de auth que se ven en la 
vista??

Gracias!!


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: not able to include jqueryui in web2py

2014-05-29 Thread sarfaraz ahmed
Thanks for the first reply in this group... This is my first question. I
included this in my code with a small mistake. You got it fixed. The
accordion started working as per custom  them but button are not appearing
as required.

I have


  $(function() {
$( "#accordion" ).accordion(); $( "#accordion" ).accordion();
  });
  



On Wed, May 28, 2014 at 3:34 PM, Niphlod  wrote:

> where is the javascript part that "turns on" the accordion effect ?
>
> 
>   $(function() {
> $( "#accordion" ).accordion();
>   });
>   
>
>
> On Tuesday, May 27, 2014 2:41:28 PM UTC+2, sarfaraz ahmed wrote:
>>
>> Hello All,
>>
>> I am trying to override the web2py default theme and use customized
>> jqueryui theme. Hence I downloaded the customized jqueryui js files and css
>> files. Copied them to static folder of my test project. I created the
>> jqueryui folder under static folder. I created the layout1.html file which
>> I am using as extended layout. Mentioned below is first code in layout1.html
>> *Part1 : *
>>  response.files.insert(0,URL('static','jqueryui/css/excite-
>> bike/jquery-ui-1.10.4.custom.css'))
>>   response.files.insert(1,URL('static','jqueryui/js/jquery-1.10.2.js'))
>>   response.files.insert(2,URL('static','jqueryui/js/jquery-
>> ui-1.10.4.custom.js'))
>>   response.files.insert(3,URL('static','css/web2py.css'))
>>   response.files.insert(4,URL('static','css/bootstrap.min.css'))
>>   response.files.insert(5,URL('static','css/bootstrap-
>> responsive.min.css'))
>>   response.files.insert(6,URL('static','css/web2py_bootstrap.css'))
>>
>>   }}
>>
>>   {{include 'web2py_ajax.html'}}
>> 
>> $(function() {
>>  $( "#accordion" ).accordion();
>> $( "#button" ).button();
>> )};
>>   
>>
>> 
>> under default.index.html i wrote
>> {{extend 'layout1.html'}}
>> 
>> 
>> Par1
>> 
>> 
>> This is new para
>> 
>> 
>> Par1
>> 
>> 
>> This is new para
>> 
>>
>> 
>> Now when I press F12 to check html page source I see all the files are
>> properly included (I mean js and css files) However, I don't see accordion
>> or button from jqueryui theme.
>>
>> I read the one article posted by rami. I am newbie and fail to reach
>> solution from that thread. Please post step by step help.
>> Regards,
>> Sarfaraz Ahmed
>>
>>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Thanks with regards,
Sarfaraz Ahmed

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Google security patch progrem

2014-05-29 Thread Michele Comitini
Currently, the scope is limited to the following projects:
 - ...
 - ...

web2py the only one not in the list! ;-)


2014-05-29 19:16 GMT+02:00 Massimo Di Pierro :
> Find, report and fix a security issue in web2py (or other system) and google
> may pay you:
>
> https://www.google.com/about/appsecurity/patch-rewards/
>
> A rep from google emailed me about this.
>
> Massimo
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] import right here?

2014-05-29 Thread Pham Quang Dung
I have placed an __init__.py file in the folder (windows) of the controller 
xyz.py but cannot import abc.py at the same location. Any hints to use path 
+ file name, or copy the abc.py to where? I am newbee, sorry.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: reddit clone - foreign key constraint failed

2014-05-29 Thread Chris Simpson

Hi Uri,

Did you ever find a solution to this?
On Wednesday, May 14, 2014 12:01:29 PM UTC+2, Uri Tamir wrote:
>
> Hi all,
> I've been following Massimo's video tutorials 
> (which are 
> *great!* thanks Massimo)
>
> when trying to build the reddit clone and populate it i get a ticket 
> -  foreign key constraint failed
>
> the database was populated with users and posts but not with comments. I 
> tried to make sure my code is exactly as the code Massimo showed but /w no 
> success.
>
> any suggestions?
>
> db.define_table('category',
> Field('name', requires = (IS_SLUG(), IS_LOWER(), 
> IS_NOT_IN_DB(db, 'category.name'
>
> db.define_table('post',
> Field('category', 'reference category', readable=False, 
> writable=False),
> Field('title', 'string', requires=IS_NOT_EMPTY()),
> Field('url', requires=IS_EMPTY_OR(IS_URL())),
> Field('body', 'text', requires=IS_NOT_EMPTY()),
> Field('votes', 'integer', default=0, readable=False, 
> writable=False),
> auth.signature) # created_on, created_by, modified_on, 
> modified_by, is_active
>
> db.define_table('post_vote',
> Field('post', 'reference post'),
> Field('score', 'integer', default=+1), # numerical 
> representation of votes
> auth.signature)
>
> db.define_table('comm',
> Field('post', 'reference post'),
> Field('parent_comm', 'reference comm'),
> Field('votes', 'integer'),
> Field('body', 'text'),
> auth.signature)
>
> db.define_table('comm_vote',
> Field('comm', 'reference comm'),
> Field('score', 'integer', default=+1), # numerical 
> representation of votes
> auth.signature)
>
> from gluon.contrib.populate import populate
> if db(db.auth_user).count()<2:
> populate(db.auth_user, 100)
> db.commit()
> if db(db.post).count()<2:
> populate(db.post, 500)
> db.commit()
> if db(db.comm).count()<2:
> populate(db.comm, 1000)
> db.commit()
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] a simple naive question about the Submit button?

2014-05-29 Thread Pham Quang Dung
Appreciate a simple hint if possible but I spent hours and could not trace 
anywhere in the code where I could see how to modify the way 
SQLForm.smartgrid takes a DB actions, such as save or delete.
The ultimate purpose is to customize the grid so that I donot need to click 
View/Edit/Delete per each row but for all at once (e.g batch updates) and 
no second page jumps.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] DAL doesn't fully support datetime operations

2014-05-29 Thread Pham Quang Dung
I tried a query like *db().select(xx.writetime - timedelta(minutes=5)) *and 
the result was totally a surprise because it was of type "Int". Thoughts?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: which version of bootstrap is web2py running?

2014-05-29 Thread kyriakopoulos
 
 web2py  / 
applications/ 
welcome / 
static/
 
css/
 *bootstrap.min.css   
line 2: *

 * Bootstrap v2.3.2

 says it all :)

Am Donnerstag, 29. Mai 2014 05:52:56 UTC+2 schrieb weheh:
>
> title says it all
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Google glyphicons PRO

2014-05-29 Thread Mario Linz
Hi all,

We have a problem by using the pro version of goole glyphicons.

*Free Version:*
For using the free version of the glyphicons on the bootstrap css page 
there is a very good preview for all available icons + all references the 
svg paths are set in the *glyphicons.less* file. As example:

.glyphicon-cloud  { &:before { content: "\2601"; } }
.glyphicon-envelope   { &:before { content: "\2709"; } }
.glyphicon-pencil { &:before { content: "\270f"; } }


So. now we have pay the GLYPHICONS PRO with 470 vector icons.
The problem here is. there are no less files with references to the svg 
paths etc there are no help for using the pro variant of glyphicons.
Also the svg file structure is not the same like the free version. 
Which files I have to use from the directories? And how we can use all 
icons from glyphicons, social, halflings and filetypes together?

I don't understand this all from the PRO version .. hope you can help me.

Best regards,
Mario

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Urgent required Java Developer - Washington, DC

2014-05-29 Thread Gary .
*Please respond to gurjant.si...@damcosoft.com
*


*Position: Java Developer*

*Location: Washington, DC*

*Duration: 6+ Months*



*Visa: USC/GC/EAD only*



Job Description:

Core java skills with some *groovy experience* is must

4-7 yrs exp. Strong communication skills, can work independently, strong
oops concept, design exposure, and oracle db exposure via java programming.


Thanks and Regards,



Gurjant Singh - (Gary)

Technical Recruiter

+1 212 389 9503 ext 208

E: gurjant.si...@damcosoft.com



*NY Office:  *112 W 34th St, 18th Floor, New York, NY 10120

*NJ Office:  *894 Green Street, Suite B, Iselin, NJ 08830



Corporate: www.damcosoft.com

*[image: Description: cid:image002.jpg@01CEDAE3.C3BE19D0]*



*[image: Description: cid:image006.jpg@01CEDAE5.F56ED350]*



*P** Please consider the planet before printing | Switch off as you go
|**q**Recycle
always |* *Your child deserves a better world*

*CONFIDENTIALITY NOTICE:** This e-mail message, including any attachments,
is for the sole use of the intended recipient(s) and may contain
confidential and privileged information. Any unauthorized review, use,
disclosure or distribution is prohibited. If you are not the intended
recipient, please contact the sender by reply e-mail and destroy all copies
of the original message*

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Using jqueryui button widget

2014-05-29 Thread sarfaraz ahmed
Hello All,

I am trying to use customer jquery ui theme. I included file and script in 
the layout.html. Made changes to view index.html. Everything worked fine 
except the button. jquery button is not appearing. When I click on inspect 
element i found it going to bootstrap.min.css. Not sure. I am new to web 
programming. 

Regards,
Sarfaraz Ahmed

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] SUM trouble

2014-05-29 Thread Floyd Noel
Hello all,

New web2py user here. I'm trying to translate the following query to work 
in the DAL:

SELECT items.description, sum(quantity) FROM orders.items GROUP BY 
description;

This gives me the items together with the quantity totals for each type of 
item. I'm having trouble getting this to work in web2py however.

I've tried this:

items = db.t_items
desc = items.f_description
qty = items.f_quantity
count_view = db().select(desc, qty.sum(), groupby=desc).as_list()

Which doesn't work. If I remove the .sum(), I just get one entries' 
quantity. How can I make this work? TIA


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Upload image using RESTful api

2014-05-29 Thread iw3ijq
Found the issue:

storage of files is handled by sqlhtml and not by DAL.
So I have to write a function that replicate te file storage part of 
sqlhtml.

Il giorno martedì 6 maggio 2014 15:19:22 UTC+2, iw3...@gmail.com ha scritto:
>
> Thaks, I will try. 
> I don't think that the iproblem is the request. Using a socket sniffer I 
> saw that request made by browser and my script are the same.
> The problem could be in restful api.
>
> Il giorno martedì 6 maggio 2014 00:33:00 UTC+2, samuel bonill ha scritto:
>>
>> i use postman(http://www.getpostman.com/) for test restful api and works 
>> grate...
>>
>> El lunes, 5 de mayo de 2014 11:49:50 UTC-5, iw3...@gmail.com escribió:
>>>
>>> Hi!
>>>
>>> I have a SQLFORM with some filelds and an image (like example here: 
>>> http://web2py.com/books/default/chapter/29/07/forms-and-validators#SQLFORM).
>>>
>>> I have to populate the database using a python script. So I made a 
>>> generic restful api:
>>>
>>> @request.restful()
>>> def api():
>>> response.view = 'generic.'+request.extension
>>> def GET(*args,**vars):
>>> patterns = [':auto[products]',
>>> '/products/code/{products.code}',
>>> '/products/code/{products.code}/:field',
>>> '/products/image_filename/{products.image_filename}'
>>> ,
>>> 
>>> '/products/image_filename/{products.image_filename}/:field',
>>>]
>>> parser = db.parse_as_rest(patterns,args,vars)
>>> if parser.status == 200:
>>> return dict(content=parser.response)
>>> else:
>>> raise HTTP(parser.status,parser.error)
>>> def POST(table_name,**vars):
>>> return db[table_name].validate_and_insert(**vars)
>>> def PUT(table_name,record_id,**vars):
>>> return db(db[table_name]._id==record_id).validate_and_update(**
>>> vars)
>>> def DELETE(table_name,record_id):
>>> return db(db[table_name]._id==record_id).delete()
>>> return dict(GET=GET, POST=POST, PUT=PUT, DELETE=DELETE)
>>>
>>> On python script  I use requests.post and genercs fields are ok.
>>> I used sintax from here ( 
>>> http://docs.python-requests.org/en/latest/user/quickstart/#post-a-multipart-encoded-file
>>>  
>>> ).
>>> This upload generally work but I have a big problem:
>>> uploading file from browser I find on DB the encoded name of file, and 
>>> dhe file on filesystem.
>>> Uploading from restful I find on db, instead of encoded file name, this:
>>>
>>> 'FieldStorage(''image'', ''test_image.jpg'', ''...binary data of 
>>> image'')'
>>>
>>> What's the correct way to upload a file using restful api?
>>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] ValueError: invalid literal for int() with base 10:

2014-05-29 Thread Tom Russell
I am getting the following error when inserting a new record for a table I 
have. I cannot seem to pinpoint what the cause is at this time.

The error is:

Traceback (most recent call last):
  File 
"/home/tsrdatatech/web2py/applications/ttheorydataextractor/controllers/appadmin.py",
 line 270, in select
*fields, limitby=(start, stop))
  File "/home/tsrdatatech/web2py/gluon/dal.py", line 10525, in select
return adapter.select(self.query,fields,attributes)
  File "/home/tsrdatatech/web2py/gluon/dal.py", line 2458, in select
return super(SQLiteAdapter, self).select(query, fields, attributes)
  File "/home/tsrdatatech/web2py/gluon/dal.py", line 1882, in select
return self._select_aux(sql,fields,attributes)
  File "/home/tsrdatatech/web2py/gluon/dal.py", line 1847, in _select_aux
self.execute(sql)
  File "/home/tsrdatatech/web2py/gluon/dal.py", line 1969, in execute
return self.log_execute(*a, **b)
  File "/home/tsrdatatech/web2py/gluon/dal.py", line 1963, in log_execute
ret = self.cursor.execute(command, *a[1:], **b)
  File "/usr/lib/python2.7/sqlite3/dbapi2.py", line 63, in convert_date
return datetime.date(*map(int, val.split("-")))
ValueError: invalid literal for int() with base 10: '12/02/2013'


And my table looks like:

db.define_table("daily_data",
 Field("startdate","date",requires=IS_DATE(), label="Date", 
readable=True, writable=False),
 Field("vol_total","double", label="Vol Total", readable=True, 
writable=False),
 Field("wsj_date","string", label="WSJ Date", readable=True, 
writable=False),
 Field("trin","double", label="TRIN", readable=True, writable=False),
 Field("gold","double", readable=True, writable=False),
 Field("vix","double", label="VIX", readable=False, writable=False),
 Field("advances","double", readable=True, writable=False),
 Field("declines","double", readable=True, writable=False),
 Field("adv_vol","double", readable=True, writable=False),
 Field("dec_vol","double", readable=True, writable=False),
 Field("sp_hi","double", readable=True, writable=False),
 Field("sp_low","double", readable=True, writable=False),
 Field("sp_close","double", readable=True, writable=False),
 Field("spy","double", label="SPY", readable=False, writable=False),
 Field("csj","double", label="CSJ", readable=False, writable=False),
 Field("bnd","double", label="BND", readable=False, writable=False),
 Field("cwb","double", label="CWB", readable=False, writable=False),
 Field("bond","double", label="BOND", readable=False, writable=False),
 Field("hys","double", label="HYS", readable=False, writable=False),
 Field("flot","double", label="FLOT", readable=False, writable=False),
 Field("hyg","double", label="HYG", readable=False, writable=False),
 Field("bkln","double", label="BKLN", readable=False, writable=False),
 Field("emb","double", label="EMB", readable=False, writable=False),
 Field("efa","double", label="EFA", readable=False, writable=False),
 Field("fex","double", label="FEX", readable=False, writable=False),
 Field("mdy","double", label="MDY", readable=False, writable=False),
 Field("fnx","double", label="FNX", readable=False, writable=False),
 Field("vti","double", label="VTI", readable=False, writable=False),
 Field("iwd","double", label="IWD", readable=False, writable=False),
 Field("fta","double", label="FTA", readable=False, writable=False),
 Field("iwm","double", label="IWM", readable=False, writable=False),
 Field("dvy","double", label="DVY", readable=False, writable=False),
 Field("iyr","double", label="IYR", readable=False, writable=False),
 Field("ijr","double", label="IJR", readable=False, writable=False),
 Field("tlt","double", label="TLT", readable=False, writable=False),
 Field("ief","double", label="IEF", readable=False, writable=False),
 Field("vustx","double", label="VUSTX", readable=False, writable=False),
 Field("fagix","double", label="FAGIX", readable=False, writable=False),
 Field("qqq","double", label="QQQ", readable=False, writable=False),
)

I know the error refers to a date and actually I had wsj_date as a date 
field but changed it to a string since I really did not need the date 
requirement for it.

Any suggestions?

Thanks.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: DAL doesn't fully support datetime operations

2014-05-29 Thread Niphlod
This will never work because there is no notion of "timedelta" in any db 
backend (nor any substitute for it).
Calculate the result AFTER fetching the rows from the db. 

On Thursday, May 29, 2014 12:32:41 PM UTC+2, Pham Quang Dung wrote:
>
> I tried a query like *db().select(xx.writetime - timedelta(minutes=5)) *and 
> the result was totally a surprise because it was of type "Int". Thoughts?
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: import right here?

2014-05-29 Thread Niphlod
read the book before posting. from here onwards there is the documentation 
about third-party modules and the execution environment of web2py.
http://web2py.com/books/default/chapter/29/04/the-core#Third-party-modules

On Thursday, May 29, 2014 12:40:43 PM UTC+2, Pham Quang Dung wrote:
>
> I have placed an __init__.py file in the folder (windows) of the 
> controller xyz.py but cannot import abc.py at the same location. Any hints 
> to use path + file name, or copy the abc.py to where? I am newbee, sorry.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: SUM trouble

2014-05-29 Thread Niphlod
use this docs to shed some light ^_^

http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#sum--avg--min--max-and-len

On Wednesday, May 28, 2014 10:45:32 PM UTC+2, Floyd Noel wrote:
>
> Hello all,
>
> New web2py user here. I'm trying to translate the following query to work 
> in the DAL:
>
> SELECT items.description, sum(quantity) FROM orders.items GROUP BY 
> description;
>
> This gives me the items together with the quantity totals for each type of 
> item. I'm having trouble getting this to work in web2py however.
>
> I've tried this:
>
> items = db.t_items
> desc = items.f_description
> qty = items.f_quantity
> count_view = db().select(desc, qty.sum(), groupby=desc).as_list()
>
> Which doesn't work. If I remove the .sum(), I just get one entries' 
> quantity. How can I make this work? TIA
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: ValueError: invalid literal for int() with base 10:

2014-05-29 Thread Niphlod
drop the table and recreate it. It's a known issue with sqlite.
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#SQLite

On Thursday, May 29, 2014 9:34:28 PM UTC+2, Tom Russell wrote:
>
> I am getting the following error when inserting a new record for a table I 
> have. I cannot seem to pinpoint what the cause is at this time.
>
> The error is:
>
> Traceback (most recent call last):
>   File 
> "/home/tsrdatatech/web2py/applications/ttheorydataextractor/controllers/appadmin.py",
>  line 270, in select
> *fields, limitby=(start, stop))
>   File "/home/tsrdatatech/web2py/gluon/dal.py", line 10525, in select
> return adapter.select(self.query,fields,attributes)
>   File "/home/tsrdatatech/web2py/gluon/dal.py", line 2458, in select
> return super(SQLiteAdapter, self).select(query, fields, attributes)
>   File "/home/tsrdatatech/web2py/gluon/dal.py", line 1882, in select
> return self._select_aux(sql,fields,attributes)
>   File "/home/tsrdatatech/web2py/gluon/dal.py", line 1847, in _select_aux
> self.execute(sql)
>   File "/home/tsrdatatech/web2py/gluon/dal.py", line 1969, in execute
> return self.log_execute(*a, **b)
>   File "/home/tsrdatatech/web2py/gluon/dal.py", line 1963, in log_execute
> ret = self.cursor.execute(command, *a[1:], **b)
>   File "/usr/lib/python2.7/sqlite3/dbapi2.py", line 63, in convert_date
> return datetime.date(*map(int, val.split("-")))
> ValueError: invalid literal for int() with base 10: '12/02/2013'
>
>
> And my table looks like:
>
> db.define_table("daily_data",
>  Field("startdate","date",requires=IS_DATE(), label="Date", 
> readable=True, writable=False),
>  Field("vol_total","double", label="Vol Total", readable=True, 
> writable=False),
>  Field("wsj_date","string", label="WSJ Date", readable=True, 
> writable=False),
>  Field("trin","double", label="TRIN", readable=True, writable=False),
>  Field("gold","double", readable=True, writable=False),
>  Field("vix","double", label="VIX", readable=False, writable=False),
>  Field("advances","double", readable=True, writable=False),
>  Field("declines","double", readable=True, writable=False),
>  Field("adv_vol","double", readable=True, writable=False),
>  Field("dec_vol","double", readable=True, writable=False),
>  Field("sp_hi","double", readable=True, writable=False),
>  Field("sp_low","double", readable=True, writable=False),
>  Field("sp_close","double", readable=True, writable=False),
>  Field("spy","double", label="SPY", readable=False, writable=False),
>  Field("csj","double", label="CSJ", readable=False, writable=False),
>  Field("bnd","double", label="BND", readable=False, writable=False),
>  Field("cwb","double", label="CWB", readable=False, writable=False),
>  Field("bond","double", label="BOND", readable=False, writable=False),
>  Field("hys","double", label="HYS", readable=False, writable=False),
>  Field("flot","double", label="FLOT", readable=False, writable=False),
>  Field("hyg","double", label="HYG", readable=False, writable=False),
>  Field("bkln","double", label="BKLN", readable=False, writable=False),
>  Field("emb","double", label="EMB", readable=False, writable=False),
>  Field("efa","double", label="EFA", readable=False, writable=False),
>  Field("fex","double", label="FEX", readable=False, writable=False),
>  Field("mdy","double", label="MDY", readable=False, writable=False),
>  Field("fnx","double", label="FNX", readable=False, writable=False),
>  Field("vti","double", label="VTI", readable=False, writable=False),
>  Field("iwd","double", label="IWD", readable=False, writable=False),
>  Field("fta","double", label="FTA", readable=False, writable=False),
>  Field("iwm","double", label="IWM", readable=False, writable=False),
>  Field("dvy","double", label="DVY", readable=False, writable=False),
>  Field("iyr","double", label="IYR", readable=False, writable=False),
>  Field("ijr","double", label="IJR", readable=False, writable=False),
>  Field("tlt","double", label="TLT", readable=False, writable=False),
>  Field("ief","double", label="IEF", readable=False, writable=False),
>  Field("vustx","double", label="VUSTX", readable=False, 
> writable=False),
>  Field("fagix","double", label="FAGIX", readable=False, 
> writable=False),
>  Field("qqq","double", label="QQQ", readable=False, writable=False),
> )
>
> I know the error refers to a date and actually I had wsj_date as a date 
> field but changed it to a string since I really did not need the date 
> requirement for it.
>
> Any suggestions?
>
> Thanks.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubs

[web2py] Re: ValueError: invalid literal for int() with base 10:

2014-05-29 Thread Tom Russell
awesome, worked.

On Thursday, May 29, 2014 3:41:12 PM UTC-4, Niphlod wrote:
>
> drop the table and recreate it. It's a known issue with sqlite.
>
> http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#SQLite
>
> On Thursday, May 29, 2014 9:34:28 PM UTC+2, Tom Russell wrote:
>>
>> I am getting the following error when inserting a new record for a table 
>> I have. I cannot seem to pinpoint what the cause is at this time.
>>
>> The error is:
>>
>> Traceback (most recent call last):
>>   File 
>> "/home/tsrdatatech/web2py/applications/ttheorydataextractor/controllers/appadmin.py",
>>  line 270, in select
>> *fields, limitby=(start, stop))
>>   File "/home/tsrdatatech/web2py/gluon/dal.py", line 10525, in select
>> return adapter.select(self.query,fields,attributes)
>>   File "/home/tsrdatatech/web2py/gluon/dal.py", line 2458, in select
>> return super(SQLiteAdapter, self).select(query, fields, attributes)
>>   File "/home/tsrdatatech/web2py/gluon/dal.py", line 1882, in select
>> return self._select_aux(sql,fields,attributes)
>>   File "/home/tsrdatatech/web2py/gluon/dal.py", line 1847, in _select_aux
>> self.execute(sql)
>>   File "/home/tsrdatatech/web2py/gluon/dal.py", line 1969, in execute
>> return self.log_execute(*a, **b)
>>   File "/home/tsrdatatech/web2py/gluon/dal.py", line 1963, in log_execute
>> ret = self.cursor.execute(command, *a[1:], **b)
>>   File "/usr/lib/python2.7/sqlite3/dbapi2.py", line 63, in convert_date
>> return datetime.date(*map(int, val.split("-")))
>> ValueError: invalid literal for int() with base 10: '12/02/2013'
>>
>>
>> And my table looks like:
>>
>> db.define_table("daily_data",
>>  Field("startdate","date",requires=IS_DATE(), label="Date", 
>> readable=True, writable=False),
>>  Field("vol_total","double", label="Vol Total", readable=True, 
>> writable=False),
>>  Field("wsj_date","string", label="WSJ Date", readable=True, 
>> writable=False),
>>  Field("trin","double", label="TRIN", readable=True, writable=False),
>>  Field("gold","double", readable=True, writable=False),
>>  Field("vix","double", label="VIX", readable=False, writable=False),
>>  Field("advances","double", readable=True, writable=False),
>>  Field("declines","double", readable=True, writable=False),
>>  Field("adv_vol","double", readable=True, writable=False),
>>  Field("dec_vol","double", readable=True, writable=False),
>>  Field("sp_hi","double", readable=True, writable=False),
>>  Field("sp_low","double", readable=True, writable=False),
>>  Field("sp_close","double", readable=True, writable=False),
>>  Field("spy","double", label="SPY", readable=False, writable=False),
>>  Field("csj","double", label="CSJ", readable=False, writable=False),
>>  Field("bnd","double", label="BND", readable=False, writable=False),
>>  Field("cwb","double", label="CWB", readable=False, writable=False),
>>  Field("bond","double", label="BOND", readable=False, writable=False),
>>  Field("hys","double", label="HYS", readable=False, writable=False),
>>  Field("flot","double", label="FLOT", readable=False, writable=False),
>>  Field("hyg","double", label="HYG", readable=False, writable=False),
>>  Field("bkln","double", label="BKLN", readable=False, writable=False),
>>  Field("emb","double", label="EMB", readable=False, writable=False),
>>  Field("efa","double", label="EFA", readable=False, writable=False),
>>  Field("fex","double", label="FEX", readable=False, writable=False),
>>  Field("mdy","double", label="MDY", readable=False, writable=False),
>>  Field("fnx","double", label="FNX", readable=False, writable=False),
>>  Field("vti","double", label="VTI", readable=False, writable=False),
>>  Field("iwd","double", label="IWD", readable=False, writable=False),
>>  Field("fta","double", label="FTA", readable=False, writable=False),
>>  Field("iwm","double", label="IWM", readable=False, writable=False),
>>  Field("dvy","double", label="DVY", readable=False, writable=False),
>>  Field("iyr","double", label="IYR", readable=False, writable=False),
>>  Field("ijr","double", label="IJR", readable=False, writable=False),
>>  Field("tlt","double", label="TLT", readable=False, writable=False),
>>  Field("ief","double", label="IEF", readable=False, writable=False),
>>  Field("vustx","double", label="VUSTX", readable=False, 
>> writable=False),
>>  Field("fagix","double", label="FAGIX", readable=False, 
>> writable=False),
>>  Field("qqq","double", label="QQQ", readable=False, writable=False),
>> )
>>
>> I know the error refers to a date and actually I had wsj_date as a date 
>> field but changed it to a string since I really did not need the date 
>> requirement for it.
>>
>> Any suggestions?
>>
>> Thanks.
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)

Re: [web2py] Google security patch progrem

2014-05-29 Thread Massimo Di Pierro
I had not noticed. I have asked my contact.

On Thursday, 29 May 2014 12:25:10 UTC-5, Michele Comitini wrote:
>
> Currently, the scope is limited to the following projects: 
>  - ... 
>  - ... 
>
> web2py the only one not in the list! ;-) 
>
>
> 2014-05-29 19:16 GMT+02:00 Massimo Di Pierro : 
>
> > Find, report and fix a security issue in web2py (or other system) and 
> google 
> > may pay you: 
> > 
> > https://www.google.com/about/appsecurity/patch-rewards/ 
> > 
> > A rep from google emailed me about this. 
> > 
> > Massimo 
> > 
> > -- 
> > Resources: 
> > - http://web2py.com 
> > - http://web2py.com/book (Documentation) 
> > - http://github.com/web2py/web2py (Source code) 
> > - https://code.google.com/p/web2py/issues/list (Report Issues) 
> > --- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "web2py-users" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an 
> > email to web2py+unsubscr...@googlegroups.com. 
> > For more options, visit https://groups.google.com/d/optout. 
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] how to determine the server (name) ?

2014-05-29 Thread Stef Mientki

hello,

I'm trying to run the same application on different servers.
On each specific server there should be some small differences, so I 
would like to detect the server on which the web2py application is running.


thanks,
Stef

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups "web2py-users" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Google security patch progrem

2014-05-29 Thread Richard Vézina
Ok, so Michele you create the Security hole and we then fix it, that right?
Could you let us know when the holes are ready to be filled, so we can
focus on something during the meantime??

:D

lol

Richard


On Thu, May 29, 2014 at 4:02 PM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> I had not noticed. I have asked my contact.
>
>
> On Thursday, 29 May 2014 12:25:10 UTC-5, Michele Comitini wrote:
>>
>> Currently, the scope is limited to the following projects:
>>  - ...
>>  - ...
>>
>> web2py the only one not in the list! ;-)
>>
>>
>> 2014-05-29 19:16 GMT+02:00 Massimo Di Pierro :
>>
>> > Find, report and fix a security issue in web2py (or other system) and
>> google
>> > may pay you:
>> >
>> > https://www.google.com/about/appsecurity/patch-rewards/
>> >
>> > A rep from google emailed me about this.
>> >
>> > Massimo
>> >
>> > --
>> > Resources:
>> > - http://web2py.com
>> > - http://web2py.com/book (Documentation)
>> > - http://github.com/web2py/web2py (Source code)
>> > - https://code.google.com/p/web2py/issues/list (Report Issues)
>> > ---
>> > You received this message because you are subscribed to the Google
>> Groups
>> > "web2py-users" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> an
>> > email to web2py+unsubscr...@googlegroups.com.
>> > For more options, visit https://groups.google.com/d/optout.
>>
>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] User Registration Form POSTed to Application Root

2014-05-29 Thread RHC
I have a strange problem with an application I have copied from an old 
web2py 2.0.9 installation to another machine running web2py 2.9.5

When I try and register a new user using the standard user function, the 
register button POSTS to the application root /CMS/#, instead of the 
/CMS/default/user/register which is the URL the form is loaded from.

I have the default user method defined in the default.py controller:

def user():
"""
exposes:
http:///[app]/default/user/login
http:///[app]/default/user/logout
http:///[app]/default/user/register
http:///[app]/default/user/profile
http:///[app]/default/user/retrieve_password
http:///[app]/default/user/change_password
use @auth.requires_login()
@auth.requires_membership('group name')
@auth.requires_permission('read','table name',record_id)
to decorate functions that need access control
"""
return dict(form=auth())

I have renamed my user.html to xuser.html to force web2py to use the 
generic.html view. I have switched off javascript in Firefox to rule out 
anything odd going on in some javascript somewhere. I have checked the form 
HTML, there is no separate URL defined anywhere in the form HTML to send 
the POST request anywhere other than the same URL that the form is loaded 
from. I have copied the web2py_ajax.html, web2py.js and jquery.js from the 
new web2py install into my application folder in case out of date code in 
these is causing any problems. A new test application in the web2py 2.9.5 
installation works fine for user registration.

Yet every time I click on the register button the form is submitted to 
/CMS/#, this I have checked using Firefox developer tools (Network tab). I 
can see the parameters I enter to the form are being submitted (using the 
view POST Params feature in Firefox developer tools). 

I am completely out of ideas, and cannot think of any reason the POST does 
not get sent to the originating URL. Does anyone have any suggestions?

If it is of any relevance Web2py is running on ubuntu with an nginx web 
server, the same for both 2.0.9 and 2.9.5 installations.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Google security patch progrem

2014-05-29 Thread Michele Comitini
Richard,
LOL
+1, I was thinking just that :D




2014-05-29 22:34 GMT+02:00 Richard Vézina :

> Ok, so Michele you create the Security hole and we then fix it, that
> right? Could you let us know when the holes are ready to be filled, so we
> can focus on something during the meantime??
>
> :D
>
> lol
>
> Richard
>
>
> On Thu, May 29, 2014 at 4:02 PM, Massimo Di Pierro <
> massimo.dipie...@gmail.com> wrote:
>
>> I had not noticed. I have asked my contact.
>>
>>
>> On Thursday, 29 May 2014 12:25:10 UTC-5, Michele Comitini wrote:
>>>
>>> Currently, the scope is limited to the following projects:
>>>  - ...
>>>  - ...
>>>
>>> web2py the only one not in the list! ;-)
>>>
>>>
>>> 2014-05-29 19:16 GMT+02:00 Massimo Di Pierro :
>>>
>>> > Find, report and fix a security issue in web2py (or other system) and
>>> google
>>> > may pay you:
>>> >
>>> > https://www.google.com/about/appsecurity/patch-rewards/
>>> >
>>> > A rep from google emailed me about this.
>>> >
>>> > Massimo
>>> >
>>> > --
>>> > Resources:
>>> > - http://web2py.com
>>> > - http://web2py.com/book (Documentation)
>>> > - http://github.com/web2py/web2py (Source code)
>>> > - https://code.google.com/p/web2py/issues/list (Report Issues)
>>> > ---
>>> > You received this message because you are subscribed to the Google
>>> Groups
>>> > "web2py-users" group.
>>> > To unsubscribe from this group and stop receiving emails from it, send
>>> an
>>> > email to web2py+unsubscr...@googlegroups.com.
>>> > For more options, visit https://groups.google.com/d/optout.
>>>
>>  --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: User Registration Form POSTed to Application Root

2014-05-29 Thread Anthony
So, the address bar in the browser says 
http://www.yourdomain.com/CMS/default/user/register, and the form has 
action="#"?

On Thursday, May 29, 2014 5:24:13 PM UTC-4, RHC wrote:
>
> I have a strange problem with an application I have copied from an old 
> web2py 2.0.9 installation to another machine running web2py 2.9.5
>
> When I try and register a new user using the standard user function, the 
> register button POSTS to the application root /CMS/#, instead of the 
> /CMS/default/user/register which is the URL the form is loaded from.
>
> I have the default user method defined in the default.py controller:
>
> def user():
> """
> exposes:
> http:///[app]/default/user/login
> http:///[app]/default/user/logout
> http:///[app]/default/user/register
> http:///[app]/default/user/profile
> http:///[app]/default/user/retrieve_password
> http:///[app]/default/user/change_password
> use @auth.requires_login()
> @auth.requires_membership('group name')
> @auth.requires_permission('read','table name',record_id)
> to decorate functions that need access control
> """
> return dict(form=auth())
>
> I have renamed my user.html to xuser.html to force web2py to use the 
> generic.html view. I have switched off javascript in Firefox to rule out 
> anything odd going on in some javascript somewhere. I have checked the form 
> HTML, there is no separate URL defined anywhere in the form HTML to send 
> the POST request anywhere other than the same URL that the form is loaded 
> from. I have copied the web2py_ajax.html, web2py.js and jquery.js from the 
> new web2py install into my application folder in case out of date code in 
> these is causing any problems. A new test application in the web2py 2.9.5 
> installation works fine for user registration.
>
> Yet every time I click on the register button the form is submitted to 
> /CMS/#, this I have checked using Firefox developer tools (Network tab). I 
> can see the parameters I enter to the form are being submitted (using the 
> view POST Params feature in Firefox developer tools). 
>
> I am completely out of ideas, and cannot think of any reason the POST does 
> not get sent to the originating URL. Does anyone have any suggestions?
>
> If it is of any relevance Web2py is running on ubuntu with an nginx web 
> server, the same for both 2.0.9 and 2.9.5 installations.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: User Registration Form POSTed to Application Root

2014-05-29 Thread RHC
Yes, that's right. And after the form submission the address bar says 
http://www.yourdomain.com/CMS/ 

#. 

I should add, that the user does not get registered as they should be. On a 
working test application, where the user is registered successfully, the 
address bar is still showing the original url and a blank user registration 
form (the _next parameter is not supplied during my tests) after 
registration.

On Thursday, May 29, 2014 11:15:38 PM UTC+1, Anthony wrote:
>
> So, the address bar in the browser says 
> http://www.yourdomain.com/CMS/default/user/register 
> ,
>  
> and the form has action="#"?
>
> On Thursday, May 29, 2014 5:24:13 PM UTC-4, RHC wrote:
>>
>> I have a strange problem with an application I have copied from an old 
>> web2py 2.0.9 installation to another machine running web2py 2.9.5
>>
>> When I try and register a new user using the standard user function, the 
>> register button POSTS to the application root /CMS/#, instead of the 
>> /CMS/default/user/register which is the URL the form is loaded from.
>>
>> I have the default user method defined in the default.py controller:
>>
>> def user():
>> """
>> exposes:
>> http:///[app]/default/user/login
>> http:///[app]/default/user/logout
>> http:///[app]/default/user/register
>> http:///[app]/default/user/profile
>> http:///[app]/default/user/retrieve_password
>> http:///[app]/default/user/change_password
>> use @auth.requires_login()
>> @auth.requires_membership('group name')
>> @auth.requires_permission('read','table name',record_id)
>> to decorate functions that need access control
>> """
>> return dict(form=auth())
>>
>> I have renamed my user.html to xuser.html to force web2py to use the 
>> generic.html view. I have switched off javascript in Firefox to rule out 
>> anything odd going on in some javascript somewhere. I have checked the form 
>> HTML, there is no separate URL defined anywhere in the form HTML to send 
>> the POST request anywhere other than the same URL that the form is loaded 
>> from. I have copied the web2py_ajax.html, web2py.js and jquery.js from the 
>> new web2py install into my application folder in case out of date code in 
>> these is causing any problems. A new test application in the web2py 2.9.5 
>> installation works fine for user registration.
>>
>> Yet every time I click on the register button the form is submitted to 
>> /CMS/#, this I have checked using Firefox developer tools (Network tab). I 
>> can see the parameters I enter to the form are being submitted (using the 
>> view POST Params feature in Firefox developer tools). 
>>
>> I am completely out of ideas, and cannot think of any reason the POST 
>> does not get sent to the originating URL. Does anyone have any suggestions?
>>
>> If it is of any relevance Web2py is running on ubuntu with an nginx web 
>> server, the same for both 2.0.9 and 2.9.5 installations.
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Is there an Easier way to store uploads in the DB (postgres) ?

2014-05-29 Thread Anthony
Note, once you set db._adapter.uploads_in_blob=True, you should not need to 
explicitly set uploadfield=True in the field definitions, as True is 
already the default value of that argument.

Anthony

On Monday, May 19, 2014 2:13:34 PM UTC-4, Anthony wrote:
>
> Try:
>
> db._adapter.uploads_in_blob = True
>
> Then, when you do:
>
> db.define_table('mytable', Field('myfile', 'upload', uploadfield=True))
>
> you should get a blob field called db.mytable.myfile_blob with the 
> readable and writable attributes set to False.
>
> Also, feel free to submit a Google Code issue requesting a feature that 
> allows this to be set database-wide via an argument to DAL().
>
> Anthony
>
> On Monday, May 19, 2014 1:37:11 PM UTC-4, Mandar Vaze wrote:
>>
>> Currently I am using "uploadfield" option of "Field"/table definition to 
>> ensure that uploads are stored in DB and not on the filesystem.
>>
>> While this works, this seems tedious because :
>>
>> 1. I have multiple tables with upload fields. If I forget defining 
>> "uploadfield" even one of them (or if someone forgets in future, when they 
>> add a new table) then I will end up having some uploads in the DB, and some 
>> on the filesystem
>> 2. I need to explicitly "hide" the blob field, otherwise it shows up in 
>> the SQLFORM.grid
>>
>> *Is there a cleaner option ?*
>>
>> I tried defining "db" in models/db.py as follows :
>>
>> db = DAL('postgres://user:pass@localhost/mydb', pool_size=5, 
>> check_reserved=['all'], adapter_args={'uploads_in_blob': True})
>>
>> But it does not seem to work
>>
>> I dug a little, but was unable to find how and where adapter_args were 
>> used. It seems it is finally passed to self.find_driver - but at least for 
>> psycopg2 driver
>>
>> -Mandar
>>
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: User Registration Form POSTed to Application Root

2014-05-29 Thread Anthony
In the browser developer tools, do you see the browser make a post request 
with the form data to /CMS/default/user/register# or to /CMS/#? If the 
former, does the server then issue a redirect? If the latter, it is hard to 
say what could be happening, as the browser is not supposed to do that.

Anthony

On Thursday, May 29, 2014 6:50:37 PM UTC-4, RHC wrote:
>
> Yes, that's right. And after the form submission the address bar says 
> http://www.yourdomain.com/CMS/ 
> 
> #. 
>
> I should add, that the user does not get registered as they should be. On 
> a working test application, where the user is registered successfully, the 
> address bar is still showing the original url and a blank user registration 
> form (the _next parameter is not supplied during my tests) after 
> registration.
>
> On Thursday, May 29, 2014 11:15:38 PM UTC+1, Anthony wrote:
>>
>> So, the address bar in the browser says 
>> http://www.yourdomain.com/CMS/default/user/register 
>> ,
>>  
>> and the form has action="#"?
>>
>> On Thursday, May 29, 2014 5:24:13 PM UTC-4, RHC wrote:
>>>
>>> I have a strange problem with an application I have copied from an old 
>>> web2py 2.0.9 installation to another machine running web2py 2.9.5
>>>
>>> When I try and register a new user using the standard user function, the 
>>> register button POSTS to the application root /CMS/#, instead of the 
>>> /CMS/default/user/register which is the URL the form is loaded from.
>>>
>>> I have the default user method defined in the default.py controller:
>>>
>>> def user():
>>> """
>>> exposes:
>>> http:///[app]/default/user/login
>>> http:///[app]/default/user/logout
>>> http:///[app]/default/user/register
>>> http:///[app]/default/user/profile
>>> http:///[app]/default/user/retrieve_password
>>> http:///[app]/default/user/change_password
>>> use @auth.requires_login()
>>> @auth.requires_membership('group name')
>>> @auth.requires_permission('read','table name',record_id)
>>> to decorate functions that need access control
>>> """
>>> return dict(form=auth())
>>>
>>> I have renamed my user.html to xuser.html to force web2py to use the 
>>> generic.html view. I have switched off javascript in Firefox to rule out 
>>> anything odd going on in some javascript somewhere. I have checked the form 
>>> HTML, there is no separate URL defined anywhere in the form HTML to send 
>>> the POST request anywhere other than the same URL that the form is loaded 
>>> from. I have copied the web2py_ajax.html, web2py.js and jquery.js from the 
>>> new web2py install into my application folder in case out of date code in 
>>> these is causing any problems. A new test application in the web2py 2.9.5 
>>> installation works fine for user registration.
>>>
>>> Yet every time I click on the register button the form is submitted to 
>>> /CMS/#, this I have checked using Firefox developer tools (Network tab). I 
>>> can see the parameters I enter to the form are being submitted (using the 
>>> view POST Params feature in Firefox developer tools). 
>>>
>>> I am completely out of ideas, and cannot think of any reason the POST 
>>> does not get sent to the originating URL. Does anyone have any suggestions?
>>>
>>> If it is of any relevance Web2py is running on ubuntu with an nginx web 
>>> server, the same for both 2.0.9 and 2.9.5 installations.
>>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Crud, captcha, and formstyle

2014-05-29 Thread Mark Abajian
Hello web2py users,

Does anyone have a workaround or a fix for this potential bug?  It seems 
like crud is not handling captcha properly when formstyle is 'table2cols'.

2.9.5-stable+timestamp.2014.03.16.02.35.39
(Running on Apache/2.2.26 (Unix) mod_wsgi/3.3 Python/2.7.2 mod_ssl/2.2.26 
OpenSSL/0.9.8y DAV/2, Python 2.7.2)

My browser: Safari 6.1.4 on Mac OS X 10.8.5.

In my app, I am using recaptcha, and specifically with crud.

When I set the formstyle for crud to 'table3cols' or 'divs' or 'ul' or 
'bootstrap', then the captcha is rendered properly:  The label "Verify:" 
appears at the bottom of the form, and this is followed by the recaptcha 
input image.

But, when I set formstyle for crud to 'table2cols', then the captcha is 
*not* rendered properly:  The recaptcha input image appears at the *top* of 
the form (before all my other fields), and the "Verify:" label appears *by 
itself* at the bottom of the form.

Does anyone have a workaround or patch for this?

Thank you, all.

Mark Abajian

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: how to determine the server (name) ?

2014-05-29 Thread Leonel Câmara
request.env.http_host

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.