[web2py] janrain google is not being displayed any longer

2014-03-10 Thread Adi
Used to have a basic janrain account, and yesterday morning Google login 
button disappeared, while other 3 are still there. Any suggestions what 
could be the reason? Afterwards I upgraded a service level to plus, 
regenerated Google+ key, and added Facebook and Twitter, but the original 3 
(aol, open id, and yahoo) are still there and no other accounts are 
visible. 

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] sqlform.grid boolean field search doesn't return any rows

2013-10-11 Thread Adi
Search:
table.field = "on" (shows rows with "T")
table.field != "on" (no rows, even though there are some "F"'s)

2.7.3-stable+timestamp.2013.10.11.19.30.17, MySQL, field defined as 
boolean, char(1)

I think this worked, but haven't used it in some time. 

-- 
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/groups/opt_out.


[web2py] Re: sqlform.grid with div instead of html tables

2013-09-21 Thread Adi
Sorry Anthony, I should've been more specific... Wasn't related to your 
example, that's why I replied to the original message. 

I was just showing the way to format the data, even with the grid as is, 
without replacing the whole format.


On Saturday, September 21, 2013 5:51:49 PM UTC-4, Anthony wrote:
>
> Sorry, not sure I follow. What does this have to do with the following 
> code:
>
> mydisplay = myformat(grid.rows)
> grid.element('.web2py_table', replace=mydisplay)
>
> The above should replace the entire grid table (which means the "links" 
> argument would be useless, as it is used to add elements to the grid).
>
> Anthony
>
> On Saturday, September 21, 2013 5:46:26 PM UTC-4, Adi wrote:
>>
>>
>> I'm formatting the data for certain columns within each row by calling a 
>> function, and returning an XML element, which then displays HTML within 
>> that cell. Code bellow is just to give you an idea...
>>
>> GRID:
>> links=dict(orderMaster=[
>> lambda row:(_get_order_address(row)),
>> ])
>>
>>
>>
>> def _get_order_address(row):
>>
>> order=db(Order.id==row.id).select(cache=(cache.ram,60),
>>   cacheable=True,
>>   ).first()
>> 
>> t = XML('Customer:' +
>> (order.shipFirstName.capitalize() + ' ' if order.shipFirstName 
>> else '') + 
>> (order.shipLastName.capitalize() + '' if order.shipLastName 
>> else '') + 
>> (order.shipAddress1 + '' if order.shipAddress1 else '') + 
>> (order.shipAddress2 + '' if order.shipAddress2 else '') + 
>> (order.shipCity + ' ' if order.shipCity else '') + 
>> (order.shipPC + ', ' if order.shipPC else '') + 
>> (order.shipProvince + '' if order.shipProvince else '') + 
>> (order.shipCountry + '' if order.shipCountry else '')
>> )
>> 
>> return t
>>
>>
>>
>>
>>
>>
>>
>> On Saturday, September 21, 2013 2:43:34 PM UTC-4, ssuresh wrote:
>>>
>>> The problem is that my data does not display too well in a table grid. 
>>> Some of my columns are descriptions that do not fit well inside a grid. So 
>>> I want to display it in a more readable alternate formats. - Something like 
>>>
>>> 
>>> *Title  *
>>> description ..
>>>
>>> *date*
>>> ---
>>>
>>> I used sqlform.grid because  i want to make use of its other features 
>>> like automatic add/del/edits and search/export functionalities.
>>>
>>> So do you have any suggestions for that?
>>>
>>>

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


[web2py] Re: sqlform.grid with div instead of html tables

2013-09-21 Thread Adi

I'm formatting the data for certain columns within each row by calling a 
function, and returning an XML element, which then displays HTML within 
that cell. Code bellow is just to give you an idea...

GRID:
links=dict(orderMaster=[
lambda row:(_get_order_address(row)),
])



def _get_order_address(row):

order=db(Order.id==row.id).select(cache=(cache.ram,60),
  cacheable=True,
  ).first()

t = XML('Customer:' +
(order.shipFirstName.capitalize() + ' ' if order.shipFirstName else 
'') + 
(order.shipLastName.capitalize() + '' if order.shipLastName 
else '') + 
(order.shipAddress1 + '' if order.shipAddress1 else '') + 
(order.shipAddress2 + '' if order.shipAddress2 else '') + 
(order.shipCity + ' ' if order.shipCity else '') + 
(order.shipPC + ', ' if order.shipPC else '') + 
(order.shipProvince + '' if order.shipProvince else '') + 
(order.shipCountry + '' if order.shipCountry else '')
)

return t







On Saturday, September 21, 2013 2:43:34 PM UTC-4, ssuresh wrote:
>
> The problem is that my data does not display too well in a table grid. 
> Some of my columns are descriptions that do not fit well inside a grid. So 
> I want to display it in a more readable alternate formats. - Something like 
>
> 
> *Title  *
> description ..
>
> *date*
> ---
>
> I used sqlform.grid because  i want to make use of its other features like 
> automatic add/del/edits and search/export functionalities.
>
> So do you have any suggestions for that?
>
>

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


[web2py] one more web2py e-commerce app :)

2013-09-16 Thread Adi
Just completed a core system at nammuhats.com. Can't praise enough how 
easy, (and rock solid) is to build systems with web2py :)

Once again, thanks Massimo and all contributors for the best framework!

-- 
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/groups/opt_out.


Re: [web2py] Re: simple button in grid question

2013-09-16 Thread Adi
actually, you can also define a table that links apply to. this way you 
won't get the error, when applying functionality to a wrong table... 

links=dict(purchase_order=[
lambda row:(_get_order_details(row)),
lambda row: A('Duplicate',
_class='button', _href=URL('duplicate_po',
args=[row.id])),
lambda row: A('Print', _class='button', _href=
URL('print_all',args=[row.id]))
],
  other_table=[
lambda row:(_get_something_else(row)),
   ],),







On Monday, September 16, 2013 9:42:22 AM UTC-4, Javier Pepe wrote:
>
> You need pass a list of dict
>
> links = [{'header':'', 'body': lambda row: 
> A('',_title='Procesar',_class='icon-refresh',_href=URL(c='planilla',
>   {'header':'', 'body': lambda row: 
> A('',_title='Mail',_class='icon-envelope',_href='index/pedircontadores/%
>   {'header':'', 'body': lambda row: 
> A('',_title='Estado',_class='icon-ok',callback=URL(c='planilla',f='estad
>   {'header':'', 'body': lambda row: 
> A('',_title='Control',_class='icon-check',_href=URL(c='planilla',f='pdf/
>   {'header':'', 'body': lambda row: A('',_title='Control 
> 2',_class='icon-check',_href=URL(c='planilla',f='co
>   {'header':'', 'body': lambda row: 
> A('',_title='PDF',_class='icon-print',_href=URL(f='pdf/%s/%s' % (row.id,
>   {'header':'', 'body': lambda row: A('',_title='PDF 
> distribuidor',_class='icon-print',_href=URL(f='pdf/%s/%
>   {'header':'', 'body': lambda row: 
> A('',_title='Detalle',_class='icon-list',_href=URL(c='detalle',f='index'
>   ]
>
>
>
> On Sun, Sep 15, 2013 at 9:31 PM, Alex Glaros 
> > wrote:
>
>> What is syntax for TWO or more  buttons? I've tried several variations. 
>> Would it be two "dict" phrases, or two header phrases separated by commas? 
>>
>> One button will call one function, and the other would call a different 
>> function.
>>
>> thanks,
>>
>> Alex
>>
>>
>> On Saturday, September 14, 2013 6:56:24 PM UTC-7, Alex Glaros wrote:
>>>
>>> Works perfect Adi and Villas,
>>>
>>> much appreciated.
>>>
>>> Here's the complete code:
>>>
>>> def view_all_suggestions_and_**comments(): 
>>> query = (db.IdeaComment.ideaID==db.**Idea.id <http://db.Idea.id>) & 
>>> (db.IdeaComment.partyID==db.**Party.id <http://db.Party.id>) 
>>>grid = SQLFORM.grid(query, ,links = [dict(header='Virtual Field', 
>>>  body=lambda row: A('Add a comment!',_class="btn btn-mini", 
>>> _href=URL('comment_on_a_**suggestion', vars=dict(filter=row.Idea.id))**
>>> ))])
>>> return dict(grid = grid)   
>>>
>>> Alex
>>>
>>>
>>> On Saturday, September 14, 2013 6:01:33 PM UTC-7, Adi wrote:
>>>>
>>>> lambda row: A('Complete',
>>>> _class='btn', _id='btn_complete',
>>>> _onclick='return confirm("Complete 
>>>> Order %s? (%s %s)")' % (row.id, 
>>>> 
>>>>row.shipFirstName, 
>>>> 
>>>>row.shipLastName), 
>>>> _href=URL(r=request,f='**
>>>> complete_order',args=[row.id])**,
>>>>
>>>>
>>>>
>>>>
>>>> On Saturday, September 14, 2013 7:41:24 PM UTC-4, Alex Glaros wrote:
>>>>>
>>>>> it works correctly Villas, thanks.
>>>>>
>>>>> how 

Re: [web2py] Re: How to make smartgrid redirect to edit after creating new record?

2013-09-15 Thread Adi
Untested, and modified sample:



*Model:*
db.define_table('purchase_order',
Field('po_number', 'string', label=T('PO Number'), unique=
True),
Field('status',  'string', default='Processed',
requires= IS_IN_SET(['Processed', 
'Cancelled', 'On Hold', 'Shipped']), label=T('Status')),
format='%(po_number)s',
)


*Controller:*
def po_onupdate(form):

# send an email, but only first time (when status changes to 'Shipped', 
additional record updates will not trigger an email)
if ((form.vars.status == 'Shipped') & (form.record.status != 'Shipped'
)):
mail.send(to=['some...@somewhere.com',], subject='Order %s shipped. 
Date: %s' % (form.record.po_number, request.now), message="Long message")
session.flash = ('Updated a %s' % (tbl_name)) + ' ' + (form.vars.po_number 
if tbl_name == 'purchase_order' else '')

return

def purchase_order():
grid=SQLFORM.smartgrid(db.purchase_order, details=True, links_in_grid=
True,
paginate=20,
sortable=True,
onupdate = po_onupdate,
editable = True,
formstyle='bootstrap',
    user_signature=True,
)
return dict(grid=grid)









On Sunday, September 15, 2013 12:29:04 AM UTC-4, Alex Glaros wrote:
>
> Adi, you had a tiny working example above 
>
> *this works:
> grid=SQLFORM.smartgrid(.*
>
> is the data model available for that?
>
> I'm looking for any small self-contained working example of smartgrid 
> redirecting to edit 
>
> thanks,
>
> Alex
>
> On Saturday, September 14, 2013 5:38:58 PM UTC-7, Adi wrote:
>>
>> Alex,
>> Can you please clarify what model do you need? I can post the sample code 
>> but not sure what exactly do you need. 
>>
>>
>> On Fri, Sep 13, 2013 at 8:13 PM, Alex Glaros  wrote:
>>
>>> Adi, 
>>>
>>> can you post the model for this?  
>>>
>>> thanks, 
>>>
>>> Alex Glaros
>>>
>>>
>>> On Friday, December 23, 2011 9:44:17 AM UTC-8, Adi wrote:
>>>>
>>>> this works:
>>>>
>>>> grid=SQLFORM.smartgrid(db.**purchase_order, details=False, 
>>>> links_in_grid=True,
>>>> maxtextlengths={'purchase_**
>>>> order.po_number':15,},
>>>> maxtextlength=30,
>>>> paginate=20,
>>>> sortable=True,
>>>> orderby=dict(purchase_order=[~**
>>>> db.purchase_order.modified_on]**, ),
>>>> oncreate = dict(purchase_order=[po_**
>>>> oncreation]),
>>>> csv=False,
>>>> ui='jquery-ui',
>>>> links=dict(purchase_order=[**lambda row: 
>>>> A('Duplicate',
>>>> _class='button', 
>>>> _href=URL('duplicate_purchase_**order',args=[row.id])), lambda row: 
>>>> A('Print',
>>>> _class='button', 
>>>> _href=URL('print_all',args=[ro**w.id <http://row.id>]))]),
>>>> user_signature=False, onupdate=auth.archive,
>>>> )
>>>>
>>>>
>>>> def po_oncreation(form1):
>>>> 
>>>> auth.archive
>>>> 
>>>> last_id = form1.vars.id
>>>> 
>>>> row = db(db.purchase_order.id==last_**id).select().first()
>>>>
>>>> str_po_number = row.po_number + str(row.id)
>>>> row.po_number = str_po_number
>>>> row.update_record()
>>>> 
>>>> #response.flash = 'Added a Purchase Order'
>>>>
>>>> session.flash = 'Added a Purchase Order'
>>>> return
>>>>
>>>>
>>>>
>>>>  -- 
>>> Resources:
>>> - http://web2py.com
>>> - http://web2py.com/book (Documentation)
>>> - http://github.com/web2py/web2py (Source code)
>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>> --- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "web2py-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to web2py+un...@googlegroups.com.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>>
>>

-- 
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/groups/opt_out.


[web2py] Re: simple button in grid question

2013-09-14 Thread Adi
lambda row: A('Complete',
_class='btn', _id='btn_complete',
_onclick='return confirm("Complete 
Order %s? (%s %s)")' % (row.id, 

   row.shipFirstName, 

   row.shipLastName), 
_href=URL(r=request,f='complete_order',
args=[row.id]),




On Saturday, September 14, 2013 7:41:24 PM UTC-4, Alex Glaros wrote:
>
> it works correctly Villas, thanks.
>
> how could I turn "Add a comment!" text into a button.  Possible syntax 
> ",_class="btn btn-mini"", but where does it go?
>
> thanks,
>
> Alex
>
> On Saturday, September 14, 2013 10:23:00 AM UTC-7, villas wrote:
>>
>> Maybe this would work using row.idea.id like this...
>>
>> grid = SQLFORM.grid(query,
>> links = [dict(header='Virtual Field',
>> body=lambda row: A('Add a comment!', _href=URL(
>> 'comment_on_a_suggestion', vars=dict(filter=row.idea.id 
>> )))
>> )]
>> )
>>
>>
>> You can also now include "virtual fields" in grids,  but I haven't needed 
>> to try that yet.
>>
>>
>>
>> On Saturday, 14 September 2013 15:23:49 UTC+1, Alex Glaros wrote:
>>>
>>> thanks Villas but I receive this error: Row' object has no attribute 'id'
>>>
>>> perhaps it doesn't know which of the joined "id"s to reference
>>>
>>> this work-around works because it let's system know which id it is: 
>>> db.Idea.id.represent = lambda id, r: A('Add a comment!', 
>>> _href=URL('comment_on_a_suggestion', vars=dict(filter=id)))
>>>
>>> Alex
>>>
>>> On Saturday, September 14, 2013 4:56:33 AM UTC-7, villas wrote:

 Try this...

 grid = SQLFORM.grid(query,
  links = [dict(header='Virtual Field',
body=lambda row: 
 A('Add a comment!', _href=URL('comment_on_a_suggestion', vars=dict(filter=
 row.id)))
 )]
 )


 On Friday, 13 September 2013 21:57:28 UTC+1, Alex Glaros wrote:
>
> I tried this but got "lambda requires 2 args, 1 given" error, plus 
> need to be able to pass Idea.id parm to the button.  How to do that?
>
> grid = SQLFORM.grid(query,links = [dict(header='Virtual 
> Field',body=lambda id, r: A('Add a comment!', 
> _href=URL('comment_on_a_suggestion', vars=dict(filter=id])
>
> On Friday, September 13, 2013 1:33:35 PM UTC-7, villas wrote:
>>
>> Hope this helps...
>>
>> From the book:
>>
>> links is used to display new columns which can be links to other 
>> pages. The links argument must be a list of 
>> dict(header='name',body=lambda 
>> row: A(...)) where header is the header of the new column and bodyis a 
>> function that takes a row and returns a value. In the example, the 
>> value is a A(...) helper.
>>
>> Example:
>>
>> linkbtns = [
>>  lambda row: SPAN('Mag',_class="label label-success") 
>> \
>>   if row.status =='Y' else '',
>>  lambda row: SPAN('Web',_class="label label-success") 
>> \
>>   if row.is_active else '',
>>  lambda row: A( I('',_class="icon-eye-open")+' View',
>> _href=URL("view",args=[row.id]),
>> _class="btn btn-small"
>>   ),
>>  lambda row: A( I('',_class="icon-edit")+' Edit',
>> _href=URL("edit",args=[row.id]),
>> _class="btn btn-small"
>>   ),
>>  lambda row: A( I('',_class="icon-road")+' Map',
>> _href=URL('default','geocoder',
>> args=['caclient',row.id],vars={'title':row.business}),
>> _class="btn btn-small"
>>   ),
>>]
>> grid = SQLFORM.grid(... links=linkbtns, ...) 
>>
>>
>>
>>
>> On Friday, 13 September 2013 21:00:56 UTC+1, Alex Glaros wrote:
>>>
>>> How do I add a button "Add a comment!" in every row of a grid? It's 
>>> a kind of virtual column.
>>>
>>> The below works, it takes user exactly to the correct row in the 
>>> next table, but I use up one of the fields (Idea.id).  How do I just 
>>> create 
>>> text/virtual column that doesn't sacrifice existing field?
>>>
>>>
>>>  def view_all_suggestions_and_comments(): 
>>> db.Idea.id.represent = lambda id, r: A('Add a co

[web2py] Re: Webhosts for Web2py

2013-08-31 Thread Adi
Their pricing looks good. Do they offer different distributions (ubuntu 
primarily)? I've been with linode for the last year, and so far very happy.

Adnan 


On Thursday, August 29, 2013 5:20:10 PM UTC-4, Anthony wrote:
>
> You might consider Digital Ocean  (just 
> moved there from Amazon) -- $5/month gets you quite a bit, and for an extra 
> $1 you get backups. Data centers in New York, San Francisco, and Amsterdam.
>
> Anthony
>
> On Tuesday, August 27, 2013 2:11:22 PM UTC-7, Vivek Jha wrote:
>>
>> I am new in web development and I have started with web2py and have 
>> almost copleted reading the web2py book.
>>
>> Now few practical issues are coming up about which I don't have any 
>> experience and that is chosing the right economical webhost.
>>
>> I think following suits my pocket:
>> 1. Bluehost
>> 2. Hostgator (mainly becuase they have presence in India as well)
>> 3. Justhost.
>>
>> Do any of guys have any experience with these web hosts. As most of the 
>> webhosts are still not able to see the world beyond PHP and wordpress they 
>> have not mentioned python support specifically though they may be 
>> supporting Python based applications internally.
>>
>> Questions:
>> 1. Do the above webhosts will be able to support Web2Py with FastCGI.
>> 2. Is having shell access a must for running web2py.
>> 3. Will it be possible to run Web2Py on the main domain and Wordpress on 
>> subdomain or vice versa with them.
>> 4. Whom to ask about WSGI setup? Is this a webshost specific question or 
>> Web2Py specific.
>>
>> If you think I have not asked the right questions, then please assume me 
>> as a beginner in the hosting world and let me if there are any catches 
>> about which I should be careful of.
>>
>

-- 

--- 
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/groups/opt_out.


[web2py] Re: Can't retrieve xy.jpeg file properties (.thumbnail vs .jpeg) from PIL resized image (2.6.0-dev)

2013-08-28 Thread Adi
Thanks Ricardo and Niphlod for your help!


On Tuesday, August 27, 2013 5:59:44 PM UTC-4, Niphlod wrote:
>
> you kinda have to. contenttype is automatically guessed from the extension 
> only. There's no "header" instrospection.
>
> On Tuesday, August 27, 2013 9:07:56 PM UTC+2, Adi wrote:
>>
>>
>> This is the example I used for resizing images: 
>> http://stackoverflow.com/questions/273946/how-do-i-resize-an-image-using-pil-and-maintain-its-aspect-ratio,
>>  
>> and the one with extension .thumbnail works fine, but jpeg doesn't. I 
>> didn't set the content-type manually. 
>>  
>>
>> On Tuesday, August 27, 2013 2:39:03 PM UTC-4, Niphlod wrote:
>>>
>>> your thmbnail doesn't have an extension: do you set the content-type 
>>> manually ?
>>>
>>>

-- 

--- 
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/groups/opt_out.


[web2py] Re: Can't retrieve xy.jpeg file properties (.thumbnail vs .jpeg) from PIL resized image (2.6.0-dev)

2013-08-27 Thread Adi

This is the example I used for resizing images: 
http://stackoverflow.com/questions/273946/how-do-i-resize-an-image-using-pil-and-maintain-its-aspect-ratio,
 
and the one with extension .thumbnail works fine, but jpeg doesn't. I 
didn't set the content-type manually. 
 

On Tuesday, August 27, 2013 2:39:03 PM UTC-4, Niphlod wrote:
>
> your thmbnail doesn't have an extension: do you set the content-type 
> manually ?
>
>

-- 

--- 
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/groups/opt_out.


[web2py] Can't retrieve xy.jpeg file properties (.thumbnail vs .jpeg) from PIL resized image (2.6.0-dev)

2013-08-27 Thread Adi

Used the Python Imaging Library (with JPEG decoder) to create set of 
thumbnails. For the images with jpeg extension, the error pops up that the 
properties can't be retrieved, while for the non-image extensions, 
everything displays fine. 

Is this a problem with PIL not generating enough header information about 
the image, or something else? Size-wise, .thumbnail is 4x smaller, but the 
quality is really low. The original JPG displays fine too... 

thumbnails resizing: 
...
im = Image.open(infile)
im.thumbnail(size)
im.save(outfile, "JPEG")



displaying images:
{{
img1 = 
'product.image.85d32040405f61e9.626c61636b2d6e616d6d752e6a7067.thumbnail180x160'
img2 = 
'product.image.85d32040405f61e9.626c61636b2d6e616d6d752e6a7067.180x160.jpeg'
}}




  File "/Users/adnan/web2py26/gluon/globals.py", line 361, in 
self._caller = lambda f: f()
  File "/Users/adnan/web2py26/applications/nammu/controllers/default.py",line 
2105, in download
return response.download(request, db)
  File "/Users/adnan/web2py26/gluon/globals.py", line 574, in download
(filename, stream) = field.retrieve(name,nameonly=True)
  File "/Users/adnan/web2py26/gluon/dal.py", line 9558, in retrieve
file_properties = self.retrieve_file_properties(name,path)
  File "/Users/adnan/web2py26/gluon/dal.py", line 9583, 
inretrieve_file_properties
raise TypeError('Can\'t retrieve %s file properties' % name)
TypeError: Can't retrieve 
product.image.85d32040405f61e9.626c61636b2d6e616d6d752e6a7067.180x160.jpeg 
file properties




-- 

--- 
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/groups/opt_out.


product.image.85d32040405f61e9.626c61636b2d6e616d6d752e6a7067.thumbnail180x160
Description: Binary data
<>

[web2py] Re: need help to improve download of dynamic images (nginx)

2013-08-23 Thread Adi
Thanks Niphlod for your help,
Seems a connection to a legacy database was a culprit for a real slow 
down...


On Thursday, August 22, 2013 4:31:22 PM UTC-4, Niphlod wrote:
>
> uhm. download() lets web2py stream the file instead of nginx. 
> fast_download() too, it just skips the part that handles the authorization 
> logic and adds correct cache headers, but this will lead to faster loading 
> of pages from the 2nd time the user accesses the page: it won't change a 
> thing in the 1st request.
>
> Why don't you just put those images in "static/something" ?
>
> The other very smart thing to do is using http://wiki.nginx.org/X-accel . 
> This basically enables nginx to "intercept" an empty page with some special 
> headers (so web2py does it without even accessing the file) and take care 
> of serving the file instead of your application. This will probably speed 
> up your 1st request (and releaves some pressure from the web2py process), 
> but the hard-limit of bandwith will of course remain there, no matter what.
>
> Your fast download will then kinda look like 
> def fast_download():
> 
> filename = os.path.join(request.folder,'uploads',request.args(0))
> response.headers['X-Accel-Redirect'] = os.path.join(request.folder, 
> 'uploads', document.file)
>  return ''
>
>
>
> On Thursday, August 22, 2013 10:06:34 PM UTC+2, Adi wrote:
>>
>>
>>
>> Hello everyone.
>>
>> Am trying to populate a page with around 20 dynamic images from the 
>> upload folder, but they get rendered extremely slow, even as thumbnails. 
>> Tried using a suggest approach from the forum "fast_download()", but 
>> without luck in my case. 
>>
>> Anyone has a suggestion, what should I be looking at, and how to improve 
>> the speed of loading dynamic images? 
>>
>> Platform: clean ubuntu node with web2py and nginx (no caching setup, 1Gb 
>> of ram). Nothing else is running on it.
>>
>> Performed following three tests:
>>
>> Regular download():
>> Compressed images (through PIL, with extension .thumbnail): 
>> http://www.webpagetest.org/result/130822_1F_WAD/ (500Kb in 25 sec)
>> Regular size images: http://www.webpagetest.org/result/130822_5K_ZSX/(3Mb in 
>> 26 sec)
>>
>> Fast_Download() with regular size images:
>> http://www.webpagetest.org/result/130822_C3_1008/ (3Mb in 28 sec)
>>
>> Tried to implement caching in nginx site config, but that disabled images 
>> completely, and I couldn't get it to work:
>>
>> #location ~* ^.+\.(jpg|jpeg|gif)$ {
>> #   root /home/www-data/web2py/applications/;
>> #   access_log   off;
>> #   expires  30d;
>> #}
>>
>> or 
>>
>> #location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ {
>>  #access_log off;
>>  #log_not_found off;
>>  #expires 180d;
>>  #}
>>
>> Fast download used: 
>> def fast_download():
>> session.forget(response)
>> cache.action(time_expire=604800)(lambda: 0)()
>>
>> # very basic security (only allow fast_download on 
>> your_table.upload_field):
>> if not request.args(0).startswith("product.image"):
>> return download()
>>
>> filename = os.path.join(request.folder,'uploads',request.args(0))
>>
>> return response.stream(open(filename,'rb'))
>>
>>
>> Segment of the code that displays the images:
>>
>> 
>> {{if p.image:}}
>> 
>> {{
>> #big_regex = re.compile('|'.join(map(re.escape, 
>> IMAGE_EXTENSIONS)))
>> #tmb_image = big_regex.sub(INDEX_TMB, p.image)
>> }}
>> > alt="{{=product_name}}" href="{{=product_link}}" 
>> height="180px" width="160px"/>
>> 
>> 
>> {{pass}}
>> 
>>
>>
>>
>>
>>  
>>
>

-- 

--- 
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/groups/opt_out.


[web2py] need help to improve download of dynamic images (nginx)

2013-08-22 Thread Adi


Hello everyone.

Am trying to populate a page with around 20 dynamic images from the upload 
folder, but they get rendered extremely slow, even as thumbnails. Tried 
using a suggest approach from the forum "fast_download()", but without luck 
in my case. 

Anyone has a suggestion, what should I be looking at, and how to improve 
the speed of loading dynamic images? 

Platform: clean ubuntu node with web2py and nginx (no caching setup, 1Gb of 
ram). Nothing else is running on it.

Performed following three tests:

Regular download():
Compressed images (through PIL, with extension .thumbnail): 
http://www.webpagetest.org/result/130822_1F_WAD/ (500Kb in 25 sec)
Regular size images: http://www.webpagetest.org/result/130822_5K_ZSX/ (3Mb 
in 26 sec)

Fast_Download() with regular size images:
http://www.webpagetest.org/result/130822_C3_1008/ (3Mb in 28 sec)

Tried to implement caching in nginx site config, but that disabled images 
completely, and I couldn't get it to work:

#location ~* ^.+\.(jpg|jpeg|gif)$ {
#   root /home/www-data/web2py/applications/;
#   access_log   off;
#   expires  30d;
#}

or 

#location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ {
 #access_log off;
 #log_not_found off;
 #expires 180d;
 #}

Fast download used: 
def fast_download():
session.forget(response)
cache.action(time_expire=604800)(lambda: 0)()

# very basic security (only allow fast_download on 
your_table.upload_field):
if not request.args(0).startswith("product.image"):
return download()

filename = os.path.join(request.folder,'uploads',request.args(0))

return response.stream(open(filename,'rb'))


Segment of the code that displays the images:


{{if p.image:}}

{{
#big_regex = re.compile('|'.join(map(re.escape, 
IMAGE_EXTENSIONS)))
#tmb_image = big_regex.sub(INDEX_TMB, p.image)
}}



{{pass}}





 

-- 

--- 
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/groups/opt_out.


[web2py] Re: list:string field in smartgrid? ver: 2.6.0-development+timestamp.2013.08.01.08.22.32

2013-08-03 Thread Adi
if you need me to do some additional testing in regards to "creating new 
application", please let me know. I use github to constantly synch with the 
latest trunk, so not sure if that could somehow interfere... 


On Saturday, August 3, 2013 2:47:11 PM UTC-4, Niphlod wrote:
>
> are you using an application based on a scaffolding pre 2.6.0 and upgraded 
> web2py to 2.6.0?
>
> If yes, please overwrite your app's web2py.js with the new 
> welcome/static/js/web2py.js 
>
> On Saturday, August 3, 2013 8:41:09 PM UTC+2, Adi wrote:
>>
>>
>> I have a list:string field without any "represent" definition, and when 
>> open record for editing in smartgrid, the field is represented as string 
>> (one line). I remember in the past seeing a button with the plus sign on 
>> the right side, and ability to add multiple values into a field. Should I 
>> specify some widget in order to get the button and functionality? 
>>
>> simplified table definition:
>>
>> db.define_table('product',
>> Field('videos', 'list:string'),
>> )
>>
>>
>> Thanks.
>>
>>
>>

-- 

--- 
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/groups/opt_out.




[web2py] Re: list:string field in smartgrid? ver: 2.6.0-development+timestamp.2013.08.01.08.22.32

2013-08-03 Thread Adi
The problem is that I created a new application minutes before I'll post, 
just to be sure it's not some other code interfering... and even though 
welcome/static/js has newest files, what got copied into a new (uniquely 
named) application was not the same. All files dates were from January 
2013, and sizes were less. 

Not sure if there is a problem with "New simple application" functionality 
to bring the latest files into scaffolding, or it's only a setup on my 
computer. 

Regardless to all this, the problem is solved + and - are there. 

Thanks again Simone!!!






On Saturday, August 3, 2013 2:47:11 PM UTC-4, Niphlod wrote:
>
> are you using an application based on a scaffolding pre 2.6.0 and upgraded 
> web2py to 2.6.0?
>
> If yes, please overwrite your app's web2py.js with the new 
> welcome/static/js/web2py.js 
>
> On Saturday, August 3, 2013 8:41:09 PM UTC+2, Adi wrote:
>>
>>
>> I have a list:string field without any "represent" definition, and when 
>> open record for editing in smartgrid, the field is represented as string 
>> (one line). I remember in the past seeing a button with the plus sign on 
>> the right side, and ability to add multiple values into a field. Should I 
>> specify some widget in order to get the button and functionality? 
>>
>> simplified table definition:
>>
>> db.define_table('product',
>> Field('videos', 'list:string'),
>> )
>>
>>
>> Thanks.
>>
>>
>>

-- 

--- 
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/groups/opt_out.




[web2py] list:string field in smartgrid? ver: 2.6.0-development+timestamp.2013.08.01.08.22.32

2013-08-03 Thread Adi

I have a list:string field without any "represent" definition, and when 
open record for editing in smartgrid, the field is represented as string 
(one line). I remember in the past seeing a button with the plus sign on 
the right side, and ability to add multiple values into a field. Should I 
specify some widget in order to get the button and functionality? 

simplified table definition:

db.define_table('product',
Field('videos', 'list:string'),
)


Thanks.


-- 

--- 
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/groups/opt_out.




[web2py] Re: 1071, Specified key was too long; max key length is 767 bytes in 2.6.0-development+timestamp.2013.07

2013-08-03 Thread Adi
Niphlod... as always... that did it :)

only one field that I saw:
Field('title', unique=True, length=255),

Thank you!


On Saturday, August 3, 2013 8:23:09 AM UTC-4, Niphlod wrote:
>
> dreaded mysql.. dropping the support for it will cut in half 
> developing time.
>
> Seems the same problem that hit the scheduler since default length for 
> columns was altered.
>
> Can you try to alter gluon/tools.py in the wiki class, where the table are 
> defined, adding "length=255" to every column that has a unique=True 
> constraint ?
> If that works out, we pinned it down properly ^_^
>
> On Saturday, August 3, 2013 2:06:13 PM UTC+2, Adi wrote:
>>
>> Upgraded from 2.5.1 to 2.6.0, and it seems that auth.wiki is causing 
>> this. If I comment it out, everything else works fine.
>>
>> #auth.wiki(resolve=False)
>> #wiki = Wiki(auth=auth, render='html')
>>
>>
>> Ticket ID 
>>
>> 127.0.0.1.2013-08-03.08-03-20.34cb1611-c6d4-46fc-b59e-106ad21d723e
>>  (1071, u'Specified key 
>> was too long; max key length is 767 bytes') Version  web2py™ Version 
>> 2.6.0-development+timestamp.2013.08.01.08.22.32  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.
>>
>> Traceback (most recent call last):
>>   File "/Users/adnan/web2py24/gluon/restricted.py", line 212, in restricted
>> exec ccode in environment
>>   File "/Users/adnan/web2py24/applications/bsp/models/db.py" 
>> <http://127.0.0.1:8000/admin/default/edit/bsp/models/db.py>, line 84, in 
>> 
>> auth.wiki(resolve=False)
>>   File "/Users/adnan/web2py24/gluon/tools.py", line 3467, in wiki
>> function=function)
>>   File "/Users/adnan/web2py24/gluon/tools.py", line 5152, in __init__
>> db.define_table(key, *args, **value['vars'])
>>   File "/Users/adnan/web2py24/gluon/dal.py", line 7779, in define_table
>> table = self.lazy_define_table(tablename,*fields,**args)
>>   File "/Users/adnan/web2py24/gluon/dal.py", line 7816, in lazy_define_table
>> polymodel=polymodel)
>>   File "/Users/adnan/web2py24/gluon/dal.py", line 1021, in create_table
>> fake_migrate=fake_migrate)
>>   File "/Users/adnan/web2py24/gluon/dal.py", line 1126, in migrate_table
>> self.execute(sub_query)
>>   File "/Users/adnan/web2py24/gluon/dal.py", line 1816, in execute
>> return self.log_execute(*a, **b)
>>   File "/Users/adnan/web2py24/gluon/dal.py", line 1810, in log_execute
>> ret = self.cursor.execute(command, *a[1:], **b)
>>   File "/Users/adnan/web2py24/gluon/contrib/pymysql/cursors.py", line 117, 
>> in execute
>> self.errorhandler(self, exc, value)
>>   File "/Users/adnan/web2py24/gluon/contrib/pymysql/connections.py", line 
>> 202, in defaulterrorhandler
>> raise errorclass, errorvalue
>> InternalError: (1071, u'Specified key was too long; max key length is 767 
>> bytes')
>>
>>
>>

-- 

--- 
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/groups/opt_out.




[web2py] 1071, Specified key was too long; max key length is 767 bytes in 2.6.0-development+timestamp.2013.07

2013-08-03 Thread Adi
Upgraded from 2.5.1 to 2.6.0, and it seems that auth.wiki is causing this. 
If I comment it out, everything else works fine.

#auth.wiki(resolve=False)
#wiki = Wiki(auth=auth, render='html')


Ticket ID 

127.0.0.1.2013-08-03.08-03-20.34cb1611-c6d4-46fc-b59e-106ad21d723e
 (1071, u'Specified key 
was too long; max key length is 767 bytes') Version  web2py™ Version 
2.6.0-development+timestamp.2013.08.01.08.22.32  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.

Traceback (most recent call last):
  File "/Users/adnan/web2py24/gluon/restricted.py", line 212, in restricted
exec ccode in environment
  File "/Users/adnan/web2py24/applications/bsp/models/db.py" 
, line 84, in 

auth.wiki(resolve=False)
  File "/Users/adnan/web2py24/gluon/tools.py", line 3467, in wiki
function=function)
  File "/Users/adnan/web2py24/gluon/tools.py", line 5152, in __init__
db.define_table(key, *args, **value['vars'])
  File "/Users/adnan/web2py24/gluon/dal.py", line 7779, in define_table
table = self.lazy_define_table(tablename,*fields,**args)
  File "/Users/adnan/web2py24/gluon/dal.py", line 7816, in lazy_define_table
polymodel=polymodel)
  File "/Users/adnan/web2py24/gluon/dal.py", line 1021, in create_table
fake_migrate=fake_migrate)
  File "/Users/adnan/web2py24/gluon/dal.py", line 1126, in migrate_table
self.execute(sub_query)
  File "/Users/adnan/web2py24/gluon/dal.py", line 1816, in execute
return self.log_execute(*a, **b)
  File "/Users/adnan/web2py24/gluon/dal.py", line 1810, in log_execute
ret = self.cursor.execute(command, *a[1:], **b)
  File "/Users/adnan/web2py24/gluon/contrib/pymysql/cursors.py", line 117, in 
execute
self.errorhandler(self, exc, value)
  File "/Users/adnan/web2py24/gluon/contrib/pymysql/connections.py", line 202, 
in defaulterrorhandler
raise errorclass, errorvalue
InternalError: (1071, u'Specified key was too long; max key length is 767 
bytes')


-- 

--- 
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/groups/opt_out.




[web2py] Re: Scheduler tasks stuck in ASSIGNED state

2013-01-14 Thread Adi
Seems like we have the same situation (Version 2.3.2 (2012-12-17 15:03:30) 
stable). More and more tasks are just being assigned, but not completed nor 
failed. I can send you a debug log via email, if this hasn't been fixed in 
trunk? 

Thanks,
Adnan

On Wednesday, December 19, 2012 2:46:07 PM UTC-5, Niphlod wrote:
>
> 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???
>


-- 





[web2py] Re: (2, 4, 1, 'alpha.2', datetime.datetime(2013, 1, 8, 15, 30, 47)) trunk: formstyle_bootstrap broken

2013-01-09 Thread Adi
Works. Thanks Massimo!

On Wednesday, January 9, 2013 10:37:19 AM UTC-5, Massimo Di Pierro wrote:
>
> I think this is now fixed in trunk. Can you please check?
>
> On Wednesday, 9 January 2013 08:33:35 UTC-6, Adi wrote:
>>
>>
>> Seems that bootstrap broke in latest trunk. All my forms, which use 
>> bootstrap are returning errors... commenting formstyle='bootstrap' makes it 
>> work fine.
>>
>>
>> Traceback (most recent call last):
>>   File "/Users/adnan/web2py24/gluon/restricted.py", line 212, in restricted
>> exec ccode in environment
>>   File 
>> "/Users/adnan/web2py24/applications/dev_thanemobile/controllers/default.py" 
>> <http://127.0.0.1:8000/admin/default/edit/dev_thanemobile/controllers/default.py>,
>>  line 2004, in 
>>   File "/Users/adnan/web2py24/gluon/globals.py", line 193, in 
>> self._caller = lambda f: f()
>>   File 
>> "/Users/adnan/web2py24/applications/dev_thanemobile/controllers/default.py" 
>> <http://127.0.0.1:8000/admin/default/edit/dev_thanemobile/controllers/default.py>,
>>  line 1946, in inquire
>> formstyle='bootstrap', )
>>   File "/Users/adnan/web2py24/gluon/sqlhtml.py", line 1580, in factory
>> **attributes)
>>   File "/Users/adnan/web2py24/gluon/sqlhtml.py", line 1200, in __init__
>> table = self.createform(xfields)
>>   File "/Users/adnan/web2py24/gluon/sqlhtml.py", line 1224, in createform
>> table = formstyle(self, xfields)
>>   File "/Users/adnan/web2py24/gluon/sqlhtml.py", line 768, in 
>> formstyle_bootstrap
>> form['_class'] += ' form-horizontal'
>> TypeError: unsupported operand type(s) for +=: 'NoneType' and 'str'
>>
>>
>>
>>
>> Function argument list 
>>
>> (form=, 
>> fields=[('no_table_email_address__row', , 
>> , ''), ('no_table_ext_order__row', 
>> , , ''), 
>> ('submit_record__row', '', , '')])
>>  Code listing 
>>
>> 763.
>> 764.
>> 765.
>> 766.
>> 767.
>> 768.
>>
>> 769.
>> 770.
>> 771.
>> 772.
>>
>> return table
>>
>>
>> def formstyle_bootstrap(form, fields):
>> ''' bootstrap format form layout '''
>> form['_class'] += ' form-horizontal'
>>
>> parent = FIELDSET()
>> for id, label, controls, help in fields:
>> # wrappers
>> _help = SPAN(help, _class='help-inline')
>>
>>  Variables form 
>>
>

-- 





[web2py] (2, 4, 1, 'alpha.2', datetime.datetime(2013, 1, 8, 15, 30, 47)) trunk: formstyle_bootstrap broken

2013-01-09 Thread Adi

Seems that bootstrap broke in latest trunk. All my forms, which use 
bootstrap are returning errors... commenting formstyle='bootstrap' makes it 
work fine.


Traceback (most recent call last):
  File "/Users/adnan/web2py24/gluon/restricted.py", line 212, in restricted
exec ccode in environment
  File 
"/Users/adnan/web2py24/applications/dev_thanemobile/controllers/default.py" 
,
 line 2004, in 
  File "/Users/adnan/web2py24/gluon/globals.py", line 193, in 
self._caller = lambda f: f()
  File 
"/Users/adnan/web2py24/applications/dev_thanemobile/controllers/default.py" 
,
 line 1946, in inquire
formstyle='bootstrap', )
  File "/Users/adnan/web2py24/gluon/sqlhtml.py", line 1580, in factory
**attributes)
  File "/Users/adnan/web2py24/gluon/sqlhtml.py", line 1200, in __init__
table = self.createform(xfields)
  File "/Users/adnan/web2py24/gluon/sqlhtml.py", line 1224, in createform
table = formstyle(self, xfields)
  File "/Users/adnan/web2py24/gluon/sqlhtml.py", line 768, in 
formstyle_bootstrap
form['_class'] += ' form-horizontal'
TypeError: unsupported operand type(s) for +=: 'NoneType' and 'str'




Function argument list 

(form=, 
fields=[('no_table_email_address__row', , 
, ''), ('no_table_ext_order__row', 
, , ''), 
('submit_record__row', '', , '')])
 Code listing 

763.
764.
765.
766.
767.
768.

769.
770.
771.
772.

return table


def formstyle_bootstrap(form, fields):
''' bootstrap format form layout '''
form['_class'] += ' form-horizontal'

parent = FIELDSET()
for id, label, controls, help in fields:
# wrappers
_help = SPAN(help, _class='help-inline')

 Variables form 

-- 





[web2py] Re: emailing From: full name

2013-01-08 Thread Adi
Hi Jonathan,
Mine is putting properly company name in front of the address, by using:  
mail.settings.sender = 'Company', but knowing that you are a guru here, may 
not be at all what you are looking for... If you wanted I could send you a 
sample email privately to see if that's what you needed?

Adnan




On Tuesday, January 8, 2013 1:32:23 PM UTC-5, Jonathan Lundell wrote:
>
> I tried to persuade the web2py emailer to use a full name (like: 'My Name <
> mym...@mail.com >') in the From: header by setting it in the 
> headers argument, but it didn't work: From continued to be set to the value 
> of sender (the bare email address). 
>
> As I read the code, From is initialized to the value of sender, but should 
> be overridden by headers. And for reference, if I set 'X-From' instead, 
> that did end up in the headers as I would have expected. 
>
> The Python smtplib suggests that it doesn't mess with the embedded 
> headers. I suppose it could be happening farther down the line, and 
> eventually I'll do some experimentation, but I thought I'd see whether 
> anyone on the list has solved the problem first. 
>
>

-- 





[web2py] Re: replacing plugin_wiki with auth.wiki

2013-01-02 Thread Adi

Thanks Alan again, but it seems to me that height of iframe can be 
controlled only when creating it in protolinks_simple(). Changing width 
worked fine.

Would we be able to extend protolinks_simple to accept the width and height 
as parameters to control the size of iframe? I don't know the bigger scope 
of this function, and possibility to add extra parameters... 

def protolinks_simple(proto, url, width, height):
"""
it converts url to html-string using appropriate proto-prefix:
Uses for construction "proto:url", e.g.:
"iframe:http://www.example.com/path"; will call protolinks()
with parameters:
proto="iframe"
url="http://www.example.com/path";
"""
if proto in ('iframe','embed'): #== 'iframe':
return ''%[url,width, height]
#elif proto == 'embed':  # NOTE: embed is a synonym to iframe now
#return '%s>'%(url,class_prefix,url)
elif proto == 'qr':
return 'http://qrcode.kaywa.com/img.php?s=8&d=%s"; 
alt="qr code" />'%url
return proto+':'+url












On Wednesday, January 2, 2013 10:44:58 AM UTC-5, Alan Etkin wrote:
>
> On Wednesday, January 2, 2013 1:44:39 AM UTC-3, Adi wrote:
>>
>> Thanks Alan for your help. 
>>
>> Have two more questions related to this: 
>>
>>
> Maybe in the view you can do something like:
>
> {{=DIV(MARKMIN(mm), _id="videoframe"))}}
>
> An then use CSS for adding the size to the content
>
> div#videoframe{
>   width="640px";
>   height="480px";
> }
>
>

-- 





[web2py] Re: replacing plugin_wiki with auth.wiki

2013-01-01 Thread Adi
Thanks Alan for your help. 

Have two more questions related to this: 

1. In a thread bellow Massimo suggested to deprecate "embed', but without 
it, the video will not be embedded, only link will be displayed. Should I 
stick to embed, or look for some other solution? 
https://groups.google.com/d/topic/web2py/0O8db-UTZk4/discussion

2. Is there any way to set the size of the iframe through MARKMIN? I found 
width=270, height=230 displays nicely commands at the bottom of the youtube 
video. 
 

On Tuesday, January 1, 2013 9:55:36 PM UTC-5, Alan Etkin wrote:
>
> > El martes, 1 de enero de 2013 22:11:55 UTC-3, Adi escribió:At the moment 
> I'm using
> > plugin_wiki to display youtube videos on web pages. How would I replace 
> it with 
> > auth.wiki() without creating new wiki pages, and wiki menu?
>
> The built-in MARKMIN helper is the simplest tool to embed video:
>
> def myvideo():
> mm = """
>  Planets and stars scales
> embed:http://www.youtube.com/embed/x1w8hKTJ2Co
> """
> return dict(video=MARKMIN(mm))
>
> There's an introduction to MARKMIN and the markmin syntax in the book:
> http://www.web2py.com/books/default/chapter/29/05#HTML-helpers
>
>

-- 





[web2py] replacing plugin_wiki with auth.wiki

2013-01-01 Thread Adi
At the moment I'm using plugin_wiki to display youtube videos on web pages. 
How would I replace it with auth.wiki() without creating new wiki pages, 
and wiki menu? 

{{=plugin_wiki.widget('youtube', code=video.strip(), width=270, 
height=230)}}

Thanks,
Adnan

-- 





[web2py] Re: fall back for memcached to db caching

2012-12-24 Thread Adi
Thanks Massimo. The exception works fine, but the problem raised when 
calling a grid. Didn't realize it's not possible to connect to another 
session within the "except" segment. Seems that code has to be outside. 
Still learning python here :)


db.py
-
try:
from gluon.contrib.memcache import MemcacheClient
memcache_servers = ['127.0.0.1:11211']
cache.memcache = MemcacheClient(request, memcache_servers)
cache.ram = cache.disk = cache.memcache
from gluon.contrib.memdb import MEMDB
session.connect(request,response,db=MEMDB(cache.memcache))
except Exception:
session.connect(request, response, db=db) # doesn't work
pass

# had to do it this way, and then all works as expected
if not session:
session.connect(request, response, db=db)

db.define_table('mytable',Field('myfield','string'))


default.py
--
def gr():
q = (db.mytable.id>0)
grid=SQLFORM.grid(q)
return dict()









On Monday, December 24, 2012 5:11:17 PM UTC-5, Massimo Di Pierro wrote:
>
> Can you try replace:
>
> except:
>
> with
>
> except Exception:
>
> On Monday, 24 December 2012 10:04:08 UTC-6, Adi wrote:
>>
>> Tried catching the exception when memcache is not available to switch to 
>> db caching, but getting an excepting. 
>>
>> Should it be possible to catch this exception, ignore it and continue 
>> running? 
>>
>> Thanks,
>> Adnan
>>
>>
>> try:
>> from gluon.contrib.memcache import MemcacheClient
>> memcache_servers = ['127.0.0.1:11211']
>> cache.memcache = MemcacheClient(request, memcache_servers)
>> cache.ram = cache.disk = cache.memcache
>> from gluon.contrib.memdb import MEMDB
>> session.connect(request,response,db=MEMDB(cache.memcache))
>> except:
>> sys.exc_clear()
>> session.connect(request, response, db=db)
>> pass
>>
>>
>>
>> Traceback (most recent call last):
>>  File "/Users/adnan/web2py24/gluon/main.py", line 557, in wsgibase
>>  session._try_store_in_db(request, response)
>>  File "/Users/adnan/web2py24/gluon/globals.py", line 739, in_try_store_in_db
>>  record_id = table.insert(**dd)
>>  File "/Users/adnan/web2py24/gluon/contrib/memdb.py", line 256, in insert
>>  id = self._create_id()
>>  File "/Users/adnan/web2py24/gluon/contrib/memdb.py", line 296, in_create_id
>>  raise Exception('cannot set memcache')
>> Exception: cannot set memcache
>>
>>
>>
>> Frames 
>>  
>>  
>>
>>  File /Users/adnan/web2py24/gluon/main.py in wsgibase at line 557 code 
>> arguments variables 
>>  
>>  
>>
>>  File /Users/adnan/web2py24/gluon/globals.py in _try_store_in_db at line 
>> 739 code arguments variables 
>>  
>>  
>>
>>  File /Users/adnan/web2py24/gluon/contrib/memdb.py in insert at line 256code 
>> arguments variables 
>>  
>>  
>>
>>  File /Users/adnan/web2py24/gluon/contrib/memdb.py in _create_id at line 
>> 296 code arguments variables 
>>  
>> Function argument list 
>>
>> (self=> memdb.Field object at 0x111d554d0>}>) 
>>  
>> Code listing 
>> 291.
>> 292.
>> > Show 
>> original<https://groups.google.com/group/web2py/msg/dc3f7fc28bb3d0c5?dmode=source&output=gplain&noredirect>
>>
>

-- 





[web2py] fall back for memcached to db caching

2012-12-24 Thread Adi
Tried catching the exception when memcache is not available to switch to db 
caching, but getting an excepting. 

Should it be possible to catch this exception, ignore it and continue 
running? 

Thanks,
Adnan


try:
from gluon.contrib.memcache import MemcacheClient
memcache_servers = ['127.0.0.1:11211']
cache.memcache = MemcacheClient(request, memcache_servers)
cache.ram = cache.disk = cache.memcache
from gluon.contrib.memdb import MEMDB
session.connect(request,response,db=MEMDB(cache.memcache))
except:
sys.exc_clear()
session.connect(request, response, db=db)
pass



Traceback (most recent call last):
 File "/Users/adnan/web2py24/gluon/main.py", line 557, in wsgibase
 session._try_store_in_db(request, response)
 File "/Users/adnan/web2py24/gluon/globals.py", line 739, in_try_store_in_db
 record_id = table.insert(**dd)
 File "/Users/adnan/web2py24/gluon/contrib/memdb.py", line 256, in insert
 id = self._create_id()
 File "/Users/adnan/web2py24/gluon/contrib/memdb.py", line 296, in_create_id
 raise Exception('cannot set memcache')
Exception: cannot set memcache



Frames 
 
 

 File /Users/adnan/web2py24/gluon/main.py in wsgibase at line 557 code 
arguments variables 
 
 

 File /Users/adnan/web2py24/gluon/globals.py in _try_store_in_db at line 
739code arguments variables 
 
 

 File /Users/adnan/web2py24/gluon/contrib/memdb.py in insert at line 256code 
arguments variables 
 
 

 File /Users/adnan/web2py24/gluon/contrib/memdb.py in _create_id at line 
296code arguments variables 
 
Function argument list 

(self=}>) 
 
Code listing 
291.
292.
293.
294.
295.

296.
297.
298.
299.
300.
 id = self._tableobj.incr(shard_id)
 if not id:
 if self._tableobj.set(shard_id, '0'):
 id = 0
 else:

 raise Exception('cannot set memcache')
 return long(str(shard) + str(id))

 def __str__(self):
 return self._tablename












-- 





[web2py] Re: help testing auth.signature with mysql/pgsql

2012-12-22 Thread Adi
let me know when you change. i can test again...  

On Saturday, December 22, 2012 2:40:19 PM UTC-5, Massimo Di Pierro wrote:
>
> This is not exactly what I was hoping for but it shows a problem with 
> trunk.
>
> It migrates is_active form notnull=False to notnull=True and then tries to 
> copy the old data (which include Null values).
>
> This will break the migration. It worked for you because the step was only 
> faked. The creation of the new table is never a problem.
>
> I have reverted the change in trunk.
>
> Massimo
>
>
> On Saturday, 22 December 2012 13:28:13 UTC-6, Adi wrote:
>>
>>
>> My app was in a fake migration mode, and when I enabled a migration it 
>> wanted to re-ecreate two existing tables, one regular (pmt), the other 
>> archive (customer_archive)... (sql.log bellow). 
>>
>> I renamed existing tables in order to proceed... 
>>
>> What I see is that archive table got created with is_active notnull, and 
>> default T, while existing tables stayed as is... 
>>
>> Tried updating record in customer table and all worked ok... 
>>
>>
>> sql.log:
>>
>> timestamp: 2012-12-22T13:57:59.269217
>> ALTER TABLE lookup ADD is_active__tmp CHAR(1) NOT NULL DEFAULT 'T';
>> faked!
>> UPDATE lookup SET is_active__tmp=is_active;
>> faked!
>> ALTER TABLE lookup DROP COLUMN is_active;
>> faked!
>> ALTER TABLE lookup ADD is_active CHAR(1) NOT NULL DEFAULT 'T';
>> faked!
>> UPDATE lookup SET is_active=is_active__tmp;
>> faked!
>> ALTER TABLE lookup DROP COLUMN is_active__tmp;
>> faked!
>> timestamp: 2012-12-22T13:57:59.298807
>> ALTER TABLE comment ADD is_active__tmp CHAR(1) NOT NULL DEFAULT 'T';
>> faked!
>> UPDATE comment SET is_active__tmp=is_active;
>> faked!
>> ALTER TABLE comment DROP COLUMN is_active;
>> faked!
>> ALTER TABLE comment ADD is_active CHAR(1) NOT NULL DEFAULT 'T';
>> faked!
>> UPDATE comment SET is_active=is_active__tmp;
>> faked!
>> ALTER TABLE comment DROP COLUMN is_active__tmp;
>> faked!
>> timestamp: 2012-12-22T13:57:59.342240
>> ALTER TABLE configuration ADD is_active__tmp CHAR(1) NOT NULL DEFAULT 'T';
>> faked!
>> UPDATE configuration SET is_active__tmp=is_active;
>> faked!
>> ALTER TABLE configuration DROP COLUMN is_active;
>> faked!
>> ALTER TABLE configuration ADD is_active CHAR(1) NOT NULL DEFAULT 'T';
>> faked!
>> UPDATE configuration SET is_active=is_active__tmp;
>> faked!
>> ALTER TABLE configuration DROP COLUMN is_active__tmp;
>> faked!
>> timestamp: 2012-12-22T13:57:59.375178
>> ALTER TABLE supplier ADD is_active__tmp CHAR(1) NOT NULL DEFAULT 'T';
>> faked!
>> UPDATE supplier SET is_active__tmp=is_active;
>> faked!
>> ALTER TABLE supplier DROP COLUMN is_active;
>> faked!
>> ALTER TABLE supplier ADD is_active CHAR(1) NOT NULL DEFAULT 'T';
>> faked!
>> UPDATE supplier SET is_active=is_active__tmp;
>> faked!
>> ALTER TABLE supplier DROP COLUMN is_active__tmp;
>> faked!
>> timestamp: 2012-12-22T13:57:59.415936
>> ALTER TABLE customer ADD is_active__tmp CHAR(1) NOT NULL DEFAULT 'T';
>> faked!
>> UPDATE customer SET is_active__tmp=is_active;
>> faked!
>> ALTER TABLE customer DROP COLUMN is_active;
>> faked!
>> ALTER TABLE customer ADD is_active CHAR(1) NOT NULL DEFAULT 'T';
>> faked!
>> UPDATE customer SET is_active=is_active__tmp;
>> faked!
>> ALTER TABLE customer DROP COLUMN is_active__tmp;
>> faked!
>> timestamp: 2012-12-22T13:57:59.464933
>> ALTER TABLE next_po_number ADD is_active__tmp CHAR(1) NOT NULL DEFAULT 'T';
>> faked!
>> UPDATE next_po_number SET is_active__tmp=is_active;
>> faked!
>> ALTER TABLE next_po_number DROP COLUMN is_active;
>> faked!
>> ALTER TABLE next_po_number ADD is_active CHAR(1) NOT NULL DEFAULT 'T';
>> faked!
>> UPDATE next_po_number SET is_active=is_active__tmp;
>> faked!
>> ALTER TABLE next_po_number DROP COLUMN is_active__tmp;
>> faked!
>> timestamp: 2012-12-22T13:57:59.511872
>> ALTER TABLE purchase_order ADD is_active__tmp CHAR(1) NOT NULL DEFAULT 'T';
>> faked!
>> UPDATE purchase_order SET is_active__tmp=is_active;
>> faked!
>> ALTER TABLE purchase_order DROP COLUMN is_active;
>> faked!
>> ALTER TABLE purchase_order ADD is_active CHAR(1) NOT NULL DEFAULT 'T';
>> faked!
>> UPDATE purchase_order SET is_active=is_active__tmp;
>> faked!
>> A

[web2py] Re: help testing auth.signature with mysql/pgsql

2012-12-22 Thread Adi
),
amount_paid DOUBLE,
date_wire_actg DATE,
partial_payment VARCHAR(255),
amount_paid2 DOUBLE,
date_to_actg2 DATE,
amount_paid3 DOUBLE,
date_to_actg3 DATE,
amount_paid4 DOUBLE,
date_to_actg4 DATE,
payment_notes1 LONGTEXT,
payment_notes2 LONGTEXT,
payment_notes3 LONGTEXT,
is_active CHAR(1) NOT NULL DEFAULT 'T',
created_on DATETIME,
created_by INT, INDEX created_by__idx (created_by), FOREIGN KEY 
(created_by) REFERENCES auth_user (id) ON DELETE CASCADE,
modified_on DATETIME,
modified_by INT, INDEX modified_by__idx (modified_by), FOREIGN KEY 
(modified_by) REFERENCES auth_user (id) ON DELETE CASCADE,
PRIMARY KEY(id)
) ENGINE=InnoDB CHARACTER SET utf8;
timestamp: 2012-12-22T14:11:13.034603
CREATE TABLE pmt(
id INT AUTO_INCREMENT NOT NULL,
tbl_uuid VARCHAR(64),
po_id INT, INDEX po_id__idx (po_id), FOREIGN KEY (po_id) REFERENCES 
purchase_order (id) ON DELETE CASCADE,
currency VARCHAR(255),
invoice_no VARCHAR(255),
amount_paid DOUBLE,
date_wire_actg DATE,
partial_payment VARCHAR(255),
amount_paid2 DOUBLE,
date_to_actg2 DATE,
amount_paid3 DOUBLE,
date_to_actg3 DATE,
amount_paid4 DOUBLE,
date_to_actg4 DATE,
payment_notes1 LONGTEXT,
payment_notes2 LONGTEXT,
payment_notes3 LONGTEXT,
is_active CHAR(1) NOT NULL DEFAULT 'T',
created_on DATETIME,
created_by INT, INDEX created_by__idx (created_by), FOREIGN KEY 
(created_by) REFERENCES auth_user (id) ON DELETE CASCADE,
modified_on DATETIME,
modified_by INT, INDEX modified_by__idx (modified_by), FOREIGN KEY 
(modified_by) REFERENCES auth_user (id) ON DELETE CASCADE,
PRIMARY KEY(id)
) ENGINE=InnoDB CHARACTER SET utf8;
success!
timestamp: 2012-12-22T14:16:04.319236
CREATE TABLE customer_archive(
current_record INT, INDEX current_record__idx (current_record), FOREIGN KEY 
(current_record) REFERENCES customer (id) ON DELETE CASCADE,
id INT AUTO_INCREMENT NOT NULL,
tbl_uuid VARCHAR(64),
name VARCHAR(255),
number VARCHAR(255),
address LONGTEXT,
ship_to LONGTEXT,
payment_term INT, INDEX payment_term__idx (payment_term), FOREIGN KEY 
(payment_term) REFERENCES lookup (id) ON DELETE CASCADE,
forwarder LONGTEXT,
destination VARCHAR(255),
attn VARCHAR(255),
phone VARCHAR(255),
fax VARCHAR(255),
email VARCHAR(255),
bl_telex_released VARCHAR(255),
orig_docs_to LONGTEXT,
doc_requirements LONGTEXT,
special_instructions LONGTEXT,
shipping_marks LONGTEXT,
is_active CHAR(1) NOT NULL DEFAULT 'T',
created_on DATETIME,
created_by INT, INDEX created_by__idx (created_by), FOREIGN KEY 
(created_by) REFERENCES auth_user (id) ON DELETE CASCADE,
modified_on DATETIME,
modified_by INT, INDEX modified_by__idx (modified_by), FOREIGN KEY 
(modified_by) REFERENCES auth_user (id) ON DELETE CASCADE,
PRIMARY KEY(id)
) ENGINE=InnoDB CHARACTER SET utf8;
timestamp: 2012-12-22T14:18:50.404571
CREATE TABLE customer_archive(
current_record INT, INDEX current_record__idx (current_record), FOREIGN KEY 
(current_record) REFERENCES customer (id) ON DELETE CASCADE,
id INT AUTO_INCREMENT NOT NULL,
tbl_uuid VARCHAR(64),
name VARCHAR(255),
number VARCHAR(255),
address LONGTEXT,
ship_to LONGTEXT,
payment_term INT, INDEX payment_term__idx (payment_term), FOREIGN KEY 
(payment_term) REFERENCES lookup (id) ON DELETE CASCADE,
forwarder LONGTEXT,
destination VARCHAR(255),
attn VARCHAR(255),
phone VARCHAR(255),
fax VARCHAR(255),
email VARCHAR(255),
bl_telex_released VARCHAR(255),
orig_docs_to LONGTEXT,
doc_requirements LONGTEXT,
special_instructions LONGTEXT,
shipping_marks LONGTEXT,
is_active CHAR(1) NOT NULL DEFAULT 'T',
created_on DATETIME,
created_by INT, INDEX created_by__idx (created_by), FOREIGN KEY 
(created_by) REFERENCES auth_user (id) ON DELETE CASCADE,
modified_on DATETIME,
modified_by INT, INDEX modified_by__idx (modified_by), FOREIGN KEY 
(modified_by) REFERENCES auth_user (id) ON DELETE CASCADE,
PRIMARY KEY(id)
) ENGINE=InnoDB CHARACTER SET utf8;
success!




On Saturday, December 22, 2012 1:56:28 PM UTC-5, Massimo Di Pierro wrote:
>
> Specifically let me know:
> - after upgrade, do you see a migration in sql.log?
> - does everything seem to work or you get a ticket?
>
> Masimo
>
> On Saturday, 22 December 2012 12:30:25 UTC-6, Adi wrote:
>>
>> do you mean: db._common_fields.append(auth.signature)
>>
>> i have it, and can test now
>>
>> On Saturday, December 22, 2012 12:44:06 PM UTC-5, Massimo Di Pierro wrote:
>>>
>>> If you have fields with auth.signature and mysql/pgsql could you help me 
>>> test the latest trunk?
>>>
>>> The reason is that I changed the is_active field from notnull=False to 
>>> notnull=True. This should trigger a migration of your data. I want to make 
>>> sure nothing breaks.
>>>
>>> Can you confirm this is ok?
>>>
>>> Massimo
>>>
>>

-- 





[web2py] Re: help testing auth.signature with mysql/pgsql

2012-12-22 Thread Adi
do you mean: db._common_fields.append(auth.signature)

i have it, and can test now

On Saturday, December 22, 2012 12:44:06 PM UTC-5, Massimo Di Pierro wrote:
>
> If you have fields with auth.signature and mysql/pgsql could you help me 
> test the latest trunk?
>
> The reason is that I changed the is_active field from notnull=False to 
> notnull=True. This should trigger a migration of your data. I want to make 
> sure nothing breaks.
>
> Can you confirm this is ok?
>
> Massimo
>

-- 





[web2py] Re: how to use session in cookie?

2012-12-22 Thread Adi
Thanks Massimo. 

So, is session.connect(request, response, db=db) my only option for mysql 
at the moment?  i tried to get memcache working, but getting stuck with 
syntax... is there a valid sample somewhere?

In one of the posts I found this code, but getting an error bellow... 

from gluon.contrib.memcache import MemcacheClient
memcache_servers = ['127.0.0.1:11211']
cache.memcache = MemcacheClient(request, memcache_servers)
cache.ram = cache.disk = cache.memcache

from gluon.contrib.memdb import MEMDB
session.connect(request,response,db=MEMDB(cache.memcache))

session.connect(request, response, db=MEMDB(cache.memcache))


1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.

Traceback (most recent call last):
  File "/Users/adnan/web2py24/gluon/main.py", line 557, in wsgibase
session._try_store_in_db(request, response)
  File "/Users/adnan/web2py24/gluon/globals.py", line 739, in _try_store_in_db
record_id = table.insert(**dd)
  File "/Users/adnan/web2py24/gluon/contrib/memdb.py", line 256, in insert
id = self._create_id()
  File "/Users/adnan/web2py24/gluon/contrib/memdb.py", line 296, in _create_id
raise Exception('cannot set memcache')
Exception: cannot set memcache


Frames  

   - 
   
   
   *File /Users/adnan/web2py24/gluon/main.py in wsgibase at 
   line 557*
   code
   arguments
   variables  
   
   *File /Users/adnan/web2py24/gluon/globals.py in_try_store_in_db 
at line 
   739*
   code
   arguments
   variables   
   
   
   *File /Users/adnan/web2py24/gluon/contrib/memdb.py in insert 
   at line 256*
   code
   arguments
   variables
   
   
   *File /Users/adnan/web2py24/gluon/contrib/memdb.py in_create_id 
at line 
   296*
   code
   arguments
   variables
   Function argument list
   
   
   (self=}>)   
   Code listing
   
   
   
   291.
   292.
   293.
   294.
   295.
   296.
   
   297.
   298.
   299.
   300.
   
   id = self._tableobj.incr(shard_id)
   if not id:
   if self._tableobj.set(shard_id, '0'):
   id = 0
   else:
   raise Exception('cannot set memcache')
   
   return long(str(shard) + str(id))
   
   def __str__(self):
   return self._tablename
   
   - 
   
Enter code here...







On Saturday, December 22, 2012 12:38:06 PM UTC-5, Massimo Di Pierro wrote:
>
> In think the problem is exactly the size of the cookie.
>
> On Saturday, 22 December 2012 10:15:20 UTC-6, Adi wrote:
>>
>> Sorry Massimo,
>> Seems I was looking into wrong error_log... This one is related to 
>> web2py... JUst run it again: 
>>
>> [Sat Dec 22 11:10:53 2012] [error] [client 24.150.57.81] (13)Permission 
>> denied: access to /mobipp_us/static/plugin_wiki/rating/jquery.rating.js 
>> denied, referer: http://w.replacedserver.com/mobipp_us/category/11
>> [Sat Dec 22 11:10:57 2012] [error] [client 24.150.57.81] malformed header 
>> from script. Bad header=QRZl7DmMFohP98mTnbyI4cEEvQcxWS: wsgihandler.py, 
>> referer: http://w.replacedserver.com/mobipp_us/category/11
>>
>>
>>
>> On Saturday, December 22, 2012 10:32:34 AM UTC-5, Adi wrote:
>>>
>>> Size could definitely be my problem... 
>>>
>>> Bellow is the bottom part of the Apache error log: 
>>> [Sat Dec 22 04:22:50 2012] [error] k,len 0 3
>>> [Sat Dec 22 04:22:50 2012] [error] k,len 1 3
>>> [Sat Dec 22 04:22:50 2012] [error] k,len 2 3
>>> [Sat Dec 22 04:22:54 2012] [error] k,len 0 3
>>> [Sat Dec 22 04:22:54 2012] [error] k,len 1 3
>>> [Sat Dec 22 04:22:54 2012] [error] k,len 2 3
>>> [Sat Dec 22 07:39:04 2012] [error] {'ACK': ['Success'], 'TIMESTAMP': 
>>> ['2012-12-22T12:39:04Z'], 'TOKEN': ['EC-25J033232E8733719'], 'VERSION': 
>>> ['95.0'], 'BUILD': ['4181146'], 'CORRELATIONID': ['2fcce583dd4e2']}
>>> [Sat Dec 22 08:18:29 2012] [error] {'ACK': ['Success'], 'TIMESTAMP': 
>>> ['2012-12-22T13:18:29Z'], 'TOKEN': ['EC-3RG928080L406004A'], 'VERSION': 
>>> ['95.0'], 'BUILD': ['4181146'], 'CORRELATIONID': ['bea4a71f87268']}
>>> [Sat Dec 22 08:25:17 2012] [error] {'ACK': ['Success'], 'TIMESTAMP': 
>>> ['2012-12-22T13:25:17Z'], 'TOK

[web2py] Re: how to use session in cookie?

2012-12-22 Thread Adi
Sorry Massimo,
Seems I was looking into wrong error_log... This one is related to 
web2py... JUst run it again: 

[Sat Dec 22 11:10:53 2012] [error] [client 24.150.57.81] (13)Permission 
denied: access to /mobipp_us/static/plugin_wiki/rating/jquery.rating.js 
denied, referer: http://w.replacedserver.com/mobipp_us/category/11
[Sat Dec 22 11:10:57 2012] [error] [client 24.150.57.81] malformed header 
from script. Bad header=QRZl7DmMFohP98mTnbyI4cEEvQcxWS: wsgihandler.py, 
referer: http://w.replacedserver.com/mobipp_us/category/11



On Saturday, December 22, 2012 10:32:34 AM UTC-5, Adi wrote:
>
> Size could definitely be my problem... 
>
> Bellow is the bottom part of the Apache error log: 
> [Sat Dec 22 04:22:50 2012] [error] k,len 0 3
> [Sat Dec 22 04:22:50 2012] [error] k,len 1 3
> [Sat Dec 22 04:22:50 2012] [error] k,len 2 3
> [Sat Dec 22 04:22:54 2012] [error] k,len 0 3
> [Sat Dec 22 04:22:54 2012] [error] k,len 1 3
> [Sat Dec 22 04:22:54 2012] [error] k,len 2 3
> [Sat Dec 22 07:39:04 2012] [error] {'ACK': ['Success'], 'TIMESTAMP': 
> ['2012-12-22T12:39:04Z'], 'TOKEN': ['EC-25J033232E8733719'], 'VERSION': 
> ['95.0'], 'BUILD': ['4181146'], 'CORRELATIONID': ['2fcce583dd4e2']}
> [Sat Dec 22 08:18:29 2012] [error] {'ACK': ['Success'], 'TIMESTAMP': 
> ['2012-12-22T13:18:29Z'], 'TOKEN': ['EC-3RG928080L406004A'], 'VERSION': 
> ['95.0'], 'BUILD': ['4181146'], 'CORRELATIONID': ['bea4a71f87268']}
> [Sat Dec 22 08:25:17 2012] [error] {'ACK': ['Success'], 'TIMESTAMP': 
> ['2012-12-22T13:25:17Z'], 'TOKEN': ['EC-7GY27898JG123493D'], 'VERSION': 
> ['95.0'], 'BUILD': ['4181146'], 'CORRELATIONID': ['3941637927a28']}
> [Sat Dec 22 08:26:09 2012] [error] k,len 0 1
> [Sat Dec 22 08:26:23 2012] [error] k,len 0 1
>
> I would like to steer away from db sessions, since we had a large problem 
> when doing PCI compliance test with nCircle... They could literally bring 
> our websites down due to opening million parallel connections, which should 
> be fine... The error was on our side :) Memcache resolved that problem, but 
> that was with php. Now, I would like to use the similar approach with 
> web2py, and then we can test a pci scan :) 
>
>
> On Saturday, December 22, 2012 10:02:28 AM UTC-5, Massimo Di Pierro wrote:
>>
>> Can you please look for the error in the apache logs?
>>
>> There is a limitation in the cookie size wich may break for large 
>> sessions. 
>>
>> On Saturday, 22 December 2012 08:49:04 UTC-6, Adi wrote:
>>>
>>>
>>>
>>> I tried using session.connect(cookie_key='key', compression_level=9) 
>>> instead of session.connect(request, response, db=db), and got the error 
>>> as bellow, plus some inconsistent unexpected behavior. When I rolled back 
>>> to db sessions all works fine as expected. It's an e-commerce app, 
>>> usingsessions bit heavier. 
>>>
>>> Are there known limitations for using cookie sessions? Also, if I can 
>>> use memcache with mysql, how do I define a client? Tried mc = 
>>> memcache.Client(['127.0.0.1:11211'], debug=0), with no success...
>>>
>>> Thanks,
>>> Adnan
>>>
>>>
>>> web2py: Version 2.3.2 (2012-12-17 15:03:30) stable
>>>
>>> OK
>>>
>>>
>>> The server encountered an internal error or misconfiguration and was 
>>> unable to complete your request.
>>>
>>> Please contact the server administrator, root@localhost and inform them 
>>> of the time the error occurred, and anything you might have done that may 
>>> have caused the error.
>>>
>>> More information about this error may be available in the server error 
>>> log.
>>> Apache/2.2.3 (Red Hat) Server at w2p.demo.com Port 80
>>>
>>>
>>>

-- 





[web2py] Re: probing into examples application

2012-12-22 Thread Adi
Thanks Simone. 

Just wanted to mention it, in case there is potentially something to 
double-check, or worry, but all seems to be good :) 

On Saturday, December 22, 2012 9:14:23 AM UTC-5, Niphlod wrote:
>
> well, the source code is available since the example app is released with 
> web2py... 
> I don't think any "security" is breached if someone is accessing those 
> pages. 
>
> PS: Of course in production you should deploy only your app and remove 
> examples. Welcome and admin are also going to be removed if you don't need 
> to develop something on the server.
> PS2: Expect a lot of scanning also at urls like /phpmyadmin/, /wp-admin/ 
> etc  trolls and auto-bots are never going to stop probing urls.
>
> On Saturday, December 22, 2012 2:46:59 PM UTC+1, Adi wrote:
>>
>> Just noticed from gogle webmaster tools that someone was probing into 
>> links bellow and got 500 server response for each. Is there anything that 
>> could potentially be dangerous from a security prospective, since 
>> "examples" get deployed with every installation of web2py? (I deleted it 
>> now in production, but didn't think of it as a threat before)
>>
>> examples/global/vars
>> examples/global/vars/H1/__class__
>> examples/global/vars/XML/__class__
>> examples/global/vars/INPUT/__class__
>> examples/global/vars/IS_NOT_EMPTY/__class__
>> examples/global/vars/IS_IN_SET/__class__
>> examples/global/vars/IS_INT_IN_RANGE/__class__
>> examples/global/vars/DIV/__class__
>> examples/global/vars/HTML/__class__
>> examples/global/vars/A/__class__
>> examples/global/vars/SELECT/__class__
>> examples/simple_examples/raiseexception
>> examples/global/vars/BODY/__class__
>> examples/global/vars/IS_EMAIL/__class__
>> examples/global/vars/TEXTAREA/__class__
>> examples/global/vars/SQLTABLE/__class__
>> examples/global/vars/SQLFORM/__class__
>> examples/global/vars/IS_NOT_IN_DB/__class__
>> examples/global/vars/IS_IN_DB/__class__
>> examples/global/vars/FORM/__class__
>> examples/global/vars/Field/__class__
>> examples/global/vars/BEAUTIFY/__class__
>> examples/global/vars/HTTP/__class__
>> examples/global/vars/MARKMIN/__class__
>> examples/global/vars/TABLE/__class__
>> examples/simple_examples/rss_aggregator
>> examples/global/vars/TR/__class__
>>
>>

-- 





[web2py] Re: how to use session in cookie?

2012-12-22 Thread Adi
Size could definitely be my problem... 

Bellow is the bottom part of the Apache error log: 
[Sat Dec 22 04:22:50 2012] [error] k,len 0 3
[Sat Dec 22 04:22:50 2012] [error] k,len 1 3
[Sat Dec 22 04:22:50 2012] [error] k,len 2 3
[Sat Dec 22 04:22:54 2012] [error] k,len 0 3
[Sat Dec 22 04:22:54 2012] [error] k,len 1 3
[Sat Dec 22 04:22:54 2012] [error] k,len 2 3
[Sat Dec 22 07:39:04 2012] [error] {'ACK': ['Success'], 'TIMESTAMP': 
['2012-12-22T12:39:04Z'], 'TOKEN': ['EC-25J033232E8733719'], 'VERSION': 
['95.0'], 'BUILD': ['4181146'], 'CORRELATIONID': ['2fcce583dd4e2']}
[Sat Dec 22 08:18:29 2012] [error] {'ACK': ['Success'], 'TIMESTAMP': 
['2012-12-22T13:18:29Z'], 'TOKEN': ['EC-3RG928080L406004A'], 'VERSION': 
['95.0'], 'BUILD': ['4181146'], 'CORRELATIONID': ['bea4a71f87268']}
[Sat Dec 22 08:25:17 2012] [error] {'ACK': ['Success'], 'TIMESTAMP': 
['2012-12-22T13:25:17Z'], 'TOKEN': ['EC-7GY27898JG123493D'], 'VERSION': 
['95.0'], 'BUILD': ['4181146'], 'CORRELATIONID': ['3941637927a28']}
[Sat Dec 22 08:26:09 2012] [error] k,len 0 1
[Sat Dec 22 08:26:23 2012] [error] k,len 0 1

I would like to steer away from db sessions, since we had a large problem 
when doing PCI compliance test with nCircle... They could literally bring 
our websites down due to opening million parallel connections, which should 
be fine... The error was on our side :) Memcache resolved that problem, but 
that was with php. Now, I would like to use the similar approach with 
web2py, and then we can test a pci scan :) 


On Saturday, December 22, 2012 10:02:28 AM UTC-5, Massimo Di Pierro wrote:
>
> Can you please look for the error in the apache logs?
>
> There is a limitation in the cookie size wich may break for large 
> sessions. 
>
> On Saturday, 22 December 2012 08:49:04 UTC-6, Adi wrote:
>>
>>
>>
>> I tried using session.connect(cookie_key='key', compression_level=9) 
>> instead of session.connect(request, response, db=db), and got the error 
>> as bellow, plus some inconsistent unexpected behavior. When I rolled back 
>> to db sessions all works fine as expected. It's an e-commerce app, 
>> usingsessions bit heavier. 
>>
>> Are there known limitations for using cookie sessions? Also, if I can 
>> use memcache with mysql, how do I define a client? Tried mc = 
>> memcache.Client(['127.0.0.1:11211'], debug=0), with no success...
>>
>> Thanks,
>> Adnan
>>
>>
>> web2py: Version 2.3.2 (2012-12-17 15:03:30) stable
>>
>> OK
>>
>>
>> The server encountered an internal error or misconfiguration and was 
>> unable to complete your request.
>>
>> Please contact the server administrator, root@localhost and inform them 
>> of the time the error occurred, and anything you might have done that may 
>> have caused the error.
>>
>> More information about this error may be available in the server error 
>> log.
>> Apache/2.2.3 (Red Hat) Server at w2p.demo.com Port 80
>>
>>
>>

-- 





[web2py] how to use session in cookie?

2012-12-22 Thread Adi


I tried using session.connect(cookie_key='key', compression_level=9) 
instead of session.connect(request, response, db=db), and got the error as 
bellow, plus some inconsistent unexpected behavior. When I rolled back to 
db sessions all works fine as expected. It's an e-commerce app, usingsessions 
bit heavier. 

Are there known limitations for using cookie sessions? Also, if I can use 
memcache with mysql, how do I define a client? Tried mc = 
memcache.Client(['127.0.0.1:11211'], debug=0), with no success...

Thanks,
Adnan


web2py: Version 2.3.2 (2012-12-17 15:03:30) stable

OK


The server encountered an internal error or misconfiguration and was unable 
to complete your request.

Please contact the server administrator, root@localhost and inform them of 
the time the error occurred, and anything you might have done that may have 
caused the error.

More information about this error may be available in the server error log.
Apache/2.2.3 (Red Hat) Server at w2p.demo.com Port 80


-- 





[web2py] probing into examples application

2012-12-22 Thread Adi
Just noticed from gogle webmaster tools that someone was probing into links 
bellow and got 500 server response for each. Is there anything that could 
potentially be dangerous from a security prospective, since "examples" get 
deployed with every installation of web2py? (I deleted it now in 
production, but didn't think of it as a threat before)

examples/global/vars
examples/global/vars/H1/__class__
examples/global/vars/XML/__class__
examples/global/vars/INPUT/__class__
examples/global/vars/IS_NOT_EMPTY/__class__
examples/global/vars/IS_IN_SET/__class__
examples/global/vars/IS_INT_IN_RANGE/__class__
examples/global/vars/DIV/__class__
examples/global/vars/HTML/__class__
examples/global/vars/A/__class__
examples/global/vars/SELECT/__class__
examples/simple_examples/raiseexception
examples/global/vars/BODY/__class__
examples/global/vars/IS_EMAIL/__class__
examples/global/vars/TEXTAREA/__class__
examples/global/vars/SQLTABLE/__class__
examples/global/vars/SQLFORM/__class__
examples/global/vars/IS_NOT_IN_DB/__class__
examples/global/vars/IS_IN_DB/__class__
examples/global/vars/FORM/__class__
examples/global/vars/Field/__class__
examples/global/vars/BEAUTIFY/__class__
examples/global/vars/HTTP/__class__
examples/global/vars/MARKMIN/__class__
examples/global/vars/TABLE/__class__
examples/simple_examples/rss_aggregator
examples/global/vars/TR/__class__

-- 





[web2py] Re: editable=lambda row: check(row), : make user's row editable, and the rest read only

2012-12-17 Thread Adi
Thanks Villas. 

That did it :) I thought I could do it directly through editable, so spent 
some time trying in different ways, but didn't realize that created_by 
(field i was filtering on) was readable=writable=False, hahaha... 

Thanks for a quick answer


On Monday, December 17, 2012 6:46:41 PM UTC-5, villas wrote:
>
> In this case I usually make editable=False and then make my own 'Edit' 
> link button for just those records the user is allowed to change.
>
>
> On Monday, December 17, 2012 8:09:47 PM UTC, Adi wrote:
>>
>> Is it possible to display all rows in grid, but make editable only a row 
>> that belongs to a particular user? Tried searching if someone else did it, 
>> but couldn't find any reference... 
>>
>> Tried following code, without success: 
>>
>> def check(row): return (row.created_by == 1) #auth.user_id
>>
>> def suppliers():
>>grid=SQLFORM.grid(q, ...
>> editable=lambda row: check(row),
>> # or, a second solution: 
>> # editable=lambda row: row.created_by==auth.user_id,
>>
>>
>> A filter will do it, but all other rows will not be displayed, which is 
>> not what I want:
>> db.supplier._common_filter = lambda query: 
>> (db.supplier.created_by <>  auth.user_id)
>>
>>
>> Thanks,
>> Adnan
>>
>>

-- 





[web2py] Re: webgrid and row_created

2012-12-17 Thread Adi

this is how i use onclick for confirmation purpose in a grid:

lambda row: A('Copy',
_class='btn',
_onclick='return confirm("Duplicate %s?")' % row.po_number, 
_href=URL('duplicate_po',args=[row.id])),







On Monday, December 17, 2012 2:46:59 PM UTC-5, Kenneth wrote:
>
> Hi,
>
> anybody have any ideas?
>
> tablerow.components.insert(2, TD(IMG(_src=URL('static', 
> 'delete-article.png'), _onclick="confirmation(rowdata.asset_id)", 
> _width=15)))
>
> Kenneth
>
>
> Den måndagen den 17:e december 2012 kl. 00:40:10 UTC+2 skrev Kenneth:
>>
>> Hello,
>>
>> I'm using webgrid in an application and I'm trying to insert an delete 
>> image into the table to shows all rows in an table. When clicking on the 
>> delete image I want an onclick event to trigger a Javascript that confirms 
>> and deletes that row. To do that I need the rownumber. 
>>
>> Looks like this:
>> def controller that uses webgrid():
>> grid.row_created = add_add_serial_link
>>
>> def add_add_serial_link(tablerow,rowtype,rowdata):
>> if rowtype == 'datarow':
>>
>> tablerow.components.insert(2, TD(IMG(_src=URL('static', 
>> 'delete-article.png'), _onclick="confirmation(rowdata.asset_id)", 
>> _width=15)))
>>
>> How do I write that _onclick so that the asset_id is sent to the 
>> confirmation Javascript? If I write 
>> _onclick='confirmation("rowdata.asset_id")' Javascript gets the text 
>> rowdata.asset_id and not the ID I'm tryin to send to it.
>>
>>
>> Kenneth
>>
>>
>>
>>

-- 





[web2py] editable=lambda row: check(row), : make user's row editable, and the rest read only

2012-12-17 Thread Adi
Is it possible to display all rows in grid, but make editable only a row 
that belongs to a particular user? Tried searching if someone else did it, 
but couldn't find any reference... 

Tried following code, without success: 

def check(row): return (row.created_by == 1) #auth.user_id

def suppliers():
   grid=SQLFORM.grid(q, ...
editable=lambda row: check(row),
# or, a second solution: 
# editable=lambda row: row.created_by==auth.user_id,


A filter will do it, but all other rows will not be displayed, which is not 
what I want:
db.supplier._common_filter = lambda query: 
(db.supplier.created_by <>  auth.user_id)


Thanks,
Adnan

-- 





[web2py] latest trunk: 2.3.0 (2012-12-13 12:53:52) rc - name tb is not defined

2012-12-13 Thread Adi

Just tried to use database administration on existing tables... 

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

Traceback (most recent call last):
  File "/Users/adnan/web2py209/gluon/restricted.py", line 212, in restricted
exec ccode in environment
  File 
"/Users/adnan/web2py209/applications/dev_thanemobile/views/appadmin.html" 
, 
line 141, in 
{{=T.M("**not available** (requires the Python [[guppy 
http://pypi.python.org/pypi/guppy/ popup]] library)")}}
NameError: name 'tb' is not defined




132.
133.
134.
135.
136.
137.
138.
139.
140.
141.

142.
143.
144.
145.
146.
147.
148.
149.
150.
151.

response.write('\n\n  \n  ', escape=False)
pass
response.write('\n  ', escape=False)
pass
response.write('\n\n\n', escape=False)
elif request.function=='select':
response.write('\n  ', escape=False)
response.write(XML(str(T("Database %s 
select"))%A(request.args[0],_href=URL('index'
response.write('\n  \n  ', escape=False)
if tb:

response.write('\n  ', escape=False)
response.write(T('Traceback'))
response.write('\n  \n', escape=False)
response.write(tb)
response.write('\n  \n  ', escape=False)
pass
response.write('\n  ', escape=False)
if table:
response.write('\n  ', escape=False)
response.write(A(str(T('New 
Record')),_href=URL('insert',args=[request.args[0],table]),_class="btn"))


-- 





[web2py] Re: Querying on 1:M Relationships in SQLFORM.grid and SQLFORM.smartgrid

2012-11-26 Thread Adi
+1 

this would be a great and needed feature... just stumbled into this 
problem, and working around it :)

On Friday, August 31, 2012 5:48:17 PM UTC-4, Massimo Di Pierro wrote:
>
> Hello Mike,
>
> thanks for your patch? Would you please attach it to a google code issue 
> so we do not forget. We cannot add new feaures until all 2.0.x issues have 
> been resolved.
>
> On Friday, August 31, 2012 2:41:30 PM UTC-5, Mike Leone wrote:
>>
>> Hello,
>>
>> We're building a web2py application that leverages SQLFORM.smartgrid 
>> heavily.  Out of the box, this does not support filtering on 1:M 
>> relationships, or reference fields on the model. We understand the concerns 
>> about this: It could potentially be a huge performance hit, especially if 
>> the related table has a large number of rows.
>>
>> On the other hand, this functionality is very valuable. Being able to 
>> filter on related tables is a very common need in applications.  Often, 
>> users need to filter on "lookup" tables that have a relatively small number 
>> of rows, and the performance hit is negligible. This is a very common 
>> feature in Django, and in Rails admin interfaces like ActiveScaffold and 
>> RailsAdmin.
>>
>> Example:
>>
>> Given a model like this:
>>
>> db.define_table('book',
>> Field('user_id', 'reference auth_user'),
>> Field('title'),
>> Field('genre'))
>>
>> And a controller like this:
>>
>> def index():
>> grid = SQLFORM.smartgrid(db.book)
>> return dict(grid=grid)
>>
>> The query interface will look like this by default:
>> http://i49.tinypic.com/2ugjt02.jpg
>>
>> Note how this includes title and genre, but not the auth_user reference.
>>
>> We patched web2py to allow to for 1:M reference fields in the query 
>> interface. The resulting interface and generated query look something like 
>> this:
>>
>> http://i46.tinypic.com/28taq74.png
>>
>> Here is our simple patch to allow searching on reference fields like this:
>>
>> https://gist.github.com/ff543a5c6d3bc14b9079
>>
>> This is obviously NOT ready for production; it's a simple proof of 
>> concept.  Note the potentially very expensive "ALL" query. Because of the 
>> performance risks, something like this only makes sense if developers can 
>> opt in, i.e. explicitly say so if they want to include a given reference 
>> field in the query interface.
>>
>> 1. Would the web2py maintiners be interested in a feature like this if it 
>> is opt-in?  I'm willing to devote some time to submit a more robust patch 
>> if I could get some guidance.
>>
>> 2. I also have a simple implementation for querying on list:reference 
>> fields that I can share as well.
>>
>> Finally, I just want to thank the web2py team. I've really enjoyed using 
>> the framework and hope to help out as much as I can.
>>
>> Thanks,
>> Mike Leone
>> Principal, Engineering
>> Panoptic Development, Inc.
>>
>

-- 





[web2py] Re: we should support this in DAL

2012-11-17 Thread Adi
Definitely would be nice to support NoSQL. 

I tried the existing DAL with MongoDB and grid worked fine to the point of 
view/edit record. Due to different concepts (sql/nosql) if it's hard to 
keep them in a same DAL, maybe there could be a separate layer for NoSQL. 

I would be glad to test lots in this area, since I'm trying to port 4-5M 
records into MongoDB, and currently I use web2py with pymongo for that.


On Saturday, November 17, 2012 7:19:15 AM UTC-5, Massimo Di Pierro wrote:
>
> http://labs.codernity.com/codernitydb/index.html
>

-- 





[web2py] Re: Session files not always created

2012-11-16 Thread Adi
correction... rearranged the code a bit, and all works as expected on my 
side... 

On Friday, November 16, 2012 8:43:24 PM UTC-5, Adi wrote:
>
> tested the same code in Version 2.2.1 (2012-10-21 16:57:04) stable, and 
> session works as expected, but not in trunk. 
>
> simplified version of what i'm doing:
> def a():
>products=db(db.products>1).select()
>session.category_products_keys = products.as_dict().keys()
>print session.category_products_keys # all results displayed properly
>
> def b():
>print session.category_products_keys # no results
>
> a()
> b()
>
>
>
>
>
>
>
>
>
>
> On Friday, November 16, 2012 5:50:02 PM UTC-5, villas wrote:
>>
>> Using latest trunk with Apache/Linux.
>>
>> I'm having log in problems,  especially with IE 9.
>>
>> I've noticed that in the browser I get the cookie set:
>>
>>  NAME session_id_myapp VALUE 
>> 75.141.38.104-8a5232dc-03d5-4312-bc65-2157590a973b DOMAIN mydomain.com PATH 
>> / EXPIRES At the end of the Session
>> So that's good.  However,  it doesn't always create session file 
>> 75.141.38.104-8a5232dc-03d5-4312-bc65-2157590a973b
>>
>> If I cannot find a session file with that name,  it seems that I cannot 
>> log in.  
>>
>> When I restart the browser,  sometimes the session file and cookie are 
>> created OK.  Then I can log in too.  With Firefox it is more reliable, but 
>> again, it doesn't always work.
>>
>> Why is the session file not always created?  Does anyone know what the 
>> problem is?
>>
>> Is it related to this change?
>>
>> http://code.google.com/p/web2py/source/detail?r=80a653289fb58322521d7c4b8f1082098a8f2618
>>
>> Regards,
>> David
>>
>

-- 





[web2py] Re: Session files not always created

2012-11-16 Thread Adi
tested the same code in Version 2.2.1 (2012-10-21 16:57:04) stable, and 
session works as expected, but not in trunk. 

simplified version of what i'm doing:
def a():
   products=db(db.products>1).select()
   session.category_products_keys = products.as_dict().keys()
   print session.category_products_keys # all results displayed properly

def b():
   print session.category_products_keys # no results

a()
b()










On Friday, November 16, 2012 5:50:02 PM UTC-5, villas wrote:
>
> Using latest trunk with Apache/Linux.
>
> I'm having log in problems,  especially with IE 9.
>
> I've noticed that in the browser I get the cookie set:
>
>  NAME session_id_myapp VALUE 
> 75.141.38.104-8a5232dc-03d5-4312-bc65-2157590a973b DOMAIN mydomain.com PATH 
> / EXPIRES At the end of the Session
> So that's good.  However,  it doesn't always create session file 
> 75.141.38.104-8a5232dc-03d5-4312-bc65-2157590a973b
>
> If I cannot find a session file with that name,  it seems that I cannot 
> log in.  
>
> When I restart the browser,  sometimes the session file and cookie are 
> created OK.  Then I can log in too.  With Firefox it is more reliable, but 
> again, it doesn't always work.
>
> Why is the session file not always created?  Does anyone know what the 
> problem is?
>
> Is it related to this change?
>
> http://code.google.com/p/web2py/source/detail?r=80a653289fb58322521d7c4b8f1082098a8f2618
>
> Regards,
> David
>

-- 





[web2py] Re: Session files not always created

2012-11-16 Thread Adi
hmm... i got the latest trunk, and also started having a problem with 
session... but still investigating.  

On Friday, November 16, 2012 5:50:02 PM UTC-5, villas wrote:
>
> Using latest trunk with Apache/Linux.
>
> I'm having log in problems,  especially with IE 9.
>
> I've noticed that in the browser I get the cookie set:
>
>  NAME session_id_myapp VALUE 
> 75.141.38.104-8a5232dc-03d5-4312-bc65-2157590a973b DOMAIN mydomain.com PATH 
> / EXPIRES At the end of the Session
> So that's good.  However,  it doesn't always create session file 
> 75.141.38.104-8a5232dc-03d5-4312-bc65-2157590a973b
>
> If I cannot find a session file with that name,  it seems that I cannot 
> log in.  
>
> When I restart the browser,  sometimes the session file and cookie are 
> created OK.  Then I can log in too.  With Firefox it is more reliable, but 
> again, it doesn't always work.
>
> Why is the session file not always created?  Does anyone know what the 
> problem is?
>
> Is it related to this change?
>
> http://code.google.com/p/web2py/source/detail?r=80a653289fb58322521d7c4b8f1082098a8f2618
>
> Regards,
> David
>

-- 





[web2py] Re: scheduler and mongodb

2012-10-29 Thread Adi
Niphlod... you have full right to punch me :)

the problem was that the scheduler from other server was working all this 
time, and mongo changes i introduced actually never kicked in (I counted on 
scheduler running from this server)... Now, I'll hide for some time, while 
re-arranging the "task calls a task" code, and so on :) Still have to say: 
scheduler is great! 

Sorry for false alarm... 
 
On Monday, October 29, 2012 10:29:33 AM UTC-4, Niphlod wrote:
>
> is there a commit in the functions? Functions executed in the scheduler 
> environment are like the ones you use in the web2py shell: you have to 
> manually commit them to save your results.
>
> On Monday, October 29, 2012 2:59:22 PM UTC+1, Adi wrote:
>>
>> This simple insert into mongodb works fine when called from within same 
>> application, but not when called from a scheduler on nginx, uwsgi, pymongo. 
>> Scheduler reports task as COMPLETED and all other inserts into mysql from 
>> the same function work well. 
>>
>> What's more interesting, same scheduler function works when I start a 
>> scheduler locally on my mac. 
>>
>> Any hints what could I be doing wrong, please? Thanks.
>>
>> web2py - Version 2.2.1 (2012-10-21 16:57:04) stable
>>
>>
>> from pymongo import Connection
>> cn = Connection('localhost', 27017)
>> db_m = cn.db
>>
>> def testmongo():
>> usc = db_m.testcustomer
>> res = usc.insert({'name':'Test', 'dtt':request.now})
>> #... <--- other inserts (into mysql) work fine when called from 
>> scheduler
>>
>> return
>>
>>
>>  
>
>

-- 





[web2py] scheduler and mongodb

2012-10-29 Thread Adi
This simple insert into mongodb works fine when called from within same 
application, but not when called from a scheduler on nginx, uwsgi, pymongo. 
Scheduler reports task as COMPLETED and all other inserts into mysql from 
the same function work well. 

What's more interesting, same scheduler function works when I start a 
scheduler locally on my mac. 

Any hints what could I be doing wrong, please? Thanks.

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


from pymongo import Connection
cn = Connection('localhost', 27017)
db_m = cn.db

def testmongo():
usc = db_m.testcustomer
res = usc.insert({'name':'Test', 'dtt':request.now})
#... <--- other inserts (into mysql) work fine when called from 
scheduler

return


 

-- 





[web2py] Re: mongodb 2 errors: BSON can only handle up to 8-byte ints, second argument must be of type ObjectI

2012-10-23 Thread Adi
my fault Niphlod clarified that can't use mongodb for Auth 
functionality, so I left that part with mysql, otherwise created table 
(colletion), inserted records and displayed smartgrid. All worked fine, 
except viewing record details from smartgrid. 

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

Traceback (most recent call last):
  File "/Users/adnan/web2py209/gluon/restricted.py", line 212, in restricted
exec ccode in environment
  File "/Users/adnan/web2py209/applications/mango/controllers/test.py" 
<http://127.0.0.1:8000/admin/default/edit/mango/controllers/test.py>, line 13, 
in 
  File "/Users/adnan/web2py209/gluon/globals.py", line 188, in 
self._caller = lambda f: f()
  File "/Users/adnan/web2py209/applications/mango/controllers/test.py" 
<http://127.0.0.1:8000/admin/default/edit/mango/controllers/test.py>, line 9, 
in test
grid=SQLFORM.smartgrid(db_m.post)
  File "/Users/adnan/web2py209/gluon/sqlhtml.py", line 2376, in smartgrid
user_signature=user_signature, **kwargs)
  File "/Users/adnan/web2py209/gluon/sqlhtml.py", line 1853, in grid
record = table(request.args[-1]) or redirect(URL('error'))
  File "/Users/adnan/web2py209/gluon/dal.py", line 7650, in __call__
limitby=(0,1),for_update=for_update).first()
  File "/Users/adnan/web2py209/gluon/dal.py", line 8788, in select
return adapter.select(self.query,fields,attributes)
  File "/Users/adnan/web2py209/gluon/dal.py", line 5077, in select
self._select(query,fields,attributes)
  File "/Users/adnan/web2py209/gluon/dal.py", line 5061, in _select
mongoqry_dict = self.expand(query)
  File "/Users/adnan/web2py209/gluon/dal.py", line 4985, in expand
raise SyntaxError, 'second argument must be of type ObjectId or an objectid 
representable integer'
SyntaxError: second argument must be of type ObjectId or an objectid 
representable integer






On Tuesday, October 23, 2012 8:47:14 AM UTC-4, Adi wrote:
>
> Installed mongodb, pymongo driver from source on mac osx 10.7.5, and 
> created a fresh application. Tried to create a new user from admin panel, 
> and got first error bellow. Record got inserted though. After I used option 
> "Lost password" from the menu, got second error underneath. 
>
>  BSON can only handle up to 8-byte ints
>
> Traceback (most recent call last):
>   File "/Users/adnan/web2py209/gluon/restricted.py", line 212, in restricted
> exec ccode in environment
>   File "/Users/adnan/web2py209/applications/mango/controllers/default.py" 
> <http://127.0.0.1:8000/admin/default/edit/mango/controllers/default.py>, line 
> 77, in 
>   File "/Users/adnan/web2py209/gluon/globals.py", line 188, in 
> self._caller = lambda f: f()
>   File "/Users/adnan/web2py209/applications/mango/controllers/default.py" 
> <http://127.0.0.1:8000/admin/default/edit/mango/controllers/default.py>, line 
> 39, in user
> return dict(form=auth())
>   File "/Users/adnan/web2py209/gluon/tools.py", line 1235, in __call__
> return getattr(self, args[0])()
>   File "/Users/adnan/web2py209/gluon/tools.py", line 2241, in register
> self.add_membership(group_id, form.vars.id)
>   File "/Users/adnan/web2py209/gluon/tools.py", line 3035, in add_membership
> record = membership(user_id=user_id, group_id=group_id)
>   File "/Users/adnan/web2py209/gluon/dal.py", line 7657, in __call__
> return self._db(query).select(limitby=(0,1),for_update=for_update).first()
>   File "/Users/adnan/web2py209/gluon/dal.py", line 8788, in select
> return adapter.select(self.query,fields,attributes)
>   File "/Users/adnan/web2py209/gluon/dal.py", line 5093, in select
> for k,record in enumerate(mongo_list_dicts):
>   File "build/bdist.macosx-10.7-intel/egg/pymongo/cursor.py", line 799, in 
> next
> if len(self.__data) or self._refresh():
>   File "build/bdist.macosx-10.7-intel/egg/pymongo/cursor.py", line 750, in 
> _refresh
> self.__uuid_subtype))
>   File "build/bdist.macosx-10.7-intel/egg/pymongo/message.py", line 134, in 
> query
> encoded = bson.BSON.encode(query, False, uuid_subtype)
>   File "build/bdist.macosx-10.7-intel/egg/bson/__init__.py", line 566, in 
> encode
> return cls(_dict_to_bson(document, check_keys, uuid_subtype))
>   File "build/bdist.macosx-10.7-intel/egg/bson/__init__.py", line 475, in 
> _dict_to_bson
> elements.append(_element_to_bson(key, value, check_keys, uuid_subtype))
>   File "build/bdist.macosx-10.7-intel/egg/bson/__init__.py", line 426, in 
> _element

[web2py] Re: update_or_insert doesn't always return the corresponding row id

2012-10-23 Thread Adi
that's how i do it now... just thought I could save that trip in case 
update ids were known :) thanks for responding Niphlod.


On Tuesday, October 23, 2012 4:25:38 AM UTC-4, Niphlod wrote:
>
> that would require another query (no thanks!). No database on an update 
> gives you back the ids of the records you updated, just the number of rows.
>
> Suppose you did db.update_or_insert(condition, values)
>
> If you are in the need just db(condition).select(table.id) after that.
>
> On Tuesday, October 23, 2012 3:15:44 AM UTC+2, Adi wrote:
>>
>> Stumbled upon the same thing.
>>
>> Understood that possibly results could  have more ids when key is 
>> different from primary key, e.g (name=='john'), but would it be possible to 
>> return an additional parameter with update id(s), if they are known? 
>>
>> return newid, updateids
>>
>>
>> On Friday, December 30, 2011 12:31:37 PM UTC-5, olivier wrote:
>>>
>>> The "insert" method returns the id of the inserted row. 
>>> The "update_or_insert" method returns the id of the inserted row, but 
>>> returns None in case of an update... 
>>>
>>> Why is it so? 
>>>
>>> I have a case in which I want to update_or_insert and then further 
>>> update the corresponding row (to track the status of a long running 
>>> process). 
>>> I would rather have the method to always output the id of the updated/ 
>>> inserted row... 
>>> Or is there any use-case you would like to discriminate between the 
>>> fact you inserted or update a row? 
>>>
>>> What do you think? 
>>>
>>>   -Olivier 
>>>
>>>
>>> From dal.py (I added the proposed modification) 
>>> === 
>>>
>>> def update_or_insert(self, key=DEFAULT, **values): 
>>>   if key==DEFAULT: 
>>> record = self(**values) 
>>>   else: 
>>> record = self(key) 
>>>if record: 
>>> record.update_record(**values) 
>>> newid = None  #--> why not record['id']  
>>>else: 
>>>  newid = self.insert(**values) 
>>>return newid
>>
>>

-- 





[web2py] mongodb 2 errors: BSON can only handle up to 8-byte ints, second argument must be of type ObjectI

2012-10-23 Thread Adi
Installed mongodb, pymongo driver from source on mac osx 10.7.5, and 
created a fresh application. Tried to create a new user from admin panel, 
and got first error bellow. Record got inserted though. After I used option 
"Lost password" from the menu, got second error underneath. 

 BSON can only handle up to 8-byte ints

Traceback (most recent call last):
  File "/Users/adnan/web2py209/gluon/restricted.py", line 212, in restricted
exec ccode in environment
  File "/Users/adnan/web2py209/applications/mango/controllers/default.py" 
, line 
77, in 
  File "/Users/adnan/web2py209/gluon/globals.py", line 188, in 
self._caller = lambda f: f()
  File "/Users/adnan/web2py209/applications/mango/controllers/default.py" 
, line 
39, in user
return dict(form=auth())
  File "/Users/adnan/web2py209/gluon/tools.py", line 1235, in __call__
return getattr(self, args[0])()
  File "/Users/adnan/web2py209/gluon/tools.py", line 2241, in register
self.add_membership(group_id, form.vars.id)
  File "/Users/adnan/web2py209/gluon/tools.py", line 3035, in add_membership
record = membership(user_id=user_id, group_id=group_id)
  File "/Users/adnan/web2py209/gluon/dal.py", line 7657, in __call__
return self._db(query).select(limitby=(0,1),for_update=for_update).first()
  File "/Users/adnan/web2py209/gluon/dal.py", line 8788, in select
return adapter.select(self.query,fields,attributes)
  File "/Users/adnan/web2py209/gluon/dal.py", line 5093, in select
for k,record in enumerate(mongo_list_dicts):
  File "build/bdist.macosx-10.7-intel/egg/pymongo/cursor.py", line 799, in next
if len(self.__data) or self._refresh():
  File "build/bdist.macosx-10.7-intel/egg/pymongo/cursor.py", line 750, in 
_refresh
self.__uuid_subtype))
  File "build/bdist.macosx-10.7-intel/egg/pymongo/message.py", line 134, in 
query
encoded = bson.BSON.encode(query, False, uuid_subtype)
  File "build/bdist.macosx-10.7-intel/egg/bson/__init__.py", line 566, in encode
return cls(_dict_to_bson(document, check_keys, uuid_subtype))
  File "build/bdist.macosx-10.7-intel/egg/bson/__init__.py", line 475, in 
_dict_to_bson
elements.append(_element_to_bson(key, value, check_keys, uuid_subtype))
  File "build/bdist.macosx-10.7-intel/egg/bson/__init__.py", line 426, in 
_element_to_bson
raise OverflowError("BSON can only handle up to 8-byte ints")
OverflowError: BSON can only handle up to 8-byte ints


Frames 
   
   -  
   
   *File /Users/adnan/web2py209/gluon/restricted.py in restricted at line 
   212* code arguments variables 
-  
   
   *File /Users/adnan/web2py209/applications/mango/controllers/default.py 
   in  at line 77* code arguments variables 
-  
   
   *File /Users/adnan/web2py209/gluon/globals.py in  at line 188* 
   code arguments variables 
-  
   
   *File /Users/adnan/web2py209/applications/mango/controllers/default.py 
   in user at line 39* code arguments variables 
-  
   
   *File /Users/adnan/web2py209/gluon/tools.py in __call__ at line 1235* 
   code arguments variables 
-  
   
   *File /Users/adnan/web2py209/gluon/tools.py in register at line 2241* 
   code arguments variables 
-  
   
   *File /Users/adnan/web2py209/gluon/tools.py in add_membership at line 
   3035* code arguments variables 
-  
   
   *File /Users/adnan/web2py209/gluon/dal.py in __call__ at line 7657* code 
   arguments variables 
-  
   
   *File /Users/adnan/web2py209/gluon/dal.py in select at line 8788* code 
   arguments variables 
-  
   
   *File /Users/adnan/web2py209/gluon/dal.py in select at line 5093* code 
   arguments variables 
-  
   
   *File 
   /Users/adnan/web2py209/build/bdist.macosx-10.7-intel/egg/pymongo/cursor.py 
   in next at line 799* code arguments variables 
-  
   
   *File 
   /Users/adnan/web2py209/build/bdist.macosx-10.7-intel/egg/pymongo/cursor.py 
   in _refresh at line 750* code arguments variables 
-  
   
   *File 
   /Users/adnan/web2py209/build/bdist.macosx-10.7-intel/egg/pymongo/message.py 
   in query at line 134* code arguments variables 
-  
   
   *File 
   /Users/adnan/web2py209/build/bdist.macosx-10.7-intel/egg/bson/__init__.py 
   in encode at line 566* code arguments variables 
-  
   
   *File 
   /Users/adnan/web2py209/build/bdist.macosx-10.7-intel/egg/bson/__init__.py 
   in _dict_to_bson at line 475* code arguments variables 
-  
   
   *File 
   /Users/adnan/web2py209/build/bdist.macosx-10.7-intel/egg/bson/__init__.py 
   in _element_to_bson at line 426* code arguments variables 
Function argument list 
   
   (key='group_id', value=24921443489256489473621663847L, check_keys=False, 
   uuid_subtype=3)
Code listing 
   
   421.
   422.
   423.
   424.
   425.
   426.
   
   427.
   428.
   429.
   430.
   
   return BSONINT + name + struct.pack(" MAX_INT64 or

[web2py] Re: update_or_insert doesn't always return the corresponding row id

2012-10-22 Thread Adi
Stumbled upon the same thing.

Understood that possibly results could  have more ids when key is different 
from primary key, e.g (name=='john'), but would it be possible to return an 
additional parameter with update id(s), if they are known? 

return newid, updateids


On Friday, December 30, 2011 12:31:37 PM UTC-5, olivier wrote:
>
> The "insert" method returns the id of the inserted row. 
> The "update_or_insert" method returns the id of the inserted row, but 
> returns None in case of an update... 
>
> Why is it so? 
>
> I have a case in which I want to update_or_insert and then further 
> update the corresponding row (to track the status of a long running 
> process). 
> I would rather have the method to always output the id of the updated/ 
> inserted row... 
> Or is there any use-case you would like to discriminate between the 
> fact you inserted or update a row? 
>
> What do you think? 
>
>   -Olivier 
>
>
> From dal.py (I added the proposed modification) 
> === 
>
> def update_or_insert(self, key=DEFAULT, **values): 
>   if key==DEFAULT: 
> record = self(**values) 
>   else: 
> record = self(key) 
>if record: 
> record.update_record(**values) 
> newid = None  #--> why not record['id']  
>else: 
>  newid = self.insert(**values) 
>return newid

-- 





[web2py] Re: web2py love

2012-10-20 Thread Adi
Totally agreed... i stopped developing years ago, but web2py brought me 
back and gave confidence, and courage to do this kind of large scale rapid 
development just by myself... 

Thank you Massimo and all other true experts on your generous contribution 
and help... 

What makes this fantastic development platform so strong is that it stays 
secured, by standards, self-sufficient, lean, while adopting new features, 
and latest trends practically on a daily basis :) Impressive!!!


On Saturday, October 20, 2012 7:23:12 AM UTC-4, rif wrote:
>
> Constrained by some performance requirements I am developing a web app 
> using Go , Gorilla , The 
> Goods  and MongoDB .
>
> While I enjoy the beauty of go and the lightweight feeling of minimal 
> libraries I stop from time to time to re-appreciate web2py for all the help 
> it provides.
>
> All the little things like: painless crud, csrf, auth, form validation, 
> many little/unknown checks that we have come to take for granted came from 
> hours of work done by someone else for us.
>
> Thank you Massimo and web2py team and receive all our love!
>

-- 





Re: [web2py] how to loop through tables with > 1M records?

2012-10-19 Thread Adi
Thank you Vasile for your quick response. This will be perfect. 

On Friday, October 19, 2012 2:02:41 PM UTC-4, Vasile Ermicioi wrote:
>
> _last_id = 0
> _items_per_page=1000
> for row in db(db.table.id>_last_id).select(limitby=(0,_items_per_page), 
> orderby=db.table.id):
> #do something
> _last_id = row.id
>
>

-- 





[web2py] how to loop through tables with > 1M records?

2012-10-19 Thread Adi

I just tried to perform a select() on a mysql table with 700k records. All 
available memory on my mac was consumed to the point that I had to kill the 
process. 

I reduced number of fields just to id, and got the results after some time, 
but wondering if there is some better approach in order to loop through all 
records with all needed fields?

Thanks,
Adi

-- 





[web2py] is commit necessary for update_or_insert() in scheduler

2012-10-19 Thread Adi
Just noticed that records won't get updated when I call update_or_insert 
from scheduler, unless I include commit. Should it be like that? 


tbl_a.update_or_insert(...)

tbl_b.update_or_insert(...)

db.commit()



-- 





Re: [web2py] easy way to validate a list of emails?

2012-10-17 Thread Adi
Thank you Bruno for this! Exactly what I was looking for. 

Maybe it would be a good idea to add it as a "multiple" parameter to 
standard IS_EMAIL(multiple=True, ...)

In any case, thanks :)

On Wednesday, July 6, 2011 4:39:39 AM UTC-4, rochacbruno wrote:
>
> forget the latest, I wrote directly here in email and there were errors. 
>
> This is the tested code:
>
> ### put in models ###
>
> class IS_EMAIL_LIST(object):
> def __init__(self, error_message="Email %s is invalid", sep=","):
> self.error_message = error_message
> self.sep = sep
> 
> def __call__(self, value):
> emails = 
> value.strip().replace('\n','').replace('\t','').split(self.sep)
> for email in emails:
> email = email.strip()
> if IS_EMAIL()(email)[1] != None:
> return (email, self.error_message % email)
> return (emails, None) 
>
> db.define_table('emails',
> Field('list','text', requires=IS_EMAIL_LIST())
> )
>
> ###
>

-- 





[web2py] Re: restful api post works great localy, but getting login redirect on a remote server

2012-10-16 Thread Adi

If this is of any help, I tried tracing basic login in tools.py, and 
figured out variable "basic" never gets value from 
current.request.env.http_authorization, so username and password never get 
passed through.

On the local server, that value gets populated and basic login works as 
expected... If anyone can share any advice where else to look for a 
problem, please do. Sorry for going crazy here :)

tools.py

def basic(self):
"""
perform basic login.
reads current.request.env.http_authorization
and returns basic_allowed,basic_accepted,user 
"""
if not self.settings.allow_basic_login:
return (False,False,False)
basic = current.request.env.http_authorization
if not basic or not basic[:6].lower() == 'basic ':
return (True, False, False)
(username, password) = base64.b64decode(basic[6:]).split(':')
return (True, True, self.login_bare(username, password))



On Wednesday, October 10, 2012 10:46:54 AM UTC-4, Adi wrote:
>
> This is an example from book, where authentication and posting into 
> database work good on a local server. 
>
> Once I moved the code to production redhat linux server, where we have 
> routes.py as bellow all I get as result is a login redirect:
> You are being redirected  "/user/login?_next=/webservices/api/customer.json%3FFirstName%3DTim5%26LastName%3DJson"
> >here
>
> If I remove authentication (@auth.requires_login() and 
> @auth.requires_permission('insert customer through webservice')) on 
> production server, records are inserted properly. 
>
> Tried adding default and webservices controllers into application specific 
> routes.py, but it didn't help.
>
> Any suggestions what should I do? 
>
> Thanks,
> Adnan
>
> tried in both, default.py and webservices.py controllers:
>
> auth.settings.allow_basic_login = True
> @auth.requires_login()
> @auth.requires_permission('insert customer through webservice')
> @request.restful()
> def api():
> response.view = 'generic.'+request.extension
> 
> def GET(*args,**vars):
> patterns = [
> "/members[customer]",
> "/member_fn/{customer.FirstName.startswith}",
> "/member_ln/{customer.LastName.startswith}",
> "/member/{customer.FirstName}/:field",
> 
> "/member/{customer.FirstName}/orders[customer_order.customer_id]",
> 
> "/member/{customer.FirstName}/order[customer_order.customer_id]/{
> customer_order.id}",
> 
> "/member/{customer.FirstName}/order[customer_order.customer_id]/{
> customer_order.id}/: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):
> if table_name == 'customer':
> return db.customer.validate_and_insert(**vars)
> elif table_name == 'customer_order':
> return db.customer_order.validate_and_insert(**vars)
> else:
> raise HTTP(400)
> return locals()
>
>
>
>
>
> web2py folder: routes.py
> routers = dict(
> # base router
> BASE = dict(
> default_application = 'welcome', domains = {'crm.domain.com': 
> 'crm' }
> ),
> )
>
>
>
> crm app folder: routes.py (deleted)
>
>
> Terminal test:
>
>
> asm21:~ adnan$ curl --user webserv...@domain.com:pass -d 
> "FirstName=Tim5&LastName=Json" http://crm.domain.com/api/customer.json
> Result: You are being redirected  "/user/login?_next=/api/customer.json%3FFirstName%3DTim5%26LastName%3DJson"
> >here
>
> asm21:~ adnan$ curl --user webserv...@domain.com:pass -d 
> "FirstName=Tim5&LastName=Json" http://crm.domain.com/webservices/api/
> customer.json
> Result: You are being redirected  "/user/login?_next=/webservices/api/customer.json%3FFirstName%3DTim5%26LastName%3DJson"
> >here
>
>
>
>
>

-- 





Re: [web2py] restful api post works great localy, but getting login redirect on a remote server

2012-10-16 Thread Adi

Could I please ask someone with Apache/mod_wsgi to test this code? 
Everything works fine on a local rocket webserver, and also on nginx, but 
for some reason when it runs on Apache returns "Not authorized". I just 
can't figure out where exactly is the problem. Same Apache server runs 
several web2py applications perfectly fine.

db=DAL()
from gluon.tools import Auth
auth = Auth(db).define_tables(username=True)
if db(db.auth_user).isempty():
auth.get_or_create_user(dict(
username='mdp',
email='a...@b.com',
password=db.auth_user.password.validate('test')[0]))
response.generic_patterns = ['*']
auth.settings.allow_basic_login = True

@request.restful()
@auth.requires_login()
def demo():
def GET():
return dict(hello='world')
return locals()

Call:
curl --user mdp:test " http://127.0.0.1:8000/test3/default/demo.json

Does this work for you?

Thanks,
Adnan


On Thursday, October 11, 2012 6:00:30 PM UTC-4, Adi wrote:
>
> Thanks Massimo for looking into this. 
>
> ticket opened:
>
> http://code.google.com/p/web2py/issues/detail?id=1080&thanks=1080&ts=1349992678
>
>
> On Thu, Oct 11, 2012 at 5:05 PM, Massimo Di Pierro  wrote:
>
>> Please open a ticket about this and I will look in detail asap.
>>
>>
>> On Thursday, 11 October 2012 09:44:04 UTC-5, Adi wrote:
>>
>>> Tried 2.09 nightly build on a completely different (redhat) server and 
>>> still getting redirect, while post works as expected on a local rocket. 
>>>
>>> Any hint where to look for a problem please? 
>>>
>>> using:
>>> curl --user webserv...@domain.com:pass -d "FirstName=Tim5&LastName=Json"http
>>> ://crm.domain.com/api/**customer.json<http://crm.domain.com/api/customer.json>
>>>
>>> You are being redirected >>> webservices/api/customer.json%**3FFirstName%3DTim5%26LastName%**3DJson"
>>>> >here
>>>>
>>>> If I remove authentication (@auth.requires_login() and 
>>>> @auth.requires_permission('**insert customer through webservice')) on 
>>>> production server, records are inserted properly. 
>>>>
>>>> Tried adding default and webservices controllers into application 
>>>> specific routes.py, but it didn't help.
>>>>
>>>> Any suggestions what should I do? 
>>>>
>>>> Thanks,
>>>> Adnan
>>>>
>>>> tried in both, default.py and webservices.py controllers:
>>>>
>>>> auth.settings.allow_basic_**login = True
>>>> @auth.requires_login()
>>>> @auth.requires_permission('**insert customer through webservice')
>>>> @request.restful()
>>>> def api():
>>>> response.view = 'generic.'+request.extension
>>>> 
>>>> def GET(*args,**vars):
>>>> patterns = [
>>>> "/members[customer]",
>>>> "/member_fn/{customer.**FirstName.startswith}",
>>>> "/member_ln/{customer.**LastName.startswith}",
>>>> "/member/{customer.FirstName}/**:field",
>>>> "/member/{customer.FirstName}/**orders[customer_order.**
>>>> customer_id]",
>>>> "/member/{customer.FirstName}/**
>>>> order[customer_order.customer_**id]/{customer_order.id}",
>>>> "/member/{customer.FirstName}/**
>>>> order[customer_order.customer_**id]/{customer_order.id}/:**field"
>>>> ]
>>>> parser = db.parse_as_rest(patterns,args**,vars)
>>>> if parser.status == 200:
>>>> return dict(content=parser.response)
>>>> else:
>>>> raise HTTP(parser.status,parser.erro**r)
>>>> def POST(table_name,**vars):
>>>> if table_name == 'customer':
>>>> return db.customer.validate_and_**insert(**vars)
>>>> elif table_name == 'customer_order':
>>>> return db.customer_order.validate_**and_insert(**vars)
>>>> else:
>>>> raise HTTP(400)
>>>> return locals()
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> web2py folder: routes.py
>>>> routers = dict(
>>>> # base router
>>>> BASE = dict(
>>>> default_application = 'welcome', domains = {'crm.domain.com': 
>>>> 'crm' }
>>>> ),
>>>> )
>>>>
>>>>
>>>>
>>>> crm app folder: routes.py (deleted)
>>>>
>>>>
>>>> Terminal test:
>>>>
>>>>
>>>> asm21:~ adnan$ curl --user webserv...@domain.com:pass -d 
>>>> "FirstName=Tim5&LastName=Json" http://crm.domain.com/api/**
>>>> customer.json <http://crm.domain.com/api/customer.json>
>>>> Result: You are being redirected here**
>>>>
>>>> asm21:~ adnan$ curl --user webserv...@domain.com:pass -d 
>>>> "FirstName=Tim5&LastName=Json" http://crm.domain.com/webservi**ces/api/
>>>> customer.json
>>>> Result: You are being redirected >>> >here
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>   -- 
>>  
>>  
>>  
>>
>
>
>

-- 





[web2py] Re: scheduler: imported unicodedata module in model not visible in a view

2012-10-11 Thread Adi
this is the one that comes from python: 
http://docs.python.org/library/unicodedata.html 

(using it to clean out trademark and other symbols in order to send text as 
email)


On Thursday, October 11, 2012 12:18:19 PM UTC-4, Massimo Di Pierro wrote:
>
> Where is unicodedata.py located?
>
> On Thursday, 11 October 2012 10:56:50 UTC-5, Adi wrote:
>>
>>
>> unicodedata module is accessible in a view when i test code directly from 
>> an application, but get the error when run the same code from scheduler. I 
>> can move the code up to a model (db_scheduler), but just wanted to know if 
>> imports from models should be visible to Views when run through scheduler? 
>>
>> Thanks,
>> Adnan
>>
>>
>> db_scheduler.py
>> import unicodedata
>>
>> def send_order_confirmation_email():
>> ...
>>  context=dict(order=order)
>>  message=response.render(msg_file, context)
>>   ...send email
>> return
>>
>> Views:
>> msg_file.html
>> {{=XML('%s %s' % \
>> 
>> (row.orderItem.Qty,unicodedata
>> .normalize('NFKD', \
>> unicode(row.
>> orderItemDetail.ProductDesc, 'utf8')).encode('ascii','ignore')))
>> }}
>>
>>
>>
>> Traceback (most recent call last):
>>   File "/opt/web-apps/web2py/gluon/scheduler.py", line 218, in executor
>> result = dumps(_function(*args,**vars))
>>   File "applications/crm/models/db_scheduler.py", line 179, in 
>> send_order_confirmation_email
>> message=response.render(msg_file, context)
>>   File "/opt/web-apps/web2py/gluon/globals.py", line 217, in render
>> run_view_in(self._view_environment)
>>   File "/opt/web-apps/web2py/gluon/compileapp.py", line 654, in 
>> run_view_in
>> context=environment)
>>   File "/opt/web-apps/web2py/gluon/restricted.py", line 222, in restricted
>> raise RestrictedError(layer, code, output, environment)
>> RestrictedError:  name 'unicodedata' is not 
>> defined
>>
>>
>>

-- 





[web2py] scheduler: imported unicodedata module in model not visible in a view

2012-10-11 Thread Adi

unicodedata module is accessible in a view when i test code directly from 
an application, but get the error when run the same code from scheduler. I 
can move the code up to a model (db_scheduler), but just wanted to know if 
imports from models should be visible to Views when run through scheduler? 

Thanks,
Adnan


db_scheduler.py
import unicodedata

def send_order_confirmation_email():
...
 context=dict(order=order)
 message=response.render(msg_file, context)
  ...send email
return

Views:
msg_file.html
{{=XML('%s %s' % \
(row.orderItem.Qty,unicodedata
.normalize('NFKD', \
unicode(row.orderItemDetail.
ProductDesc, 'utf8')).encode('ascii','ignore')))
}}



Traceback (most recent call last):
  File "/opt/web-apps/web2py/gluon/scheduler.py", line 218, in executor
result = dumps(_function(*args,**vars))
  File "applications/crm/models/db_scheduler.py", line 179, in 
send_order_confirmation_email
message=response.render(msg_file, context)
  File "/opt/web-apps/web2py/gluon/globals.py", line 217, in render
run_view_in(self._view_environment)
  File "/opt/web-apps/web2py/gluon/compileapp.py", line 654, in run_view_in
context=environment)
  File "/opt/web-apps/web2py/gluon/restricted.py", line 222, in restricted
raise RestrictedError(layer, code, output, environment)
RestrictedError:  name 'unicodedata' is not 
defined


-- 





[web2py] Re: Rocket server hanging

2012-10-10 Thread Adi
Not sure if this is of any help to fix something, but for me it happens 
when i'm fiddling with migrations and get the error message that already 
exists. Since I deal w legacy databases I'm cautious not to "migrate" 
majority of tables, but several I have to. When I enable migration, and get 
the error that table already exists, that's when rocket starts spinning and 
after some time i just kill the process.

db = DAL('mysql://...', migrate_enabled=False, fake_migrate_all=True)
db.define_table(..., migrate=True)

changed into:
db = DAL('mysql://...', migrate=True)
db.define_table('a'..., migrate=True)

error:
 (1050, u"Table 'a' 
already exists")





On Wednesday, October 10, 2012 1:12:16 PM UTC-4, Massimo Di Pierro wrote:
>
> The current version of rocket, as of today, is the only pure python web 
> server that passes all pathoc tests (which means it is less vulnerable to 
> DoS attacks than others). 
>
> If it hangs (it never does for me), we should understand when and why.
>
> Massimo
>
> On Wednesday, 10 October 2012 10:40:02 UTC-5, VP wrote:
>>
>> I'm not impressed with Rocket , even as a devel-mode server. It hangs on 
>> me frequently.  Run web2py with more than 1 processes seem to help.
>
>

-- 





[web2py] restful api post works great localy, but getting login redirect on a remote server

2012-10-10 Thread Adi
This is an example from book, where authentication and posting into 
database work good on a local server. 

Once I moved the code to production redhat linux server, where we have 
routes.py as bellow all I get as result is a login redirect:
You are being redirected here

If I remove authentication (@auth.requires_login() and 
@auth.requires_permission('insert customer through webservice')) on 
production server, records are inserted properly. 

Tried adding default and webservices controllers into application specific 
routes.py, but it didn't help.

Any suggestions what should I do? 

Thanks,
Adnan

tried in both, default.py and webservices.py controllers:

auth.settings.allow_basic_login = True
@auth.requires_login()
@auth.requires_permission('insert customer through webservice')
@request.restful()
def api():
response.view = 'generic.'+request.extension

def GET(*args,**vars):
patterns = [
"/members[customer]",
"/member_fn/{customer.FirstName.startswith}",
"/member_ln/{customer.LastName.startswith}",
"/member/{customer.FirstName}/:field",

"/member/{customer.FirstName}/orders[customer_order.customer_id]",

"/member/{customer.FirstName}/order[customer_order.customer_id]/{customer_order.id}"
,

"/member/{customer.FirstName}/order[customer_order.customer_id]/{customer_order.id}/: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):
if table_name == 'customer':
return db.customer.validate_and_insert(**vars)
elif table_name == 'customer_order':
return db.customer_order.validate_and_insert(**vars)
else:
raise HTTP(400)
return locals()





web2py folder: routes.py
routers = dict(
# base router
BASE = dict(
default_application = 'welcome', domains = {'crm.domain.com': 'crm' 
}
),
)



crm app folder: routes.py (deleted)


Terminal test:


asm21:~ adnan$ curl --user webserv...@domain.com:pass -d 
"FirstName=Tim5&LastName=Json" http://crm.domain.com/api/customer.json
Result: You are being redirected 
here

asm21:~ adnan$ curl --user webserv...@domain.com:pass -d 
"FirstName=Tim5&LastName=Json" http://crm.domain.com/webservices/api/
customer.json
Result: You are being redirected here




-- 





[web2py] Re: Database insertion with a column default current time inserts wrong time

2012-10-05 Thread Adi
would default=request.now work in this case?

On Friday, October 5, 2012 8:27:52 PM UTC-4, Saurabh Kumar wrote:
>
> I have a table with follwing schema:
>
> db.define_table('active_connections',
> db.Field('user','string'),
> db.Field('last_seen','datetime',default=datetime.now()),
> )
>
> I am inserting entries to this table from a web2py external python script 
> run with the following command:
> python web2py.py -S chat -M -R applications/chat/private/script.py
>
> But instead of inserting current time in table entries, it inserts the 
> same time in all entries, the time when this script was run.
> Why does this happen?
>
>
>

-- 





Re: [web2py] Re: scheduler: Cannot duplicate a Singleton

2012-10-05 Thread Adi
Yes, new application was using the existing database, so fixing broken 
migration fixed the problem of not executing task. Now it executed and 
marked status as COMPLETED. The problem with scheduler_run table stayed the 
same. Status: FAILED, and traceback looks as bellow: 

Traceback (most recent call last):
  File "/Users/adnan/web2py209/gluon/scheduler.py", line 203, in executor
_env = env(a=a,c=c,import_models=True)
  File "/Users/adnan/web2py209/gluon/shell.py", line 134, in env
sys.exit(1)
SystemExit: 1



On Friday, October 5, 2012 6:59:04 PM UTC-4, Niphlod wrote:
>
> ok, the problems seems to be related to migrate, migrate_enabled and 
> fake_migrate_all. Can you try removing those from the db connection just to 
> try it out ?
>

-- 





Re: [web2py] Re: scheduler: Cannot duplicate a Singleton

2012-10-05 Thread Adi
Of course. This is what I have in a test application: 

Models
==
db.py

if not request.env.web2py_runtime_gae:
# used tunnel
*db_s = DAL('mysql://crm:password@localhost:3307/CRM',migrate_enabled=
False, fake_migrate_all=True)*
else:
## connect to Google BigTable (optional 'google:datastore://namespace')
db_s = DAL('google:datastore')
## store sessions and tickets there
session.connect(request, response, db_s = db_s)



db_scheduler.py
# coding: utf8
from scheduler import Scheduler
import datetime
import urllib, urllib2
from urlparse import urlparse
import unicodedata

def send_msg():
email_sent=mail.send(to='t...@email.com',
subject='email_subject',
message='message')
print 'sent'
return

myscheduler = Scheduler(db_s, dict(send_msg=send_msg))



Controllers
===
test.py
def test():
db_s.scheduler_task.insert(
 status='QUEUED',
 application_name='test2',
 task_name='send test abandoned email',
 function_name='send_msg',
 enabled=True,
 start_time = request.now,
 next_run_time = request.now+datetime.timedelta(
minutes=2),
 stop_time = request.now+datetime.timedelta(days
=1),
 repeats = 1, # run 1 times
 period = 120, # every 2m
 timeout = 60, # should take less than 60 
seconds
 )



Scheduler started: 
$ python web2py.py -a pass -K test2 -X > log_scheduler.log




On Friday, October 5, 2012 5:58:37 PM UTC-4, Massimo Di Pierro wrote:
>
> Can you share some code so we ret reproduce it and fix it? We do not need 
> all the code. Just a minimalist example that causes the same problem.
>
> On Friday, 5 October 2012 16:24:11 UTC-5, Adi wrote:
>>
>> yes, i just confirmed by running in parallel 9/13 and 10/5
>>
>> results:
>> 9/13 partially works (will execute task, mark it as "COMPLETED" in 
>> scheduler_tasks, but will mark it as "FAILED" in scheduler_run and won't 
>> update details in there...
>> 10/5 doesn't work (RuntimeError: Cannot duplicate a Singleton)
>>
>>
>> On Fri, Oct 5, 2012 at 11:59 AM, Massimo Di Pierro > > wrote:
>>
>>> To summarize:
>>> 1) 9/13 version works
>>> 2) 10/4 version does not work as you expected
>>>
>>> Did you try any 10/5 version?
>>>
>>>
>>> On Friday, 5 October 2012 10:21:46 UTC-5, Adi wrote:
>>>>
>>>>
>>>> for what it's worth, just want to let you know that after rolling back 
>>>> to "Version 2.0.9 (2012-09-13 23:51:30) stable" tasks are getting 
>>>> executed, marked as COMPLETED, but schedule_run is being marked as FAILED 
>>>> w 
>>>> bellow specified sys.exit(1). 
>>>>
>>>> anyway... this is perfect for now, and customers won't suffer :) 
>>>>
>>>> scheduler and workflow are two crucial things in complex applications 
>>>> from my prospective, so big thanks for scheduler, and can't wait to start 
>>>> testing workflow once it's in. 
>>>>
>>>> On Friday, October 5, 2012 9:27:22 AM UTC-4, Adi wrote:
>>>>>
>>>>>
>>>>> Created a new application from admin panel, accessing single mysql db, 
>>>>> inserted one task that sends an email and prints a test message. 
>>>>>
>>>>> Version 2.0.9 (2012-10-04 20:17:03) dev
>>>>>
>>>>> def test():
>>>>> db.scheduler_task.insert(
>>>>>  status='QUEUED',
>>>>>  application_name='test2',
>>>>>  task_name='send reminder email',
>>>>>  function_name='send_msg',
>>>>>  enabled=True,
>>>>>  start_time = request.now,
>>>>>  next_run_time = request.now+datetime.
>>>>> timedelta**(minutes=2),
>>>>>  stop_time = request.now+datetime.
>>>>> timedelta**(days=1),
>>>>>  repeats = 1, # run 1 times
>>>>>  period = 120, 

Re: [web2py] Re: scheduler: Cannot duplicate a Singleton

2012-10-05 Thread Adi

for what it's worth, just want to let you know that after rolling back to 
"Version 
2.0.9 (2012-09-13 23:51:30) stable" tasks are getting executed, marked as 
COMPLETED, but schedule_run is being marked as FAILED w bellow specified 
sys.exit(1). 

anyway... this is perfect for now, and customers won't suffer :) 

scheduler and workflow are two crucial things in complex applications from 
my prospective, so big thanks for scheduler, and can't wait to start 
testing workflow once it's in. 

On Friday, October 5, 2012 9:27:22 AM UTC-4, Adi wrote:
>
>
> Created a new application from admin panel, accessing single mysql db, 
> inserted one task that sends an email and prints a test message. 
>
> Version 2.0.9 (2012-10-04 20:17:03) dev
>
> def test():
> db.scheduler_task.insert(
>  status='QUEUED',
>  application_name='test2',
>  task_name='send reminder email',
>  function_name='send_msg',
>  enabled=True,
>  start_time = request.now,
>  next_run_time = request.now+datetime.
> timedelta(minutes=2),
>  stop_time = request.now+datetime.timedelta(
> days=1),
>  repeats = 1, # run 1 times
>  period = 120, 
>  timeout = 60, # should take less than 60 
> seconds
>  )
>
>
>
> *started scheduler: *
> asm21:web2py209 adnan$ python web2py.py -a pass -K test2 -X
> web2py Web Framework
> Created by Massimo Di Pierro, Copyright 2007-2012
> Version 2.0.9 (2012-10-04 20:17:03) dev
> Database drivers available: SQLite(sqlite3), MySQL(pymysql), 
> PostgreSQL(pg8000), IMAP(imaplib)
> please visit:
>  starting scheduler for "test2"...http://127.0.0.1:8000
>
> use "kill -SIGTERM 831" to shutdown the web2py server
> Currently running 1 scheduler processes
> Processes started
> ERROR:Rocket.Errors.Port8000:Socket 127.0.0.1:8000 in use by other 
> process and it won't share.
> WARNING:Rocket.Errors.Port8000:Listener started when not ready.
> Traceback (most recent call last):
>   File "/Users/adnan/web2py209/gluon/restricted.py", line 209, in 
> restricted
> exec ccode in environment
>   File "applications/test2/models/db.py", line 15, in 
> db = 
> DAL('mysql://crm:password@localhost:3307/CRM',migrate_enabled=False, 
> fake_migrate_all=True)
>   File "/Users/adnan/web2py209/gluon/dal.py", line 6600, in __new__
> raise RuntimeError, 'Cannot duplicate a Singleton'
> RuntimeError: Cannot duplicate a Singleton
>
>
> *traceback error in the scheduler_run table after task was run (first 
> time):*
> Traceback (most recent call last):
>   File "/opt/web-apps/web2py/gluon/scheduler.py", line 203, in executor
> _env = env(a=a,c=c,import_models=True)
>   File "/opt/web-apps/web2py/gluon/shell.py", line 127, in env
> environment = build_environment(request, response, session)
>   File "/opt/web-apps/web2py/gluon/compileapp.py", line 388, in 
> build_environment
> t = environment['T'] = translator(request)
>   File "/opt/web-apps/web2py/gluon/languages.py", line 437, in __init__
> self.set_current_languages()
>   File "/opt/web-apps/web2py/gluon/languages.py", line 492, in 
> set_current_languages
> pl_info = self.get_possible_languages_info('default')
>   File "/opt/web-apps/web2py/gluon/languages.py", line 471, in 
> get_possible_languages_info
> info = read_possible_languages(self.folder)
>   File "/opt/web-apps/web2py/gluon/languages.py", line 250, in 
> read_possible_languages
> lambda: read_possible_languages_aux(langdir))
>   File "/opt/web-apps/web2py/gluon/cfs.py", line 40, in getcfs
> return filter() if callable(filter) else ''
>   File "/opt/web-apps/web2py/gluon/languages.py", line 250, in 
> lambda: read_possible_languages_aux(langdir))
>   File "/opt/web-apps/web2py/gluon/languages.py", line 215, in 
> read_possible_languages_aux
> flist = oslistdir(langdir)
> OSError: [Errno 2] No such file or directory: 
> 'applications/test2/languages'
>
> *traceback error in the scheduler_run table after task was run (second 
> time):*
> Traceback (most recent call last):
>   File "/Users/adnan/web2py209/gluon/scheduler.py", line 203, in executor
> _env = env(a=a,c=c,import_models=True)

Re: [web2py] Re: scheduler: Cannot duplicate a Singleton

2012-10-05 Thread Adi

Created a new application from admin panel, accessing single mysql db, 
inserted one task that sends an email and prints a test message. 

Version 2.0.9 (2012-10-04 20:17:03) dev

def test():
db.scheduler_task.insert(
 status='QUEUED',
 application_name='test2',
 task_name='send reminder email',
 function_name='send_msg',
 enabled=True,
 start_time = request.now,
 next_run_time = request.now+datetime.timedelta(
minutes=2),
 stop_time = request.now+datetime.timedelta(days
=1),
 repeats = 1, # run 1 times
 period = 120, 
 timeout = 60, # should take less than 60 
seconds
 )



*started scheduler: *
asm21:web2py209 adnan$ python web2py.py -a pass -K test2 -X
web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2012
Version 2.0.9 (2012-10-04 20:17:03) dev
Database drivers available: SQLite(sqlite3), MySQL(pymysql), 
PostgreSQL(pg8000), IMAP(imaplib)
please visit:
 starting scheduler for "test2"...http://127.0.0.1:8000

use "kill -SIGTERM 831" to shutdown the web2py server
Currently running 1 scheduler processes
Processes started
ERROR:Rocket.Errors.Port8000:Socket 127.0.0.1:8000 in use by other process 
and it won't share.
WARNING:Rocket.Errors.Port8000:Listener started when not ready.
Traceback (most recent call last):
  File "/Users/adnan/web2py209/gluon/restricted.py", line 209, in restricted
exec ccode in environment
  File "applications/test2/models/db.py", line 15, in 
db = 
DAL('mysql://crm:password@localhost:3307/CRM',migrate_enabled=False, 
fake_migrate_all=True)
  File "/Users/adnan/web2py209/gluon/dal.py", line 6600, in __new__
raise RuntimeError, 'Cannot duplicate a Singleton'
RuntimeError: Cannot duplicate a Singleton


*traceback error in the scheduler_run table after task was run (first time):
*
Traceback (most recent call last):
  File "/opt/web-apps/web2py/gluon/scheduler.py", line 203, in executor
_env = env(a=a,c=c,import_models=True)
  File "/opt/web-apps/web2py/gluon/shell.py", line 127, in env
environment = build_environment(request, response, session)
  File "/opt/web-apps/web2py/gluon/compileapp.py", line 388, in 
build_environment
t = environment['T'] = translator(request)
  File "/opt/web-apps/web2py/gluon/languages.py", line 437, in __init__
self.set_current_languages()
  File "/opt/web-apps/web2py/gluon/languages.py", line 492, in 
set_current_languages
pl_info = self.get_possible_languages_info('default')
  File "/opt/web-apps/web2py/gluon/languages.py", line 471, in 
get_possible_languages_info
info = read_possible_languages(self.folder)
  File "/opt/web-apps/web2py/gluon/languages.py", line 250, in 
read_possible_languages
lambda: read_possible_languages_aux(langdir))
  File "/opt/web-apps/web2py/gluon/cfs.py", line 40, in getcfs
return filter() if callable(filter) else ''
  File "/opt/web-apps/web2py/gluon/languages.py", line 250, in 
lambda: read_possible_languages_aux(langdir))
  File "/opt/web-apps/web2py/gluon/languages.py", line 215, in 
read_possible_languages_aux
flist = oslistdir(langdir)
OSError: [Errno 2] No such file or directory: 'applications/test2/languages'

*traceback error in the scheduler_run table after task was run (second 
time):*
Traceback (most recent call last):
  File "/Users/adnan/web2py209/gluon/scheduler.py", line 203, in executor
_env = env(a=a,c=c,import_models=True)
  File "/Users/adnan/web2py209/gluon/shell.py", line 134, in env
sys.exit(1)
SystemExit: 1

Please let me know if there is anything else I can test to help figure out 
where exactly is the problem? It's a bit urgent for me to figure this out, 
or I have to roll back production before weekend starts :(



On Friday, October 5, 2012 12:00:57 AM UTC-4, Adi wrote:
>
> Will run more tests in the morning on a brand new application, since I 
> can't see anything wrong (connection string duplication) in code right now. 
> Unfortunately, can't roll back this functionality now, so will have to 
> figure it out quickly. Thanks for help Massimo and Niphlod. 
>
>
> On Thu, Oct 4, 2012 at 10:32 PM, Massimo Di Pierro <
> massimo.dipie...@gmail.com> wrote:
>
>> No. this should not be a problem. This is only be a problem if any two 
>> have the same connection string.
>>
>>
>> On Thursday, 4 October 2012 21:10:58 UTC-5, Adi wrote:
>>

[web2py] scheduler: Cannot duplicate a Singleton

2012-10-04 Thread Adi
We promoted latest night build to production, and scheduler started 
failing. At the same time there were some code changes, so I'm having a 
hard time tracing the source of the problem.

Any insights while I'm trying to figure it out?

Thanks,
Adi

db: mysql
redhat linux
w2p: Version 2.0.9 (2012-10-02 03:55:58) dev

scheduler_run table: traceback field:
Traceback (most recent call last):
  File "/opt/web-apps/web2py/gluon/scheduler.py", line 203, in executor
_env = env(a=a,c=c,import_models=True)
  File "/opt/web-apps/web2py/gluon/shell.py", line 134, in env
sys.exit(1)
SystemExit: 1


scheduler log:
/opt/web-apps/web2py/gluon/dal.py:6597: DeprecationWarning: 
object.__new__() takes no parameters
  db = super(DAL, cls).__new__(cls, uri, *args, **kwargs)
web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2012
Version 2.0.9 (2012-10-02 03:55:58) dev
Database drivers available: SQLite(sqlite3), MySQL(pymysql), 
PostgreSQL(pg8000), IMAP(imaplib)
starting single-scheduler for "crm"...
Traceback (most recent call last):
  File "/opt/web-apps/web2py/gluon/restricted.py", line 209, in restricted
exec ccode in environment
  File "applications/crm/models/db.py", line 47, in 
db = 
DAL('mysql://crm:password@localhost:3307/CRM',migrate_enabled=False, 
fake_migrate_all=True)
  File "/opt/web-apps/web2py/gluon/dal.py", line 6595, in __new__
raise RuntimeError, 'Cannot duplicate a Singleton'
RuntimeError: Cannot duplicate a Singleton

-- 





[web2py] Re: Need help... testing new DAL

2012-10-02 Thread Adi
light tested against 3 apps and all seems to work fine so far. 

Adnan

On Monday, October 1, 2012 10:32:16 PM UTC-4, Massimo Di Pierro wrote:
>
> There is a big change in DAL.
>
> a = DAL(uri)
> b = DAL(uri)
>
> now "a is b" because DAL is a singleton (almost). It is a thread local 
> singleton as long a uri is specified.
> What does this mean in practice?
>
> It means that unless you have lazy virtual fields, Row and Rows objects 
> can be serialized (pickled), properly cached, and stored in session.
> For example:
>
> session.rows = session.rows or db(db.mytable).select()
>
> and you can still do:
>
> session.rows.first().update_record()
>
> has many practical implications in the way you program and there is even 
> more we could do. In the future we may be able to serialize every DAL 
> expression.
>
> This is a big change in the source and the internal logic is complex. 
> It may have some unforeseen side effects.
> PLEASE TEST THAT TRUNK DOES NOT BREAK YOUR CODE before this makes it into 
> stable.
>
> massimo
>
>
>
>
>
>

-- 





[web2py] Re: language file fields - text or string?

2012-10-01 Thread Adi
works well :) thanks for fixing it Massimo.

Adnan

On Monday, October 1, 2012 1:30:03 PM UTC-4, Massimo Di Pierro wrote:
>
> Oops. This was a mistake. It should now be fixed in trunk. Can you try it?
>
> On Monday, 1 October 2012 10:44:35 UTC-5, Adi wrote:
>>
>> Sorry for bringing this up again. The code hasn't changed in 
>> admin/default/edit_language, and should work as before, but doesn't in my 
>> case. Anyone else sees TEXTAREA if translation string > 40 characters when 
>> editing languages? Thanks.
>>
>>
>> def edit_language():
>> """ Edit language file """
>> app = get_app()
>> filename = '/'.join(request.args)
>> strings = read_dict(apath(filename, r=request))
>>
>> if '__corrupted__' in strings:
>>form = SPAN(strings['__corrupted__'],_class='error')
>>return dict(filename=filename, form=form)
>>
>> keys = sorted(strings.keys(),lambda x,y: cmp(unicode(x,'utf-8').lower
>> (), unicode(y,'utf-8').lower()))
>> rows = []
>> rows.append(H2(T('Original/Translation')))
>>
>> for key in keys:
>> name = md5_hash(key)
>> s = strings[key]
>> (prefix, sep, key) = key.partition('\x01')
>> if sep:
>> prefix = SPAN(prefix+': ', _class='tm_ftag')
>> k = key
>> else:
>> (k, prefix) = (prefix, '')
>>
>> _class='untranslated' if k==s else 'translated'
>>
>> *if len(key) <= 40:
>> elem = INPUT(_type='text', _name=name, value=s,
>>  _size=70,_class=_class)
>> else:
>> elem = TEXTAREA(_name=name, value=s, _cols=70,
>> _rows=5, _class=_class)*
>>
>>
>>
>>
>> On Tuesday, September 25, 2012 3:19:55 PM UTC-4, Adi wrote:
>>>
>>>
>>> If I remember well, previously language files displayed multi-line text 
>>> input fields for longer strings, instead of one line. 
>>>
>>> I deal with lot of translated text, and it is much easier to visually 
>>> spot problems in text fields. 
>>>
>>> Any possibility to re-introduce text fields in Languages where string 
>>> length > 255 or something like that?  
>>>
>>> Thanks,
>>> Adnan
>>>
>>>
>>>

-- 





[web2py] Re: language file fields - text or string?

2012-10-01 Thread Adi
Sorry for bringing this up again. The code hasn't changed in 
admin/default/edit_language, and should work as before, but doesn't in my 
case. Anyone else sees TEXTAREA if translation string > 40 characters when 
editing languages? Thanks.


def edit_language():
""" Edit language file """
app = get_app()
filename = '/'.join(request.args)
strings = read_dict(apath(filename, r=request))

if '__corrupted__' in strings:
   form = SPAN(strings['__corrupted__'],_class='error')
   return dict(filename=filename, form=form)

keys = sorted(strings.keys(),lambda x,y: 
cmp(unicode(x,'utf-8').lower(),unicode
(y,'utf-8').lower()))
rows = []
rows.append(H2(T('Original/Translation')))

for key in keys:
name = md5_hash(key)
s = strings[key]
(prefix, sep, key) = key.partition('\x01')
if sep:
prefix = SPAN(prefix+': ', _class='tm_ftag')
k = key
else:
(k, prefix) = (prefix, '')

_class='untranslated' if k==s else 'translated'

*if len(key) <= 40:
elem = INPUT(_type='text', _name=name, value=s,
 _size=70,_class=_class)
else:
elem = TEXTAREA(_name=name, value=s, _cols=70,
_rows=5, _class=_class)*




On Tuesday, September 25, 2012 3:19:55 PM UTC-4, Adi wrote:
>
>
> If I remember well, previously language files displayed multi-line text 
> input fields for longer strings, instead of one line. 
>
> I deal with lot of translated text, and it is much easier to visually spot 
> problems in text fields. 
>
> Any possibility to re-introduce text fields in Languages where string 
> length > 255 or something like that?  
>
> Thanks,
> Adnan
>
>
>

-- 





[web2py] Re: potential problem w db.executesql(sql) not updating table when done during onvalidation process

2012-09-27 Thread Adi
little bit of code reshuffling in one line, and it works perfect! Thank you 
again Massimo. Tremendous help. 

Order.CCnr_secure.compute = \
   lambda row, token=TOKEN: Expression(db,"AES_ENCRYPT('%s','%s')" % (
row.CCnr, token))




On Thursday, September 27, 2012 4:26:01 PM UTC-4, Massimo Di Pierro wrote:
>
> There are two callbacks: onvalidation and onaccept. They are executed 
> before and after the record is updated by the form submission. If you alter 
> the record on validation, it gets overwritten when the form is accepted. 
> Not sure why adding rows=... fixes the problem. Anyway you can replace your 
> code with:
>
> def checkout_cc():
> from gluon.dal import Expression
> TOKEN='cd7358801fd5db53d74b038b7b97a6c4'
> Order.CCnr_secure.compute = \
>lambda row, token=TOKEN, oid: \
>Expression(db,"AES_ENCRYPT('%s','%s')" % (token,oid))
>
> form=SQLFORM(Order, record=record, fields=fields, keepvalues=True,
>  showid=False,
> formstyle='divs', submit_button=T('Continue'))
>
> if form.process(keepvalues=True).accepted:
> response.flash = T('Payment Information accepted')
>
> On Wednesday, 26 September 2012 19:09:50 UTC-5, Adi wrote:
>>
>>
>> My apology if a description of the problem is not concise enough. I am 
>> updating record during onvalidaiton process, and this worked until Sep 17. 
>> Anything is possible, but I don't remember changing any code in this area.
>>
>> When I run the same SQL statement manually, or from a test procedure, 
>> everything works fine, but not when it's executed through SQLFORM 
>> onvalidation process. I tried adding db.commit() and that didn't help, 
>> either. 
>>
>> Finally, I added following query at the end, and then record got updated: 
>> row = db(Order.id==session.order_id).select().first()
>>
>> My problem seems to be solved for now, but not sure what is a real cause 
>> of the problem, and if something needs correction in executesql? 
>>
>> Simplified code:
>>
>> def db_encrypt_cc(tbl=None, cc=None, id=None):
>> TOKEN='cd7358801fd5db53d74b038b7b97a6c4'
>> sql = "UPDATE %s SET CCnr_secure = AES_ENCRYPT('%s', '%s') WHERE 
>> id=%s" % (tbl, cc, TOKEN, session.order_id)
>> # when executed, this statement is correct, but no value gets 
>> updated in the table: UPDATE order SET CCnr_secure = 
>> AES_ENCRYPT('4111', 'cd7358801fd5db53d74b038b7b97a6c4') 
>> WHERE id=10423
>> db.executesql(sql)
>> # added code bellow and only then record got updated
>> row = db(Order.id==session.order_id).select().first()
>> return
>>
>> def cc_validation(form):
>> form.vars.CCnr_secure = db_encrypt_cc("order", form.vars.CCnr)
>> return
>> 
>> def checkout_cc():
>> form=SQLFORM(Order, record=record, fields=fields, keepvalues=True,showid
>> =False,
>> formstyle='divs', submit_button=T('Continue'))
>>
>> if form.process(keepvalues=True, onvalidation=cc_validation).accepted
>> :
>> response.flash = T('Payment Information accepted')
>>
>>
>>
>>
>>

-- 





[web2py] Re: potential problem w db.executesql(sql) not updating table when done during onvalidation process

2012-09-26 Thread Adi
forgot to mention db & ver of w2p: 
MySQL + Version 2.0.9 (2012-09-13 23:51:30) stable


On Wednesday, September 26, 2012 8:09:50 PM UTC-4, Adi wrote:
>
>
> My apology if a description of the problem is not concise enough. I am 
> updating record during onvalidaiton process, and this worked until Sep 17. 
> Anything is possible, but I don't remember changing any code in this area.
>
> When I run the same SQL statement manually, or from a test procedure, 
> everything works fine, but not when it's executed through SQLFORM 
> onvalidation process. I tried adding db.commit() and that didn't help, 
> either. 
>
> Finally, I added following query at the end, and then record got updated: 
> row = db(Order.id==session.order_id).select().first()
>
> My problem seems to be solved for now, but not sure what is a real cause 
> of the problem, and if something needs correction in executesql? 
>
> Simplified code:
>
> def db_encrypt_cc(tbl=None, cc=None, id=None):
> TOKEN='cd7358801fd5db53d74b038b7b97a6c4'
> sql = "UPDATE %s SET CCnr_secure = AES_ENCRYPT('%s', '%s') WHERE 
> id=%s" % (tbl, cc, TOKEN, session.order_id)
> # when executed, this statement is correct, but no value gets updated 
> in the table: UPDATE order SET CCnr_secure = 
> AES_ENCRYPT('4111', 'cd7358801fd5db53d74b038b7b97a6c4') 
> WHERE id=10423
> db.executesql(sql)
> # added code bellow and only then record got updated
> row = db(Order.id==session.order_id).select().first()
> return
>
> def cc_validation(form):
> form.vars.CCnr_secure = db_encrypt_cc("order", form.vars.CCnr)
> return
> 
> def checkout_cc():
> form=SQLFORM(Order, record=record, fields=fields, keepvalues=True,showid
> =False,
> formstyle='divs', submit_button=T('Continue'))
>
> if form.process(keepvalues=True, onvalidation=cc_validation).accepted:
> response.flash = T('Payment Information accepted')
>
>
>
>
>

-- 





[web2py] potential problem w db.executesql(sql) not updating table when done during onvalidation process

2012-09-26 Thread Adi

My apology if a description of the problem is not concise enough. I am 
updating record during onvalidaiton process, and this worked until Sep 17. 
Anything is possible, but I don't remember changing any code in this area.

When I run the same SQL statement manually, or from a test procedure, 
everything works fine, but not when it's executed through SQLFORM 
onvalidation process. I tried adding db.commit() and that didn't help, 
either. 

Finally, I added following query at the end, and then record got updated: 
row = db(Order.id==session.order_id).select().first()

My problem seems to be solved for now, but not sure what is a real cause of 
the problem, and if something needs correction in executesql? 

Simplified code:

def db_encrypt_cc(tbl=None, cc=None, id=None):
TOKEN='cd7358801fd5db53d74b038b7b97a6c4'
sql = "UPDATE %s SET CCnr_secure = AES_ENCRYPT('%s', '%s') WHERE id=%s" 
% (tbl, cc, TOKEN, session.order_id)
# when executed, this statement is correct, but no value gets updated 
in the table: UPDATE order SET CCnr_secure = 
AES_ENCRYPT('4111', 'cd7358801fd5db53d74b038b7b97a6c4') 
WHERE id=10423
db.executesql(sql)
# added code bellow and only then record got updated
row = db(Order.id==session.order_id).select().first()
return

def cc_validation(form):
form.vars.CCnr_secure = db_encrypt_cc("order", form.vars.CCnr)
return

def checkout_cc():
form=SQLFORM(Order, record=record, fields=fields, keepvalues=True,showid
=False,
formstyle='divs', submit_button=T('Continue'))

if form.process(keepvalues=True, onvalidation=cc_validation).accepted:
response.flash = T('Payment Information accepted')




-- 





[web2py] language file fields - text or string?

2012-09-25 Thread Adi

If I remember well, previously language files displayed multi-line text 
input fields for longer strings, instead of one line. 

I deal with lot of translated text, and it is much easier to visually spot 
problems in text fields. 

Any possibility to re-introduce text fields in Languages where string 
length > 255 or something like that?  

Thanks,
Adnan


-- 





[web2py] Re: smartgrid: linked_tables=dict(parent=['child'], child=[''])

2012-09-22 Thread Adi
If I may rephrase and clarify a question: 

Is it possible to add control, through dictionary in (smartgrid) 
linked_tables when will links display?

e.g: linked_tables=dict(parent=['child'], child=[''])

wishful outcome: display children links for parent table, but don't display 
any related links for child table.

Thanks,
Adnan


On Friday, September 21, 2012 11:58:05 AM UTC-4, Adi wrote:
>
> I'm wondering what to do in this situation? I have self-referencing fields 
> in the child table, and due to that smartgrid display links, which 
> basically can't do anything. 
>
> I'm trying to eliminate them, but not sure what would be a proper way? 
>
> Thanks.
>
> Simplified code sample: 
> db.define_table('campaign',
> Field('tbl_uuid', length=64, default=lambda:str(uuid.
> uuid4())),
> Field('name','string', label=T('Campaing Name')),
> format='%(name)s',
> )
>
> db.define_table('message',
> Field('tbl_uuid', length=64, default=lambda:str(uuid.
> uuid4())),
> Field('name','string', label=T('Name')),
> Field('campaign_id', 'reference campaign', label=T(
> 'Campaign')),
> Field('action_yes_id', 'reference message)', 
> label=T('Action 
> Yes'),),
> Field('action_no_id', 'reference message)', 
> label=T('Action 
> No')),
> migrate=True)
>
>
>
> grid=SQLFORM.smartgrid(Campaign, details=False, links_in_grid=True,
> linked_tables=['message'],
> #linked_tables=dict(campaign=['message'], 
> message=['']),
> links=dict(campaign=[lambda row:(_get_messages(row))
> ]),
> )
> Enter code here...
>
>
>

-- 





[web2py] Re: 2.0.9 control-f firefox/chrome on mac doesn't work

2012-09-20 Thread Adi
Oh it works so perfect! Thank you Massimo :) I struggled between admin 
editor, vim and textmate, and now I'm back in productive mode... Great.


On Thursday, September 20, 2012 2:26:18 PM UTC-4, Massimo Di Pierro wrote:
>
> Try trunk again look at the bottom of the edit page for search keybindings.
>
> On Thursday, 20 September 2012 11:54:38 UTC-5, LightDot wrote:
>>
>> Ok, this is helpful. I didn't think of document size before.
>>
>> It seems that CodeMirror doesn't render a whole document to the DOM when 
>> it's big. So the browser search function
>> won't pick up parts that are inactive.
>>
>> I don't know how is this handled with Codemirror's internal search, it's 
>> something to look into.
>>
>> Regards,
>> Ales
>>
>>
>> On Thursday, September 20, 2012 6:12:56 PM UTC+2, Jaymin Oh wrote:
>>>
>>> I have same bug in Windows 7, Chrome/IE, Web2py 2.0.8 with more than 
>>> 1200 lines in one controller.
>>>
>>> It happens occasionally, but when I move the scrolls, then it works as 
>>> it should.
>>>
>>> It really bothers me, so that I installed WingIDE and plan to purchase 
>>> it.
>>>
>>> On Tuesday, September 18, 2012 10:44:24 PM UTC+9, Adi wrote:
>>>>
>>>>
>>>> tried "search" via control/f in welcome app 2.0.9 stable (firefox and 
>>>> chrome) on mac, and it's not responding. 
>>>>
>>>> did editor commands change?
>>>>
>>>> thanks,
>>>> Adi
>>>>
>>>>

-- 





[web2py] Re: SQLFORM.grid, links and buttons placement specification (before other columns, after, or both)

2012-09-18 Thread Adi
+1 

needed this since January :) links on left side would be great.
https://groups.google.com/d/topic/web2py/ZlxQ3AfWrr4/discussion


On Tuesday, April 17, 2012 4:57:04 AM UTC-4, nikos wrote:
>
> Hello there follow web2py users,
>
> First of all, Massimo, thanks for the great work you have done to get 
> web2py to this high level of functionality.
>
> I recently started using it for a project and was faced with a challenge: 
> in SQLFORM.grid, when a table has many fields, the users have to scroll to 
> the far right to get to the action buttons, and this has proved cumbersome 
> to them. 
> The same goes for the links that we are allowed to add to the grid.
>
> I chose to resolve this issue by adding two extra optional arguments to 
> SQLFORM.grid, namely buttons_placement and links_placement
> The two are expected to have a value among 'left', 'right', 'both' 
> Both default to 'right' to maintain backward compatibility.
>
> If you set them to 'left' the corresponding column(s) will appear at the 
> beginning of the grid (1st column).
> If you set them to 'right, they will appear at the end (as it was already 
> working)
> If you set them to 'both', the columns will appear twice, at the beginning 
> and at the end (usefull for large tables where the user can locate the 
> column he wants to decide upon and find a button closeby, either at the 
> beginning or the end)
>
> I am attaching a patch against the stock 1.99.7 that I used to begin with.
>
> It would be great if some form of this patch would be included in future 
> releases.
>
> Again, thanks for all the hard work you all have put into this.
>
> Nikos
>
>
>

-- 





[web2py] 2.0.9 web2py.css smartgrid links instead of previous buttons

2012-09-18 Thread Adi
just updated my previous application 1.9.97 web2py.css with the 2.0.9 and 
smartgrid default buttons became links. Several custom buttons stayed as 
buttons.

noticed that this code bellow was taken out and replaced with commented 
part. is there now an other way to create by default smartgrid buttons 
instead of links? i can keep the old web2py.css and .js, but thought would 
be good to keep up with latest versions of .css and .js.


.web2py_console button {
line-height: 20px;
margin-right: 5px; display: inline-block;
padding: 3px 5px 3px 5px;
font-family: 'lucida grande', tahoma, verdana, arial, sans-serif;
font-size: 1em;
color: #3C3C3D;
text-shadow: 1px 1px 0 #FF;
background:#ECECEC;
white-space: nowrap; overflow: visible;
cursor: pointer; text-decoration: none;
border: 1px solid #CACACA;
-webkit-border-radius: 2px; -moz-border-radius: 2px;
-webkit-background-clip: padding-box; border-radius: 2px;
outline: none; position: relative; zoom: 1; *display: inline;
}

/*
.web2py_console button {
line-height:20px;
margin-right:2px; display:inline-block;
padding:3px 5px 3px 5px;
}
*/



-- 



<>

[web2py] Re: 2.0.9 control-f firefox/chrome on mac doesn't work

2012-09-18 Thread Adi
Yes, I meant the admin editor. Command-F is a browser search, but Control-F 
was a working feature of the editor. Something strange is going on my side 
with code search, but otherwise I like working in the admin editor... Will 
check codemirror instructions. Thanks Massimo...
 

On Tuesday, September 18, 2012 10:13:01 AM UTC-4, Massimo Di Pierro wrote:
>
> Do you mean the admin editor? We replaced it with codemirror so some 
> commands may have changed. Yet search is a browser feature, not a feature 
> of the editor so it should not have changed.
>
> On Tuesday, 18 September 2012 08:44:24 UTC-5, Adi wrote:
>>
>>
>> tried "search" via control/f in welcome app 2.0.9 stable (firefox and 
>> chrome) on mac, and it's not responding. 
>>
>> did editor commands change?
>>
>> thanks,
>> Adi
>>
>>

-- 





[web2py] 2.0.9 control-f firefox/chrome on mac doesn't work

2012-09-18 Thread Adi

tried "search" via control/f in welcome app 2.0.9 stable (firefox and 
chrome) on mac, and it's not responding. 

did editor commands change?

thanks,
Adi

-- 





[web2py] Re: w2p 2.08 stable: invalid table or field name: 40off_sh

2012-09-13 Thread Adi
for the convenience i pulled out both versions, and my suggested change:
1.99.7 cleanup: 
def cleanup(text):
"""
validates that the given text is clean: only contains [0-9a-zA-Z_]
"""

if re.compile('[^0-9a-zA-Z_]').findall(text):
raise SyntaxError, \
'only [0-9a-zA-Z_] allowed in table and field names, received 
%s' \
% text
return text

2.08 cleanup: 

REGEX_ALPHANUMERIC = re.compile('^[a-zA-Z]\w*$')

def cleanup(text):
"""
validates that the given text is clean: only contains [0-9a-zA-Z_]
"""
if not REGEX_ALPHANUMERIC.match(text):
raise SyntaxError, 'invalid table or field name: %s' % text
return text


>>> REGEX_ALPHANUMERIC = re.compile('^[a-zA-Z]\w*$')
>>> REGEX_ALPHANUMERIC.match('40')
>>> print REGEX_ALPHANUMERIC.match('40')
None

i changed into this and all works good:
>>> REGEX_ALPHANUMERIC = re.compile('^[0-9a-zA-Z]\w*$')
>>> print REGEX_ALPHANUMERIC.match('40aaa_aa').span()
(0, 8)



On Thursday, September 13, 2012 8:28:43 PM UTC-4, Adi wrote:
>
> One of my fields is 40off_sh (legacy MySQL db), and all works fine in 
> 1.97. Seems like cleanup function in dal doesn't like the numeric part at 
> the beginning of field name, or I'm reading it wrong? I checked the table 
> and the field is in, so it's not missing. 
>
> I can't change the field name, since it's used by other applications, so 
> not sure what would you recommend to do here?
>
> Thanks,
> Adnan
>
> Traceback (most recent call last):
>   File "/opt/web-apps/web2py/gluon/restricted.py", line 209, in restricted
> exec ccode in environment
>   File "/opt/web-apps/web2py/applications/thane_us/models/db_1_common.py", 
> line 182, in 
> Field('40off_sh', 'boolean',),
>   File "/opt/web-apps/web2py/gluon/dal.py", line 8396, in __init__
> self.name = fieldname = cleanup(fieldname)
>   File "/opt/web-apps/web2py/gluon/dal.py", line 4769, in cleanup
> raise SyntaxError, 'invalid table or field name: %s' % text
> SyntaxError: invalid table or field name: 40off_sh
>
>
>

-- 





[web2py] w2p 2.08 stable: invalid table or field name: 40off_sh

2012-09-13 Thread Adi
One of my fields is 40off_sh (legacy MySQL db), and all works fine in 1.97. 
Seems like cleanup function in dal doesn't like the numeric part at the 
beginning of field name, or I'm reading it wrong? I checked the table and 
the field is in, so it's not missing. 

I can't change the field name, since it's used by other applications, so 
not sure what would you recommend to do here?

Thanks,
Adnan

Traceback (most recent call last):
  File "/opt/web-apps/web2py/gluon/restricted.py", line 209, in restricted
exec ccode in environment
  File "/opt/web-apps/web2py/applications/thane_us/models/db_1_common.py", line 
182, in 
Field('40off_sh', 'boolean',),
  File "/opt/web-apps/web2py/gluon/dal.py", line 8396, in __init__
self.name = fieldname = cleanup(fieldname)
  File "/opt/web-apps/web2py/gluon/dal.py", line 4769, in cleanup
raise SyntaxError, 'invalid table or field name: %s' % text
SyntaxError: invalid table or field name: 40off_sh


-- 





[web2py] 2.02 examples won't open for editing: [Errno 2] No such file or directo

2012-08-30 Thread Adi
 [Errno 2] No such file or directory: 
'/Users/adnan/web2py-branch9/applications/examples/languages'

traceback:

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.

Traceback (most recent call last):
  File "/Users/adnan/web2py-branch9/gluon/restricted.py", line 209, in 
restricted
exec ccode in environment
  File "/Users/adnan/web2py-branch9/applications/admin/controllers/default.py" 
, line 
1722, in 
  File "/Users/adnan/web2py-branch9/gluon/globals.py", line 185, in 
self._caller = lambda f: f()
  File "/Users/adnan/web2py-branch9/applications/admin/controllers/default.py" 
, line 
949, in design
in read_possible_languages(apath(app, r=request)).iteritems()
  File "/Users/adnan/web2py-branch9/gluon/languages.py", line 207, in 
read_possible_languages
for filename in os.listdir(langdir):
OSError: [Errno 2] No such file or directory: 
'/Users/adnan/web2py-branch9/applications/examples/languages'


-- 





[web2py] 2.02 can't edit examples - no languages folder

2012-08-30 Thread Adi
 [Errno 2] No such file or directory: 
'/Users/adnan/web2py-branch9/applications/examples/languages'

-- 





[web2py] 2.02 Table name in smartgrid changed...

2012-08-30 Thread Adi
Smartgrid used to display the table name automatically. Is that supposed to 
be as before?

-- 



<><>

[web2py] Re: web2py 2.0.2 is out

2012-08-30 Thread Adi
Thank you Massimo and ALL contributors!!!

Starting migration tests now...


On Wednesday, August 29, 2012 11:41:34 PM UTC-4, Massimo Di Pierro wrote:
>
> After 5 months. It is done. This is the most waited and the most 
> feature-packed release.
>
> I am sure we'll find some corners that need to be ironed but it is 
> considerably better than 1.99.7. It adds lot of new features and improves 
> many existing ones:
>
> - 57,000 new lines of code and closed 279 issues since 1.99.7.
> - Retrieving data from DB should be faster, in particular 
> select(cacheable=True)
> - Has a new scheduler, a built-in wiki, new language and pluralization 
> system, better markmin with oembed support and better scaffolding app, 
> increased security.
> - Lots of experimental features including GIS support, mongodb support, 
> built-in auth.wiki(), and more.
>
> Should be 100% backward compatible. If you run into any issue let us know 
> ASAP.
>
> I personally want to thank the major contributors to this release (in 
> alphabetic order)
> Alan, Andrew, Anthony, Bruno, Christian, Dave, Dominic, Iceberg, Jonathan, 
> Marc, Mariano, Marin, Martin, Mark, Michael, Michele, Niphlod, Patrick, 
> Vladyslav, 
> They spend many nights testing, coding, debugging at a very fast pace.
>
> Many many people have contributed.
>
> If your contribution has not been properly acknowledged please let us know 
> ASAP. It is probably an oversight.
>
>
> Massimo
>
>
> Detailed changelog
> ===
>
> ## 2.00.2
>
> ### DAL Improvements
>
> - Support for DAL(lazy_tables=True) and db.define_table(on_define=lambda 
> table:), thanks Jonathan
> - db(...).select(cacheable=True) make select 30% faster
> - db(...).select(cache=(cache.ram,3600)) now caches parsed data 100x faster
> - db(...).count(cache=(cache.ram,3600)) now supported
> - MongoDB support in DAL (experimental), thanks Mark Breedveld
> - geodal and spatialite, thanks Denes and Fran (experimental)
> - db.mytable._before_insert, _after_insert, _before_update, _after_update, 
> _before_delete. _after_delete (list of callbacks)
> - db(...).update_naive(...) same as update but ignores 
> table._before_update and table._after_update
> - DAL BIGINT support and DAL(...,bigint_id=True)
> - IS_IN_DB(..., distinct=True)
> - new syntax: db.mytable.insert(myuploadfield=open()), thank you 
> Iceberg
> - db(...).select(db.mytable.myfield.count(distinct=True))
> - db(db.a)._update(name=db(db.b.a==db.a.id).nested_select(db.b.id))
> - db.mytable.myfield.filter_in, filter_out
> - db.mytable._enable_record_versioning(db) adds versioning to this table
> - teradata adapter, thanks Andrew Willimott
> - experimental Sybase Adapter
> - added db.table.field.avg()
> - Support for Google App Engine projections, thanks Christian
> - Field(... 'upload', default=path) now accepts a path to a local file as 
> default value, if user does not upload a file. Relative path looks inside 
> current application folder, thanks Marin
> - executesql(...,fields=,columns=) allows parsing of results in Rows, 
> thanks Anthony
>
> ### Auth improvements
>
> - auth.enable_record_versioning(db)  adds full versioning to all tables
> - @auth.requires_login(otherwise=URL(...))
> - auth supports salt and compatible with third party data, thanks Dave 
> Stoll
> - CRYPT now defaults to pbkdf2(1000,20,sha1)
> - Built-in wiki with menu, tags, search, media, permissions. def index: 
> return auth.wiki()
> - auth.settings.everybody_group_id
> - allow storage of uploads on any PyFileSystem (including amazon)
>
> ### Form improvements
>
> - FORM.confirm('Are you sure?',{'Back':URL(...)})
> - SQLFORM.smartdictform(dict)
> - form.add_button(value,link)
> - SQLFORM.grid(groupby='...')
> - fixed security issue with SQLFORM.grid and SQLFORM.smartgrid
> - more export options in SQLFORM.grid and SQLFORM.smartgrid (html, xml, 
> csv, ...)
>
> ### Admin improvements
>
> - new admin pages: manage_students, bulk_regsiter, and progress reports
> - increased security in admin against CSRF
> - experimental Git integration
> - experimental OpenShift deployment
> - multi-language pluralization engine 
> - ace text web editor in admin
> - Ukrainian translations, thanks Vladyslav Kozlovskyy
> - Romanian translation for welcome, thanks ionel
> - support for mercurial 2.6, thanks Vlad
>
> ### Scheduler Improvements (thanks to niphlod, ykessler, dhx, toomim)
>
> - web2py.py -K myapp -X starts the myapp scheduler alongside the webserver
> - tasks are marked EXPIRED (if stop_time passed)
> - functions with no result don't end up in scheduler_run
> - more options: web2py.py -E -b -L
> - scheduler can now handle 10k tasks with 20 concurrent workers and with 
> no issues
> - new params:
> tasks can be found in the environment (no need to define the tasks 
> parameter)
> max_empty_runs kills the workers automatically if no new tasks are 
> found in queue (nice for "spikes" of processing power)
> discard_results to completely discard the results (if you don'

[web2py] Re: Congratulations to Bruno and Mariano

2012-08-17 Thread Adi
Congratulations!

On Friday, August 17, 2012 10:13:45 AM UTC-4, Massimo Di Pierro wrote:
>
> Congratulations to Bruno Rocha and Mariano Reingart,
>
> New members of the Python Software Foundations.
>
> http://pyfound.blogspot.com.br/2012/08/welcome-new-psf-members.html
>
>
>

-- 





[web2py] Re: paymentech: post request

2012-07-08 Thread Adi
Thanks for the response. 

Even though I got this response: 412 Precondition Failed, the code bellow 
seems to work fine. Will check more tomorrow. 

import sys, httplib, urllib, urllib2
target = "https://orbitalvar1.paymentech.net/authorize:443";
HOST, API_URL = urllib2.splithost(urllib2.splittype(target)[1])
xml_request="proper security and order details..."

conn = httplib.HTTPS(HOST)
conn.putrequest('POST', API_URL)
conn.putheader("Content-Type", "application/PTI46")
conn.putheader("Content-transfer-encoding", "text")
conn.putheader("Document-type", "Request")
conn.putheader("Trace-number", "123456")
conn.putheader("MIME-Version", "1.0")
conn.endheaders()
conn.send(xml_request)
statuscode, statusmessage, header = conn.getreply()




On Sunday, July 8, 2012 2:52:14 PM UTC-4, howesc wrote:
>
> i've never used HTTP lib before, and i found "This module defines classes 
> which implement the client side of the HTTP and HTTPS protocols. It is 
> normally not used directly — the module 
> urllib<http://docs.python.org/library/urllib.html#module-urllib>uses it to 
> handle URLs that use HTTP and HTTPS." here 
> http://docs.python.org/library/httplib.html
>
> perhaps give urllib or urllib2 a try - i use those all the time with great 
> success!
>
> cfh
>
> On Friday, July 6, 2012 10:30:34 AM UTC-7, Adi wrote:
>>
>>
>> Could anyone please advise if I'm doing this correctly? I'm trying to 
>> post a request to Paymentech gateway. When I try the link in a browser, it 
>> responds fine (https://orbitalvar1.paymentech.net/authorize:443), but 
>> using post as bellow returns an error. Most likely I'm doing something 
>> wrong, but can't figure out what.
>>
>> Thanks,
>> Adnan
>>
>>
>> *CODE:*
>> import sys, httplib
>>
>> request = xml_string # "proper xml request..."
>>
>> HOST = "https://orbitalvar1.paymentech.net/authorize:443";
>> # tried without https as well: HOST = "
>> orbitalvar1.paymentech.net/authorize:443"
>> webservice = httplib.HTTPS(HOST)
>> webservice.putrequest("POST", '')
>> webservice.putheader("Host", HOST)
>> webservice.putheader("User-Agent","Python post")
>> webservice.putheader("Content-Type", "application/PTI46")
>> webservice.putheader("Content-transfer-encoding", "text")
>> webservice.putheader("Content-length", "%d" % len(request))
>> webservice.endheaders()
>> webservice.send(request)
>> statuscode, statusmessage, header = webservice.getreply()
>> print statuscode, statusmessage, header
>>
>> *TRACEBACK:*
>> Traceback (most recent call last):
>>   File "/Users/adnan/web2py-dev-branch8/gluon/restricted.py", line 205, 
>> in restricted
>> exec ccode in environment
>>   File 
>> "/Users/adnan/web2py-dev-branch8/applications/dev_thanemobile/controllers/default.py",
>>  
>> line 898, in 
>>   File "/Users/adnan/web2py-dev-branch8/gluon/globals.py", line 173, in 
>> 
>> self._caller = lambda f: f()
>>   File 
>> "/Users/adnan/web2py-dev-branch8/applications/dev_thanemobile/controllers/default.py",
>>  
>> line 43, in test_pmt
>> paymentech.do_request(xml_string)
>>   File "applications/dev_thanemobile/modules/paymentech.py", line 46, in 
>> do_request
>> webservice.endheaders()
>>   File 
>> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py",
>>  
>> line 937, in endheaders
>>   File 
>> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py",
>>  
>> line 797, in _send_output
>>   File 
>> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py",
>>  
>> line 759, in send
>>   File 
>> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py",
>>  
>> line 1140, in connect
>>   File 
>> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py",
>>  
>> line 553, in create_connection
>> *gaierror: [Errno 8] nodename nor servname provided, or not known*
>>
>>

[web2py] paymentech: post request

2012-07-06 Thread Adi

Could anyone please advise if I'm doing this correctly? I'm trying to post 
a request to Paymentech gateway. When I try the link in a browser, it 
responds fine (https://orbitalvar1.paymentech.net/authorize:443), but using 
post as bellow returns an error. Most likely I'm doing something wrong, but 
can't figure out what.

Thanks,
Adnan


*CODE:*
import sys, httplib

request = xml_string # "proper xml request..."

HOST = "https://orbitalvar1.paymentech.net/authorize:443";
# tried without https as well: HOST = 
"orbitalvar1.paymentech.net/authorize:443"
webservice = httplib.HTTPS(HOST)
webservice.putrequest("POST", '')
webservice.putheader("Host", HOST)
webservice.putheader("User-Agent","Python post")
webservice.putheader("Content-Type", "application/PTI46")
webservice.putheader("Content-transfer-encoding", "text")
webservice.putheader("Content-length", "%d" % len(request))
webservice.endheaders()
webservice.send(request)
statuscode, statusmessage, header = webservice.getreply()
print statuscode, statusmessage, header

*TRACEBACK:*
Traceback (most recent call last):
  File "/Users/adnan/web2py-dev-branch8/gluon/restricted.py", line 205, in 
restricted
exec ccode in environment
  File 
"/Users/adnan/web2py-dev-branch8/applications/dev_thanemobile/controllers/default.py",
 
line 898, in 
  File "/Users/adnan/web2py-dev-branch8/gluon/globals.py", line 173, in 

self._caller = lambda f: f()
  File 
"/Users/adnan/web2py-dev-branch8/applications/dev_thanemobile/controllers/default.py",
 
line 43, in test_pmt
paymentech.do_request(xml_string)
  File "applications/dev_thanemobile/modules/paymentech.py", line 46, in 
do_request
webservice.endheaders()
  File 
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py",
 
line 937, in endheaders
  File 
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py",
 
line 797, in _send_output
  File 
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py",
 
line 759, in send
  File 
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py",
 
line 1140, in connect
  File 
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py",
 
line 553, in create_connection
*gaierror: [Errno 8] nodename nor servname provided, or not known*



[web2py] Re: GrooverWiki seems to be broken

2012-05-30 Thread Adi
thanks Massimo for this tip... 

I used the blob field to store AES encrypted Credit Card, and everything 
worked fine to store it but when I was reading records from the table I was 
getting this error: 
File 
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/base64.py",
 
line 76, in b64decode
TypeError: Incorrect padding

Once I changed the field from blob to text the problem went away... 


On Wednesday, September 21, 2011 1:21:38 PM UTC-4, Massimo Di Pierro wrote:
>
> I suspect you store something into a text field than changed the type 
> to blob. web2py expects blob data to be store b64encoded. If it was 
> stored when the field was a text, it was not encoded. 
>
> On Sep 21, 11:12 am, Guy Nesher  wrote: 
> > sqlite, is that an issue ? 
> > 
> > On Sep 21, 4:55 pm, Massimo Di Pierro  
> > wrote: 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > > which db server? 
> > 
> > > On Sep 21, 7:19 am, Guy Nesher  wrote: 
> > 
> > > > Just tried to do a fresh install of GrooverWiki, the install works 
> > > > fine but when I try to run it I get the following error : 
> > 
> > > > Traceback (most recent call last): 
> > > >   File "/var/web2py/gluon/restricted.py", line 192, in restricted 
> > > > exec ccode in environment 
> > > >   File "/var/web2py/applications/wiki/controllers/default.py", line 
> > > > 148, in  
> > > >   File "/var/web2py/gluon/globals.py", line 145, in  
> > > > self._caller = lambda f: f() 
> > > >   File "/var/web2py/applications/wiki/controllers/default.py", line 
> > > > 11, in show_page 
> > > > curr_page=db().select(db.WikiPage.ALL)[0] 
> > > >   File "/var/web2py/gluon/dal.py", line 5481, in select 
> > > > return self.db._adapter.select(self.query,fields,attributes) 
> > > >   File "/var/web2py/gluon/dal.py", line 1192, in select 
> > > > return self.parse(rows,self._colnames) 
> > > >   File "/var/web2py/gluon/dal.py", line 1421, in parse 
> > > > colset[fieldname] = base64.b64decode(str(value)) 
> > > >   File "/usr/lib/python2.6/base64.py", line 76, in b64decode 
> > > > raise TypeError(msg) 
> > > > TypeError: Incorrect padding 
> > 
> > > > I'm sure its something really silly, but I just can't figure what.



Re: [web2py] web2py recipe book

2012-03-13 Thread Adi
just ordered from packt :) 

On Monday, March 12, 2012 6:55:03 PM UTC-4, rochacbruno wrote:
>
> On Mon, Mar 12, 2012 at 12:10 PM, Bruce Wade  wrote:
>
>> The other book would be version 4 of the official manual. Bought it 
>> because I didn't think it would be free online until much later.
>
>
> The official manual online version is available in HTML for free since the 
> version 1.0, the PDF and PaperBack is released under a fee. That is the way 
> it works since the beginning, you only have to pay for a book if you are 
> not satisfied with HTML version, and if you want to have it on mobile 
> reader or in physical paper.
>
> Another reason to buy is that it is a way to thank Massimo for the free 
> and excellent work he does developing, answering questions and documenting 
> web2py since the beginning and also help him to buy some pots of caffeine, 
> so he can be always awake answering our questions and fixing bugs :)
>
> If you see some PDF or digital version for free, so it is piracy, and 
> there is nothing we can do to stop this, even this new cookbook may become 
> available on download sites for free.
>
> In my point of view, buying books on amazon, packt or another bookstore is 
> also good for web2py advertisement, publishers will ask us all to write 
> more books and web2py will be more visible!
>
> If I have enjoyed an open source software and also if I get some money 
> working with an open source software. I always consider giving donations, 
> paying for beers and coffees and buying some related stuff.
>
>
> -- 
>
> Bruno Rocha
> [http://rochacbruno.com.br]
>
>

[web2py] Re: Daemon process called 'web2py' cannot be accessed by this WSGI application: /home/www-data/web2py/wsgihandler.py

2012-02-24 Thread Adi
feel horribly stupid for unnecessary post again, yet happy for getting it 
to work... 

rebooted a box, and all works perfectly fine... 

sorry... 

On Friday, February 24, 2012 2:53:13 PM UTC-5, Adi wrote:
>
> I deployed functional application on Ubuntu 11.04 x64, and everything 
> worked fine, including SSL (admin), until I did "do-release-upgrade". 
>
> https stopped working and I found following Apache error:
> Daemon process called 'web2py' cannot be accessed by this WSGI 
> application: /home/www-data/web2py/wsgihandler.py
>
> Could it be due to compiling mod_wsg with Python 2.7? I'm just learning 
> the environment, plus python/w2p. Any advice or suggestion, how to roll it 
> back, or what to look for?
>
> no error:
> Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41) 
> [GCC 4.4.3] on linux2
>
> https error:
> Python 2.7.2+ (default, Oct  4 2011, 20:06:09) 
> [GCC 4.6.1] on linux2
>
> Thanks,
> Adnan
>

On Friday, February 24, 2012 2:53:13 PM UTC-5, Adi wrote:
>
> I deployed functional application on Ubuntu 11.04 x64, and everything 
> worked fine, including SSL (admin), until I did "do-release-upgrade". 
>
> https stopped working and I found following Apache error:
> Daemon process called 'web2py' cannot be accessed by this WSGI 
> application: /home/www-data/web2py/wsgihandler.py
>
> Could it be due to compiling mod_wsg with Python 2.7? I'm just learning 
> the environment, plus python/w2p. Any advice or suggestion, how to roll it 
> back, or what to look for?
>
> no error:
> Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41) 
> [GCC 4.4.3] on linux2
>
> https error:
> Python 2.7.2+ (default, Oct  4 2011, 20:06:09) 
> [GCC 4.6.1] on linux2
>
> Thanks,
> Adnan
>



[web2py] Daemon process called 'web2py' cannot be accessed by this WSGI application: /home/www-data/web2py/wsgihandler.py

2012-02-24 Thread Adi
I deployed functional application on Ubuntu 11.04 x64, and everything 
worked fine, including SSL (admin), until I did "do-release-upgrade". 

https stopped working and I found following Apache error:
Daemon process called 'web2py' cannot be accessed by this WSGI application: 
/home/www-data/web2py/wsgihandler.py

Could it be due to compiling mod_wsg with Python 2.7? I'm just learning the 
environment, plus python/w2p. Any advice or suggestion, how to roll it 
back, or what to look for?

no error:
Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41) 
[GCC 4.4.3] on linux2

https error:
Python 2.7.2+ (default, Oct  4 2011, 20:06:09) 
[GCC 4.6.1] on linux2

Thanks,
Adnan


[web2py] Re: OFF Topic - Business inteligence in Python, web2py?

2012-02-15 Thread Adi
QlikView is not written in python, but I see they talk about integration on 
their community pages: 
http://community.qlikview.com/community/development?view=tags&tags=python




[web2py] Re: * DATE FIELDS REPRESENT *

2012-02-15 Thread Adi
If you included a translation, as you did, it will cover the form as 
well... so you won't have to worry about anything... 

not sure if you need to remove "represent" now, in order to get it 
working..?


[web2py] Re: * DATE FIELDS REPRESENT *

2012-02-14 Thread Adi
you can enforce the date format through the language... 

this is how I use it, and I think there is a thread where Massimo explained 
it before 

in my db.py:

T.force('en-aa')


in en-aa.py:

%Y-%m-%d translate to %b %d, %Y


and all dates became a new format, display and input fields as well... 
 


[web2py] Re: option to move smartgrid buttons to the left side

2012-02-09 Thread Adi
Thanks Peter... still looking, and tried even some other applications, with 
original css, but didn't manage to scroll horizontally. If anyone has any 
ideas, please share :) 

Having an option to have buttons either on the left or right side, was just 
a suggestion... Our Customer Service and Call Center agents move quickly 
from order to order, and need many fields (name, phone #, several dates, 
etc) up front in smartgrid, so buttons get pushed into the scrolling area. 
It would help having them on the left, but there are other bigger things to 
finalize now :) What's impressive is how much can be accomplished through 
grid and smartgrid. Fantastic core component of the framework! 

Anyway, thanks for your help.

Adi


[web2py] Re: option to move smartgrid buttons to the left side

2012-02-09 Thread Adi
Hi Peter... 

I put a simple smartgrid together, with a longer text field... so this one 
doesn't scroll horizontally for me. I'm not sure if it's something that we 
did on css or somewhere, but i noticed it worked on ipad as it should... 

here is the link: 
http://w2p.thanedev.com/test2/test/test/test1

Thanks,
Adnan


  1   2   3   >