[web2py] Re: Database insert of time field in web2py not working?

2013-11-12 Thread User
So since a time field automatically has an IS_TIME validator how would you 
specify additional validators after the db.define_table statement?

On Tuesday, November 12, 2013 3:51:12 AM UTC-5, Niphlod wrote:
>
> requires can be a list of validators.
>
> On Tuesday, November 12, 2013 9:32:27 AM UTC+1, User wrote:
>>
>> Just realized I added the following lines after my db.define_table 
>> statement:
>>  
>> db.sometable.start_time.notnull = True
>> db.sometable.start_time.requires = IS_NOT_EMPTY()
>>
>>  
>> I'm thinking that my assignment of IS_NOT_EMPTY() overwrote the default 
>> IS_TIME() validator associated with time fields.  Does this sound like what 
>> the problem is?  If so, how do I get around it?
>>
>> On Tuesday, November 12, 2013 3:24:36 AM UTC-5, User wrote:
>>
>>> I have some code that was working before but I can't quite pinpoint why 
>>> it's not working now.  In any case it's a time field in a table and when I 
>>> insert into this field the database shows '00:00:00' in the field (by 
>>> looking at the record in an SQLite admin tool)
>>>
>>> Field('start_time','time', default='2:00PM'),
>>>
>>> I have a form where this value is inserted along with other form 
>>> values.  The insert statement looks like:
>>>
>>>  form.vars.id = db.sometable.insert(**db.sometable._filter_fields(form.
>>> vars))
>>>
>>>  
>>> I have inspected form.vars in the debugger immediately before this 
>>> statement is executed and I can see form.vars.start_time has a string value 
>>> such as '3:00PM'.  The insert statement executes with no error and the 
>>> record is inserted in the database but the time field shows as 
>>> 00:00:00. This further causes an error when trying to view the database 
>>> record from web2py:
>>>  
>>> ValueError: invalid literal for int() with base 10: '00PM'
>>>  
>>>  
>>> Any idea why the time is not inserting properly and how to fix it? Is 
>>> the time string in the wrong format?
>>>
>>>

-- 
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] rocket, windows server, bad file descriptor error due to gluon debug message

2013-11-12 Thread Tim Richardson
 Rocket running as a windows service possibly doesn't like attempts to 
write to stderr. 


Traceback (most recent call last):
  File "d:\web2py_internet\gluon\restricted.py", line 217, in restricted
exec ccode in environment
  File "d:/web2py_internet/applications/patient_form/models/db.py" 
, line 
132, in 
db_ps_1BE = DAL('xxx', lazy_tables=True, pool_size=10, attempts=20)
  File "d:\web2py_internet\gluon\dal.py", line 7537, in __init__
sys.stderr.write('DEBUG: connect attempt %i, connection error:\n%s' % (k, 
tb))
IOError: [Errno 9] Bad file descriptor

-- 
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: mssql connection

2013-11-12 Thread Cacpacific O
Hello Tim,

Thank you for sharing.
I've try as your advice but it still return error message as follow, I 
think something wrong with my odbc setup somehow.

:)

db = DAL('mssql://UserName:Password@203.150.29.227\SQLExpress/myDatabase', 
lazy_tables=True, pool_size=10)

RuntimeError: Failure to connect, tried 5 times:

Traceback (most recent call last):

 File "/home/www-data/web2py/gluon/dal.py", line 7562, in __init__

   self._adapter = ADAPTERS[self._dbname](**kwargs)

 File "/home/www-data/web2py/gluon/dal.py", line 3279, in __init__

   if do_connect: self.reconnect()

 File "/home/www-data/web2py/gluon/dal.py", line 627, in reconnect

   self.connection = f()

 File "/home/www-data/web2py/gluon/dal.py", line 3277, in connector

   return self.driver.connect(cnxn,**driver_args)

Error: ('IM002', '[IM002] [unixODBC][Driver Manager]Data source name not 
found, and no default driver specified (0) (SQLDriverConnect)')




On Wednesday, November 13, 2013 5:27:55 AM UTC+7, Tim Richardson wrote:
>
> Here is a working example using server authentication on a server called 
> win2003, with a sqlserver instance name hcnsql07 and connecting to a 
> database called hcn using default ports
>
> (I've added a couple of other parameters for performance.
>  Investigate lazy_tables, it makes a huge difference. )
>
>
> db_ps_1TE = DAL('mssql://tim:password@win2003\hcnsql07/hcn', 
> lazy_tables=True, pool_size=10)
>
> On Monday, 11 November 2013 07:10:43 UTC+11, Ariya Owam-aram wrote:
>>
>> Dear all,
>>
>> I have to connect mssql database which is locate on  another server by 
>> using pyodbc.
>>
>> It working if connect by using 
>>
>> pyodbc.connect(DNS=dns;UID=user_name;PWD=password)
>>> 
>>>
>>
>> But I can't connect with  DAL()
>>
>> db = 
>>> DAL("mssql://userName:passw...@203.xxx.xx.xxx\SQLExpress,1433/myDatabase")
>>
>>
>> return error as follow
>>
>>> Error: ('IM002', '[IM002] [unixODBC][Driver Manager]Data source name 
>>> not found, and no default driver specified (0) (SQLDriverConnect)')
>>
>>
>> As searching from web2py google group, I also try:
>>
>> db = 
>>> DAL("mssql://userName:passw...@203.xxx.xx.xxx\SQLExpress,1433/myDatabase?Driver={FreeTDS}")
>>
>>
>> return error as follow
>>
>> Error: ('08001', '[08001] [unixODBC][FreeTDS][SQL Server]Unable to 
>> connect to data source (0) (SQLDriverConnect)')
>>
>> ---
>> in my /etc/odbc.ini
>>
>> [TS]
>>> Description="ODBC Connection via FreeTDS"
>>> Driver=FreeTDS
>>> Server=203.xxx.xx.xxx
>>> port=1433
>>> Database=myDatabase
>>
>> ---
>> in my /etc/odbcinst.ini
>>
>>> [FreeTDS]
>>> Description=FreeTDS
>>> Driver=/usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so
>>> Setup=/usr/lib/x86_64-linux-gnu/odbc/libtdsS.so
>>
>> ---
>> in my /etc/freetds/freetds.conf
>>
>> ### Did not change anything ###
>>
>> ---
>> in my /etc/freetds/tds.driver.template  
>>
>>> [TDS]
>>> Description = FreeTDS Driver for Linux & MSSQL on Win32
>>> Driver  = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so
>>> Setup   = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so
>>
>> ---
>> in my /etc/freetds/tds.dsn.template
>>
>> [DSN_NAME]
>>
>>> Description = Descripton of you DSN connection.
>>> Driver  = TDS
>>> Trace   = No
>>> Database= myDatabase
>>> Server  = 203.xxx.xx.xxx
>>> Port= 1433
>>> TDS_Version = 8.0
>>
>>
>>
>>
>> Thank you very much
>> Ariya
>>
>>

-- 
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] SQLFORM.grid to view and using groupby clause

2013-11-12 Thread Meir

Hello,

I have the following problem: I have created a view in the legacy database.
In this view created a field ID of type integer and unique.

I used SQLFORM.grid using fields = [...] to specify the fields that wanted 
and used the groupby = ... to perform clustering.
But it returns an error stating that the database must specify the ID in 
the group by clause 
Do not understand the reason for the error. If I put the ID in the groupby 
clause SQLFORM.grid, there does not generate the error, but my grid is not 
grouped because the ID is unique  :/

Anyone have any ideas?

-- 
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] compute and after_insert callback on table

2013-11-12 Thread 黄祥
hi,

is the compute can work together with after_insert on table?
i've tried before but return an error, and must do separately.
e.g. 
*error*
def __after_insert(f, id):
db(db.dvd.id == f.dvd).update(quantity = db.dvd(f.dvd).quantity - 
f.quantity)

def on_define_rent_detail(table): 
table._after_insert.append(__after_insert)
table.total_price.compute = lambda r: r['quantity'] * r['price']

if i want to make it work i must do separetely, e.g. put the after insert 
function on controller, or put the compute function during insert table on 
controller.
is it possible to make compute and after_insert callback work together on 
table?

best regards,
stifan

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


[web2py] Re: Scheduler TIMEOUT

2013-11-12 Thread Limedrop
I've had this problem too.  I think it would be good if the scheduler had 
the option to retry timeouts, in the same way that retry_failed works.

-- 
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: CSS Fluid Layout for Window Resize

2013-11-12 Thread EW
perfect, thanks!

On Tuesday, November 12, 2013 1:26:50 PM UTC-8, Niphlod wrote:

> the scaffolding application (welcome) comes with bootstrap.
> As a default, it uses the "default grid system". If you want to use 
> bootstrap's "fluid grid system" change all 
>
> 
>
>  to
>  
>
> 
>
> and 
>
> 
>
>
> to
>
> 
>
>
>  in views/layout.html and you'll be good to go.
>
>

-- 
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: mssql connection

2013-11-12 Thread Tim Richardson
Here is a working example using server authentication on a server called 
win2003, with a sqlserver instance name hcnsql07 and connecting to a 
database called hcn using default ports

(I've added a couple of other parameters for performance.
 Investigate lazy_tables, it makes a huge difference. )


db_ps_1TE = DAL('mssql://tim:password@win2003\hcnsql07/hcn', 
lazy_tables=True, pool_size=10)

On Monday, 11 November 2013 07:10:43 UTC+11, Ariya Owam-aram wrote:
>
> Dear all,
>
> I have to connect mssql database which is locate on  another server by 
> using pyodbc.
>
> It working if connect by using 
>
> pyodbc.connect(DNS=dns;UID=user_name;PWD=password)
>> 
>>
>
> But I can't connect with  DAL()
>
> db = 
>> DAL("mssql://userName:passw...@203.xxx.xx.xxx\SQLExpress,1433/myDatabase")
>
>
> return error as follow
>
>> Error: ('IM002', '[IM002] [unixODBC][Driver Manager]Data source name not 
>> found, and no default driver specified (0) (SQLDriverConnect)')
>
>
> As searching from web2py google group, I also try:
>
> db = 
>> DAL("mssql://userName:passw...@203.xxx.xx.xxx\SQLExpress,1433/myDatabase?Driver={FreeTDS}")
>
>
> return error as follow
>
> Error: ('08001', '[08001] [unixODBC][FreeTDS][SQL Server]Unable to connect 
> to data source (0) (SQLDriverConnect)')
>
> ---
> in my /etc/odbc.ini
>
> [TS]
>> Description="ODBC Connection via FreeTDS"
>> Driver=FreeTDS
>> Server=203.xxx.xx.xxx
>> port=1433
>> Database=myDatabase
>
> ---
> in my /etc/odbcinst.ini
>
>> [FreeTDS]
>> Description=FreeTDS
>> Driver=/usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so
>> Setup=/usr/lib/x86_64-linux-gnu/odbc/libtdsS.so
>
> ---
> in my /etc/freetds/freetds.conf
>
> ### Did not change anything ###
>
> ---
> in my /etc/freetds/tds.driver.template  
>
>> [TDS]
>> Description = FreeTDS Driver for Linux & MSSQL on Win32
>> Driver  = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so
>> Setup   = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so
>
> ---
> in my /etc/freetds/tds.dsn.template
>
> [DSN_NAME]
>
>> Description = Descripton of you DSN connection.
>> Driver  = TDS
>> Trace   = No
>> Database= myDatabase
>> Server  = 203.xxx.xx.xxx
>> Port= 1433
>> TDS_Version = 8.0
>
>
>
>
> Thank you very much
> Ariya
>
>

-- 
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: Scheduler TIMEOUT

2013-11-12 Thread LightOfMooN
I don't want worker without timeout. I just want scheduler task not to be 
stopped because of timeout from one of thousands records. Why scheduler 
doesn't execute tasks with status=='TIMEOUT'?

I have some function like:

thing = db.executesql(db(db.things.id>0)._select(..., 
orderby=db.things.up_date))[0]
try:
get url, parse, ...
db.executesql(db(db.things.id==thing[0])._update(availability=True, 
up_date=request.now))
except:
db.executesql(db(db.things.id==thing[0])._update(availability=False, 
up_date=request.now))

And one wrong URL or 404 break all update system because of timeout, which 
stops all task.

среда, 13 ноября 2013 г., 1:48:44 UTC+6 пользователь Niphlod написал:
>
> with no timeout, your worker will try to fetch the site, and if your task 
> never returns, it won't process any new task and will remain stuck.
>
> How is it better to have a worker blocked because there is no timeout ?
>
> tl;dr : you won't find any serious task processor without a timeout, 
> because it's a really bad design decision.
>
>

-- 
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] styleform text size change

2013-11-12 Thread Richard Vézina
So you have to silent bootstrap.css and put your style in your own css
file, app.css for instance. You don't want to put you own css hack in
base.css, because you have to update this file sometime when you upgrade
web2py. To silent bootstrap you have to redefine the boostrap style that
matter or just override it it depends of the situation.

You can combine class and id in your css selector to make sure you select
the exact item you want and only this one to not break you app somewhere
else.

Setting style attribute help to go fast, but it's not consider a good
practice and you may sometime forget that you set style attribute in you
view and search for hours why the them tag won't style the way to tell him
in you css file.

:)


Richard


On Tue, Nov 12, 2013 at 4:17 PM, greenpoise  wrote:

> bootstrap.min.css
>
> if I add it there it works.
>
>
> On Tuesday, November 12, 2013 1:05:11 PM UTC-8, Richard wrote:
>
>> You may have other css rules that override yours... Try to set a style
>> attribute to your input to see what happen, if it works it because there is
>> other css rules that override your... Try to find it, you can use Chrome
>> dev tool, right click on the html thing and select inspect item in the
>> menu, you will see all the styles that apply to your input...
>>
>> Rember, the css rule closest to the html tag has priority over all
>> other...
>>
>> Richard
>>
>>
>> On Tue, Nov 12, 2013 at 3:35 PM, greenpoise  wrote:
>>
>>> I keep reading to do it from base.css but it is not working.
>>>
>>>
>>> My source
>>>
>>> 
>>>
>>>  >> "qty" type="text" value="" />
>>>
>>>
>>> On base.css I have
>>>
>>> #productsearch_qty {width: 3px;}
>>>
>>>
>>>  --
>>> 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.
>

-- 
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: CSS Fluid Layout for Window Resize

2013-11-12 Thread Niphlod
the scaffolding application (welcome) comes with bootstrap.
As a default, it uses the "default grid system". If you want to use 
bootstrap's "fluid grid system" change all 



 to
 



and 




to




 in views/layout.html and you'll be good to go.

-- 
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] styleform text size change

2013-11-12 Thread greenpoise
bootstrap.min.css

if I add it there it works.

On Tuesday, November 12, 2013 1:05:11 PM UTC-8, Richard wrote:
>
> You may have other css rules that override yours... Try to set a style 
> attribute to your input to see what happen, if it works it because there is 
> other css rules that override your... Try to find it, you can use Chrome 
> dev tool, right click on the html thing and select inspect item in the 
> menu, you will see all the styles that apply to your input...
>
> Rember, the css rule closest to the html tag has priority over all other...
>
> Richard
>
>
> On Tue, Nov 12, 2013 at 3:35 PM, greenpoise 
> > wrote:
>
>> I keep reading to do it from base.css but it is not working.
>>
>>
>> My source
>>
>> 
>>  
>>  > "qty" type="text" value="" />
>>
>>
>> On base.css I have
>>
>> #productsearch_qty {width: 3px;}
>>
>>
>>  -- 
>> 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.


Re: [web2py] styleform text size change

2013-11-12 Thread Richard Vézina
You may have other css rules that override yours... Try to set a style
attribute to your input to see what happen, if it works it because there is
other css rules that override your... Try to find it, you can use Chrome
dev tool, right click on the html thing and select inspect item in the
menu, you will see all the styles that apply to your input...

Rember, the css rule closest to the html tag has priority over all other...

Richard


On Tue, Nov 12, 2013 at 3:35 PM, greenpoise  wrote:

> I keep reading to do it from base.css but it is not working.
>
>
> My source
>
> 
>
>   "qty" type="text" value="" />
>
>
> On base.css I have
>
> #productsearch_qty {width: 3px;}
>
>
>  --
> 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.
>

-- 
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] styleform text size change

2013-11-12 Thread greenpoise
I keep reading to do it from base.css but it is not working.


My source


 
 


On base.css I have

#productsearch_qty {width: 3px;}


-- 
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: web2py "Components" for layout.html and other HTML pages [ not derived from layout.html]

2013-11-12 Thread JoeCodeswell
Dear Niphlod,

Thanks for the detailed response.

You said:

Yep, ajax is fun but having a page with 64 ...
>

Right, Niphlod. I am agnostic on implementing modular Component with Ajax. 
Please see my previous post 
herein which i 
say:

As far as I am concerned, as long as Components provide *modularity*, they 
> can use Ajax or NOT as a matter of performance choice. 
>

I just want to modularize GUI entities and the code that supports them at a 
more granular level.

Thanks again, Niphlod.

Love and peace,

Joe

On Tuesday, November 12, 2013 11:44:21 AM UTC-8, Niphlod wrote:
>
> -1 for yet another complication on the scaffolding app.
>
> @Joe: web2py has several ways to accomplish what you want, but all of them 
> come with a cost (as anything else called "feature" in every framework of 
> every programming language). There isn't a silver bullet that goes well 
> with all kinds of "business requirements". Yep, ajax is fun but having a 
> page with 64 'loading...' fragments is not going to be a nice page both 
> from the user perspective and for your server, that needs to "reply" 64 
> times instead of just one to build the page.
> Same thing goes for web2py having to dinamically figure out 64 "fragments" 
> and compile them every time a user hits the page.
> On the other end, you may find that your site needs a "modularized" 
> approach only on some pages, and nothing in web2py prevents you to have 
> different layout.html written as you wish, called as you like.
> On the argument of having scripts, css and such inserted dynamically in 
> fragments only when they're needed...unless you have 1MB of gzipped css and 
> js.it's really not a valid argument. 
> Just include all of them on the "index" page, and if cached correctly only 
> the first page will be slowed down (maybe for 200ms ?!) . All subsequent 
> fragments will not have to deal with them, as they are fetched from the 
> browser's cache.
>
>

-- 
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] CSS Fluid Layout for Window Resize

2013-11-12 Thread EW
I would like to have my layout (divs) resize if the user resizes the web 
browser.  I already switched the CSS of my divs to percentages, but it's 
not working.  It seems to me that I need to change some part of the default 
layout but I'm lost as to what that is (couldn't find anything that looked 
relevant in web2py.css).  I'm not using a left or right sidebar, so all of 
my content is in the middle...I suppose in  as seen in layout.html.
 
I'm new to CSS and unfamiliar with the web2py default layout.  Could 
someone please give me a pointer to which parts I need to change so that 
things will resize with the browser window?
 
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/groups/opt_out.


Re: [web2py] Re: Web2py crash if i define model with function

2013-11-12 Thread Diogo Munaro
Hey Michele!

Now it's working... The indexes are crashing web2py on apache.

With a list of indexes I can execute sql in a for:

for i in indices:
try:
db.executesql(i)
except:pass

Thx for all help!


2013/11/12 Diogo Munaro 

> It's not working...
>
> 1- I tried pool_size with n = 2, 3, 6;
> 2- apache with prefork
>
> I just need to restart apache once a time when de database is created.
> It's really strange... but works...
>
>
> 2013/11/12 Michele Comitini 
>
>> Seem a threading issue.
>> Try :
>>  1) pass a pool_size=n option with different values of n
>>  2) use preforking instead of threading in apache configuration
>>
>>
>>
>>
>> 2013/11/12 Diogo Munaro 
>>
>>> Yes, thanks Michele!
>>>
>>> Omg, I was using web2py with apache. With the same code and using rocket
>>> server no errors occurs and the databases was created.
>>>
>>> I configured apache with web2py script. Someone knows whats happen?
>>>
>>> Anyway, now I can configure database with rocket than manage with
>>> apache. It's working now!
>>>
>>> I think some index makes apache/mysql crazy and returned this error:
>>>
>>>
>>>
>>> 1.
>>> 2.
>>> 3.
>>> 4.
>>> 5.
>>> 6.
>>> 7.
>>> 8.
>>> 9.
>>> 10.
>>> 11.
>>>
>>>
>>>
>>> Traceback (most recent call last):
>>>   File "/var/www/sistema/gluon/main.py", line 550, in wsgibase
>>>
>>>
>>>
>>>
>>>
>>> BaseAdapter.close_all_instances('rollback')
>>>   File "/var/www/sistema/gluon/dal.py", line 558, in close_all_instances
>>>
>>>
>>>
>>>
>>>
>>> db._adapter.close(action)
>>>   File "/var/www/sistema/gluon/dal.py", line 538, in close
>>>
>>>
>>>
>>>
>>>
>>> getattr(self, action)()
>>>   File "/var/www/sistema/gluon/dal.py", line 1789, in rollback
>>>
>>>
>>>
>>>
>>>
>>> return self.connection.rollback()
>>> ProgrammingError: (2014, "Commands out of sync; you can't run this command 
>>> now")
>>>
>>>  Thanks Michele, if I have some news I'll post here. I'll try using
>>> commits at each index creation.
>>>
>>> Em 12/11/2013 07:33, "Michele Comitini" 
>>> escreveu:
>>>
>>>  The error you sent seems to point to some statement that has not been
 properly closed.  The commit/rollback happens in the middle of an open
 statement?  That is what mysql seems to say.  The problem could be earlier
 than when the error raises.

 Hard to say where. You could try to force db.commit/rollback in
 different places to see where you start see errors.



 2013/11/12 Diogo Munaro 

> The error continues, but without index :(
>
> The indexes are successful created
>
>
> 2013/11/11 Michele Comitini 
>
>> What happens if you remove the index creation inside the try/except
>> block?
>>
>>
>> 2013/11/11 Diogo Munaro 
>>
>>> It's not a simple function, but putting the model definition inside
>>> the function.
>>>
>>> Here the code: http://pastebin.com/rN7gvAT8
>>>
>>> Attached the error ticket
>>>
>>>
>>> Em segunda-feira, 11 de novembro de 2013 08h34min44s UTC-2, Michele
>>> Comitini escreveu:
>>>
 If you define a function like
 def f():
   pass

 in a model, you should have no problems.
 Just show us an extract of code that causes the problem, without
 violating any reserved information or IP.
 That way we can help you...

 mic


 Il giorno lunedì 11 novembre 2013 10:43:49 UTC+1, Diogo Munaro ha
 scritto:
>
> Hi guys, first the problem:
>
> I need some databases with identical structure, but with different
> data. These databases must be stored with the clients because they 
> want
> (different locations), but the auth system is unique.
>
> So, my structure by now is: a centralized auth system and some
> disyributed databases. The centralized system controls access to other
> databases.
>
> Teoricaly web2py works great with it, because I defined a function
> that I pass connection string, access control db and its made a lot of
> databases replicas with foreign keys to access control database.
>
> Without the function it works great, but with, it make a complete
> first client database and then crash all of web2py. It returns a 
> ciclic
> ticket error when I try access any application of that web2py, either
> Welcome application.
>
> Im using web2py 2.7.4 with mysql on ubuntu. So, whats happening? I
> cant define model with function. Oh, my function is in the same model 
> file.
>
> BR, Diogo
>
  --
>>> Resources:
>>> - http://web2py.com
>>> - http://web2py.com/book (Documentation)
>>> - http://github.com/web2py/web2py (Source code)
>>> - https://code.google.com/p/web2py/issues/list (R

[web2py] Re: Scheduler TIMEOUT

2013-11-12 Thread Niphlod
with no timeout, your worker will try to fetch the site, and if your task 
never returns, it won't process any new task and will remain stuck.

How is it better to have a worker blocked because there is no timeout ?

tl;dr : you won't find any serious task processor without a timeout, 
because it's a really bad design decision.

-- 
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: web2py "Components" for layout.html and other HTML pages [ not derived from layout.html]

2013-11-12 Thread Niphlod
-1 for yet another complication on the scaffolding app.

@Joe: web2py has several ways to accomplish what you want, but all of them 
come with a cost (as anything else called "feature" in every framework of 
every programming language). There isn't a silver bullet that goes well 
with all kinds of "business requirements". Yep, ajax is fun but having a 
page with 64 'loading...' fragments is not going to be a nice page both 
from the user perspective and for your server, that needs to "reply" 64 
times instead of just one to build the page.
Same thing goes for web2py having to dinamically figure out 64 "fragments" 
and compile them every time a user hits the page.
On the other end, you may find that your site needs a "modularized" 
approach only on some pages, and nothing in web2py prevents you to have 
different layout.html written as you wish, called as you like.
On the argument of having scripts, css and such inserted dynamically in 
fragments only when they're needed...unless you have 1MB of gzipped css and 
js.it's really not a valid argument. 
Just include all of them on the "index" page, and if cached correctly only 
the first page will be slowed down (maybe for 200ms ?!) . All subsequent 
fragments will not have to deal with them, as they are fetched from the 
browser's cache.

-- 
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] SQLFORM update upload field - override 'file' anchor text

2013-11-12 Thread Jim S
I have a SQLFORM.grid on my page.  I have an upload field in the referenced 
table/query.  In edit mode on the SQLFORM.grid the upload field is 
displayed as a link with the text being 'file'.

Is there a way to override this text?

-Jim

-- 
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: Loop problem

2013-11-12 Thread Richard Vézina
Oups!

Thanks to clarify Niphold...

Richard


On Tue, Nov 12, 2013 at 2:31 PM, Niphlod  wrote:

> @richard: session.forget has nothing to do with forgetting the data is in
> the session. it is about forgetting to save it.
>
> @sonu: use a scoped var (i.e. session.yourvar = dict(all_that_is_needed))
> and then clear it with session.yourvar = None
>
>
> On Tuesday, November 12, 2013 8:16:01 PM UTC+1, Richard wrote:
>
>> Or you can just del(session.your_var)...
>>
>> Richard
>>
>>
>> On Tue, Nov 12, 2013 at 2:15 PM, Richard Vézina wrote:
>>
>>> session.forget(0) I am not sure search the book about it...
>>>
>>> :)
>>>
>>> Richard
>>>
>>>
>>> On Tue, Nov 12, 2013 at 1:42 PM, sonu kumar wrote:
>>>
 Thanks a lot.
 I have solved this problem.

 one more thing I would like to ask regarding cache and session.
 each time when I run my application it creates session and also I see
 last entered values on my form page. Is it possible to clean this after
 execution?

 Thanks


 On Tuesday, 12 November 2013 09:48:53 UTC-8, Richard wrote:

> Why not create a dict with the id of your data and update the key with
> the other data of the other table??
>
> Something like this :
>
> dict123 = {}
> for r in cleavage_res:
> dict123[r[0]]=[r[1:]]
>
> Then
>
> for r in thmmdata:
> dict123[r[0]].append(r[3])  # if position is not important
> # or
> # dict123[r[0]].insert(2, r[3])  # if postion is important
>
> Richard
>
>
> On Tue, Nov 12, 2013 at 12:06 PM, sonu kumar 
> wrote:
>
>> cleavage_res contains:
>> 10GSPAR-PRRLP
>>
>>
>>
>>
>>
>> 972.48117361.50 13ARPRR-LPLLS
>>
>>
>>
>>
>> 1381.73116952.25 18LPLLS-VLLLP
>>
>>
>>
>>
>> 1905.05116428.9323 VLLLP-LLGGT
>>
>>
>>
>>
>> 2440.41 115893.57
>>
>> thmmdata contains:
>>
>> 10
>>
>>
>>
>>
>> iiiMMM
>>
>> 13
>>
>>
>>
>>
>>
>> oo
>>
>> 18
>>
>>
>>
>>
>>
>> 
>>
>> 23
>>
>>
>>
>>
>>
>> MMM
>>
>>
>> now I would like to present all data in one table like this:
>>
>> 10GSPAR-PRRLP
>> iiiMMM
>>
>>
>>
>>
>> 972.48 117361.5013ARPRR-LPLLS
>> oo
>>
>>
>>
>> 1381.73 116952.2518LPLLS-VLLLP
>> 
>>
>>
>>
>> 1905.05 116428.9323VLLLP-LLGGT
>> MMM
>>
>>
>>
>> 2440.41 115893.57
>>
>>
>>
>>
>> On Monday, 11 November 2013 19:18:03 UTC-8, Leonel Câmara wrote:
>>>
>>> This is kind of impossible to answer without knowing what's in row
>>> or thmdata, It could be simply an error in your parser (you say the data
>>> comes from parsed files), and it's not getting all the results you were
>>> expecting.
>>>
>>> I suggest you use the debugger included with the framework to
>>> inspect the variables and see what's happening.
>>>
>>> I also suggest you use css instead of font tags.
>>>
>>> Segunda-feira, 11 de Novembro de 2013 23:57:32 UTC, sonu kumar
>>> escreveu:

 Hi,

 I am trying to print my data in table from two parsed files in view
 :
 here is my code:

 
 
 
 P1position
  residue
 Transmembranedomain
 C-mass
  
 
 {{for row in cleavage_res[2:]:}}
 
 
 {{=row[0]}}
 {{=row[1]}}
 
 {{for thm in thmmdata:}}
 {{if row[0] == thm[0]:}}
 {{=thm[2]}}
 {{pass}}
 {{pass}}
 
 {{=row[8]}}
 
  {{pass}}
 
 

 The problem I am facing in result output is:
 third column prints first value after matching and further on it is
 blank, although there are matching available for 13 and 18..
 Second loop is trying to fetch data from thmmdata which are similar
 to row[0] and thm[0]. please help me out where I am doing wrong?


 10GSPAR-PRRLP



 iiiMMM972.48117361.50 13ARPRR-LPLLS




 1381.73116952.25 18LPLLS-VLLLP




 1905.05116428.93 23VLLLP-LLGGT




 2440.41115893.57

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

Re: [web2py] Re: comma in html filename causing invalid request

2013-11-12 Thread Richard Vézina
In file name replace space with underscore, don't use special characters
(stick with ascii), use dash "-" for other thing then space.

Richard


On Mon, Nov 11, 2013 at 1:15 PM, Leonel Câmara wrote:

> It is sort of unorthodox to have commas in the path section of your URL
> unless you have code to specially deal with it and you're using it as a
> separator for something.
>
> So I'm guessing the regex in the examples doesn't consider the comma and
> you have to change it.
>
> So change something like this:
> routes_in=( (r'/static/(?P[\w./-]+)', r'/init/static/\g') )
> to: routes_in=( (r'/static/(?P[\w,./-]+)', r'/init/static/\g')
> )
>
>
> My suggestion would be **not to do this**, and change the names of the
> files to have no commas, static files are not user uploads, and should be
> controlled by you.
>
>
> Segunda-feira, 11 de Novembro de 2013 15:29:34 UTC, John Felps escreveu:
>
>> I have edited routes.parametric.example.py and saved as web2py/routes.py
>> with the default application as myapp. I have some html files in static
>> that now can be accessed as
>>
>>
>> http://ip/myapp/static/dir/test.html or
>> http://ip/static/dir/test.html
>> however, a couple of files have commas in the filename. They work when
>> using
>>
>> http://ip/myapp/static/dir/test,name.html
>>
>> but not with
>>
>> http://ip/static/dir/test,name.html
>>
>> They return "Invalid Request" in this case.
>>
>  --
> 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.
>

-- 
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: Loop problem

2013-11-12 Thread Niphlod
@richard: session.forget has nothing to do with forgetting the data is in 
the session. it is about forgetting to save it.

@sonu: use a scoped var (i.e. session.yourvar = dict(all_that_is_needed)) 
and then clear it with session.yourvar = None

On Tuesday, November 12, 2013 8:16:01 PM UTC+1, Richard wrote:
>
> Or you can just del(session.your_var)...
>
> Richard
>
>
> On Tue, Nov 12, 2013 at 2:15 PM, Richard Vézina 
> 
> > wrote:
>
>> session.forget(0) I am not sure search the book about it...
>>
>> :)
>>
>> Richard
>>
>>
>> On Tue, Nov 12, 2013 at 1:42 PM, sonu kumar 
>> 
>> > wrote:
>>
>>> Thanks a lot.
>>> I have solved this problem.
>>>
>>> one more thing I would like to ask regarding cache and session.
>>> each time when I run my application it creates session and also I see 
>>> last entered values on my form page. Is it possible to clean this after 
>>> execution?
>>>
>>> Thanks
>>>
>>>
>>> On Tuesday, 12 November 2013 09:48:53 UTC-8, Richard wrote:
>>>
 Why not create a dict with the id of your data and update the key with 
 the other data of the other table??

 Something like this :

 dict123 = {}
 for r in cleavage_res:
 dict123[r[0]]=[r[1:]]

 Then

 for r in thmmdata:
 dict123[r[0]].append(r[3])  # if position is not important
 # or
 # dict123[r[0]].insert(2, r[3])  # if postion is important

 Richard


 On Tue, Nov 12, 2013 at 12:06 PM, sonu kumar wrote:

> cleavage_res contains:
> 10GSPAR-PRRLP 
>
>
>
>
>
> 972.48117361.50 13ARPRR-LPLLS
>
>
>
>
> 1381.73116952.25 18LPLLS-VLLLP
>
>
>
>
> 1905.05116428.9323 VLLLP-LLGGT
>
>
>
>
> 2440.41 115893.57
>
> thmmdata contains:
>
> 10
>
>
>
>
> iiiMMM
>
> 13
>
>
>
>
>
> oo
>
> 18
>
>
>
>
>
>  
>
> 23 
>
>
>
>
>
> MMM
>
>
> now I would like to present all data in one table like this:
>
> 10GSPAR-PRRLP 
> iiiMMM
>
>
>
>
> 972.48 117361.5013ARPRR-LPLLS 
> oo
>
>
>
> 1381.73 116952.2518LPLLS-VLLLP 
> 
>
>
>
> 1905.05 116428.9323VLLLP-LLGGT 
> MMM
>
>
>
> 2440.41 115893.57
>
>
>
>
> On Monday, 11 November 2013 19:18:03 UTC-8, Leonel Câmara wrote:
>>
>> This is kind of impossible to answer without knowing what's in row or 
>> thmdata, It could be simply an error in your parser (you say the data 
>> comes 
>> from parsed files), and it's not getting all the results you were 
>> expecting.  
>>   
>> I suggest you use the debugger included with the framework to inspect 
>> the variables and see what's happening.
>>
>> I also suggest you use css instead of font tags.
>>
>> Segunda-feira, 11 de Novembro de 2013 23:57:32 UTC, sonu kumar 
>> escreveu:
>>>
>>> Hi,
>>>
>>> I am trying to print my data in table from two parsed files in view :
>>> here is my code: 
>>>
>>> 
>>> 
>>>
>>> P1position
>>>  residue
>>> Transmembranedomain
>>> C-mass
>>>  
>>>  
>>> {{for row in cleavage_res[2:]:}}
>>> 
>>> 
>>> {{=row[0]}}
>>> {{=row[1]}}
>>> 
>>> {{for thm in thmmdata:}}
>>> {{if row[0] == thm[0]:}}
>>> {{=thm[2]}}
>>> {{pass}}
>>> {{pass}}
>>> 
>>> {{=row[8]}}  
>>> 
>>>  {{pass}}
>>> 
>>> 
>>>
>>> The problem I am facing in result output is:
>>> third column prints first value after matching and further on it is 
>>> blank, although there are matching available for 13 and 18..
>>> Second loop is trying to fetch data from thmmdata which are similar 
>>> to row[0] and thm[0]. please help me out where I am doing wrong?
>>>
>>>
>>> 10GSPAR-PRRLP 
>>>
>>>
>>>
>>> iiiMMM972.48117361.50 13ARPRR-LPLLS 
>>>
>>>
>>>
>>>
>>> 1381.73116952.25 18LPLLS-VLLLP
>>>
>>>
>>>
>>>
>>> 1905.05116428.93 23VLLLP-LLGGT
>>>
>>>
>>>
>>>
>>> 2440.41115893.57
>>>
>>  -- 
> 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.
>

  -- 

Re: [web2py] Re: Loop problem

2013-11-12 Thread Richard Vézina
Or you can just del(session.your_var)...

Richard


On Tue, Nov 12, 2013 at 2:15 PM, Richard Vézina  wrote:

> session.forget(0) I am not sure search the book about it...
>
> :)
>
> Richard
>
>
> On Tue, Nov 12, 2013 at 1:42 PM, sonu kumar  > wrote:
>
>> Thanks a lot.
>> I have solved this problem.
>>
>> one more thing I would like to ask regarding cache and session.
>> each time when I run my application it creates session and also I see
>> last entered values on my form page. Is it possible to clean this after
>> execution?
>>
>> Thanks
>>
>>
>> On Tuesday, 12 November 2013 09:48:53 UTC-8, Richard wrote:
>>
>>> Why not create a dict with the id of your data and update the key with
>>> the other data of the other table??
>>>
>>> Something like this :
>>>
>>> dict123 = {}
>>> for r in cleavage_res:
>>> dict123[r[0]]=[r[1:]]
>>>
>>> Then
>>>
>>> for r in thmmdata:
>>> dict123[r[0]].append(r[3])  # if position is not important
>>> # or
>>> # dict123[r[0]].insert(2, r[3])  # if postion is important
>>>
>>> Richard
>>>
>>>
>>> On Tue, Nov 12, 2013 at 12:06 PM, sonu kumar wrote:
>>>
 cleavage_res contains:
 10GSPAR-PRRLP





 972.48117361.50 13ARPRR-LPLLS




 1381.73116952.25 18LPLLS-VLLLP




 1905.05116428.9323 VLLLP-LLGGT




 2440.41 115893.57

 thmmdata contains:

 10




 iiiMMM

 13





 oo

 18





 

 23





 MMM


 now I would like to present all data in one table like this:

 10GSPAR-PRRLP
 iiiMMM




 972.48 117361.5013ARPRR-LPLLS
 oo



 1381.73 116952.2518LPLLS-VLLLP
 



 1905.05 116428.9323VLLLP-LLGGT
 MMM



 2440.41 115893.57




 On Monday, 11 November 2013 19:18:03 UTC-8, Leonel Câmara wrote:
>
> This is kind of impossible to answer without knowing what's in row or
> thmdata, It could be simply an error in your parser (you say the data 
> comes
> from parsed files), and it's not getting all the results you were
> expecting.
>
> I suggest you use the debugger included with the framework to inspect
> the variables and see what's happening.
>
> I also suggest you use css instead of font tags.
>
> Segunda-feira, 11 de Novembro de 2013 23:57:32 UTC, sonu kumar
> escreveu:
>>
>> Hi,
>>
>> I am trying to print my data in table from two parsed files in view :
>> here is my code:
>>
>> 
>> 
>> 
>> P1position
>>  residue
>> Transmembranedomain
>> C-mass
>>  
>> 
>> {{for row in cleavage_res[2:]:}}
>> 
>> 
>> {{=row[0]}}
>> {{=row[1]}}
>> 
>> {{for thm in thmmdata:}}
>> {{if row[0] == thm[0]:}}
>> {{=thm[2]}}
>> {{pass}}
>> {{pass}}
>> 
>> {{=row[8]}}
>> 
>>  {{pass}}
>> 
>> 
>>
>> The problem I am facing in result output is:
>> third column prints first value after matching and further on it is
>> blank, although there are matching available for 13 and 18..
>> Second loop is trying to fetch data from thmmdata which are similar
>> to row[0] and thm[0]. please help me out where I am doing wrong?
>>
>>
>> 10GSPAR-PRRLP
>>
>>
>>
>> iiiMMM972.48117361.50 13ARPRR-LPLLS
>>
>>
>>
>>
>> 1381.73116952.25 18LPLLS-VLLLP
>>
>>
>>
>>
>> 1905.05116428.93 23VLLLP-LLGGT
>>
>>
>>
>>
>> 2440.41115893.57
>>
>  --
 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.
>>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://g

Re: [web2py] Re: Loop problem

2013-11-12 Thread Richard Vézina
session.forget(0) I am not sure search the book about it...

:)

Richard


On Tue, Nov 12, 2013 at 1:42 PM, sonu kumar
wrote:

> Thanks a lot.
> I have solved this problem.
>
> one more thing I would like to ask regarding cache and session.
> each time when I run my application it creates session and also I see last
> entered values on my form page. Is it possible to clean this after
> execution?
>
> Thanks
>
>
> On Tuesday, 12 November 2013 09:48:53 UTC-8, Richard wrote:
>
>> Why not create a dict with the id of your data and update the key with
>> the other data of the other table??
>>
>> Something like this :
>>
>> dict123 = {}
>> for r in cleavage_res:
>> dict123[r[0]]=[r[1:]]
>>
>> Then
>>
>> for r in thmmdata:
>> dict123[r[0]].append(r[3])  # if position is not important
>> # or
>> # dict123[r[0]].insert(2, r[3])  # if postion is important
>>
>> Richard
>>
>>
>> On Tue, Nov 12, 2013 at 12:06 PM, sonu kumar wrote:
>>
>>> cleavage_res contains:
>>> 10GSPAR-PRRLP
>>>
>>>
>>>
>>>
>>>
>>> 972.48117361.50 13ARPRR-LPLLS
>>>
>>>
>>>
>>>
>>> 1381.73116952.25 18LPLLS-VLLLP
>>>
>>>
>>>
>>>
>>> 1905.05116428.9323 VLLLP-LLGGT
>>>
>>>
>>>
>>>
>>> 2440.41 115893.57
>>>
>>> thmmdata contains:
>>>
>>> 10
>>>
>>>
>>>
>>>
>>> iiiMMM
>>>
>>> 13
>>>
>>>
>>>
>>>
>>>
>>> oo
>>>
>>> 18
>>>
>>>
>>>
>>>
>>>
>>> 
>>>
>>> 23
>>>
>>>
>>>
>>>
>>>
>>> MMM
>>>
>>>
>>> now I would like to present all data in one table like this:
>>>
>>> 10GSPAR-PRRLP
>>> iiiMMM
>>>
>>>
>>>
>>>
>>> 972.48 117361.5013ARPRR-LPLLS
>>> oo
>>>
>>>
>>>
>>> 1381.73 116952.2518LPLLS-VLLLP
>>> 
>>>
>>>
>>>
>>> 1905.05 116428.9323VLLLP-LLGGT
>>> MMM
>>>
>>>
>>>
>>> 2440.41 115893.57
>>>
>>>
>>>
>>>
>>> On Monday, 11 November 2013 19:18:03 UTC-8, Leonel Câmara wrote:

 This is kind of impossible to answer without knowing what's in row or
 thmdata, It could be simply an error in your parser (you say the data comes
 from parsed files), and it's not getting all the results you were
 expecting.

 I suggest you use the debugger included with the framework to inspect
 the variables and see what's happening.

 I also suggest you use css instead of font tags.

 Segunda-feira, 11 de Novembro de 2013 23:57:32 UTC, sonu kumar escreveu:
>
> Hi,
>
> I am trying to print my data in table from two parsed files in view :
> here is my code:
>
> 
> 
> 
> P1position
>  residue
> Transmembranedomain
> C-mass
> 
> 
> {{for row in cleavage_res[2:]:}}
> 
> 
> {{=row[0]}}
> {{=row[1]}}
> 
> {{for thm in thmmdata:}}
> {{if row[0] == thm[0]:}}
> {{=thm[2]}}
> {{pass}}
> {{pass}}
> 
> {{=row[8]}}
> 
>  {{pass}}
> 
> 
>
> The problem I am facing in result output is:
> third column prints first value after matching and further on it is
> blank, although there are matching available for 13 and 18..
> Second loop is trying to fetch data from thmmdata which are similar to
> row[0] and thm[0]. please help me out where I am doing wrong?
>
>
> 10GSPAR-PRRLP
>
>
>
> iiiMMM972.48117361.50 13ARPRR-LPLLS
>
>
>
>
> 1381.73116952.25 18LPLLS-VLLLP
>
>
>
>
> 1905.05116428.93 23VLLLP-LLGGT
>
>
>
>
> 2440.41115893.57
>
  --
>>> 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.
>

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

Re: [web2py] Re: Web2py crash if i define model with function

2013-11-12 Thread Diogo Munaro
It's not working...

1- I tried pool_size with n = 2, 3, 6;
2- apache with prefork

I just need to restart apache once a time when de database is created.
It's really strange... but works...


2013/11/12 Michele Comitini 

> Seem a threading issue.
> Try :
>  1) pass a pool_size=n option with different values of n
>  2) use preforking instead of threading in apache configuration
>
>
>
>
> 2013/11/12 Diogo Munaro 
>
>> Yes, thanks Michele!
>>
>> Omg, I was using web2py with apache. With the same code and using rocket
>> server no errors occurs and the databases was created.
>>
>> I configured apache with web2py script. Someone knows whats happen?
>>
>> Anyway, now I can configure database with rocket than manage with apache.
>> It's working now!
>>
>> I think some index makes apache/mysql crazy and returned this error:
>>
>>
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>> 7.
>> 8.
>> 9.
>> 10.
>> 11.
>>
>>
>>
>> Traceback (most recent call last):
>>   File "/var/www/sistema/gluon/main.py", line 550, in wsgibase
>>
>>
>>
>>
>> BaseAdapter.close_all_instances('rollback')
>>   File "/var/www/sistema/gluon/dal.py", line 558, in close_all_instances
>>
>>
>>
>>
>> db._adapter.close(action)
>>   File "/var/www/sistema/gluon/dal.py", line 538, in close
>>
>>
>>
>>
>> getattr(self, action)()
>>   File "/var/www/sistema/gluon/dal.py", line 1789, in rollback
>>
>>
>>
>>
>> return self.connection.rollback()
>> ProgrammingError: (2014, "Commands out of sync; you can't run this command 
>> now")
>>
>>  Thanks Michele, if I have some news I'll post here. I'll try using
>> commits at each index creation.
>>
>> Em 12/11/2013 07:33, "Michele Comitini" 
>> escreveu:
>>
>>  The error you sent seems to point to some statement that has not been
>>> properly closed.  The commit/rollback happens in the middle of an open
>>> statement?  That is what mysql seems to say.  The problem could be earlier
>>> than when the error raises.
>>>
>>> Hard to say where. You could try to force db.commit/rollback in
>>> different places to see where you start see errors.
>>>
>>>
>>>
>>> 2013/11/12 Diogo Munaro 
>>>
 The error continues, but without index :(

 The indexes are successful created


 2013/11/11 Michele Comitini 

> What happens if you remove the index creation inside the try/except
> block?
>
>
> 2013/11/11 Diogo Munaro 
>
>> It's not a simple function, but putting the model definition inside
>> the function.
>>
>> Here the code: http://pastebin.com/rN7gvAT8
>>
>> Attached the error ticket
>>
>>
>> Em segunda-feira, 11 de novembro de 2013 08h34min44s UTC-2, Michele
>> Comitini escreveu:
>>
>>> If you define a function like
>>> def f():
>>>   pass
>>>
>>> in a model, you should have no problems.
>>> Just show us an extract of code that causes the problem, without
>>> violating any reserved information or IP.
>>> That way we can help you...
>>>
>>> mic
>>>
>>>
>>> Il giorno lunedì 11 novembre 2013 10:43:49 UTC+1, Diogo Munaro ha
>>> scritto:

 Hi guys, first the problem:

 I need some databases with identical structure, but with different
 data. These databases must be stored with the clients because they want
 (different locations), but the auth system is unique.

 So, my structure by now is: a centralized auth system and some
 disyributed databases. The centralized system controls access to other
 databases.

 Teoricaly web2py works great with it, because I defined a function
 that I pass connection string, access control db and its made a lot of
 databases replicas with foreign keys to access control database.

 Without the function it works great, but with, it make a complete
 first client database and then crash all of web2py. It returns a ciclic
 ticket error when I try access any application of that web2py, either
 Welcome application.

 Im using web2py 2.7.4 with mysql on ubuntu. So, whats happening? I
 cant define model with function. Oh, my function is in the same model 
 file.

 BR, Diogo

>>>  --
>> 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.
>>
>
>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - 

Re: [web2py] Re: I need help understanding an issue with SQLFORM.factory ( in the context of a form wizard )

2013-11-12 Thread Carlos Zenteno
Thanks for the responses. 

I am using the answer on Google Groups but somehow
it seemed that the missing message gave the solution
as why the code showed did not work.

It is not working for me too, so I will keep trying. 
Thanks again...

-- 
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: Loop problem

2013-11-12 Thread sonu kumar
Thanks a lot.
I have solved this problem.

one more thing I would like to ask regarding cache and session.
each time when I run my application it creates session and also I see last 
entered values on my form page. Is it possible to clean this after 
execution?

Thanks

On Tuesday, 12 November 2013 09:48:53 UTC-8, Richard wrote:
>
> Why not create a dict with the id of your data and update the key with the 
> other data of the other table??
>
> Something like this :
>
> dict123 = {}
> for r in cleavage_res:
> dict123[r[0]]=[r[1:]]
>
> Then
>
> for r in thmmdata:
> dict123[r[0]].append(r[3])  # if position is not important
> # or
> # dict123[r[0]].insert(2, r[3])  # if postion is important
>
> Richard
>
>
> On Tue, Nov 12, 2013 at 12:06 PM, sonu kumar 
> 
> > wrote:
>
>> cleavage_res contains:
>> 10GSPAR-PRRLP 
>>
>>
>>
>>
>>
>> 972.48117361.50 13ARPRR-LPLLS
>>
>>
>>
>>
>> 1381.73116952.25 18LPLLS-VLLLP
>>
>>
>>
>>
>> 1905.05116428.9323 VLLLP-LLGGT
>>
>>
>>
>>
>> 2440.41 115893.57
>>
>> thmmdata contains:
>>
>> 10
>>
>>
>>
>>
>> iiiMMM
>>
>> 13
>>
>>
>>
>>
>>
>> oo
>>
>> 18
>>
>>
>>
>>
>>
>>  
>>
>> 23 
>>
>>
>>
>>
>>
>> MMM
>>
>>
>> now I would like to present all data in one table like this:
>>
>> 10GSPAR-PRRLP 
>> iiiMMM
>>
>>
>>
>>
>> 972.48 117361.5013ARPRR-LPLLS 
>> oo
>>
>>
>>
>> 1381.73 116952.2518LPLLS-VLLLP 
>> 
>>
>>
>>
>> 1905.05 116428.9323VLLLP-LLGGT 
>> MMM
>>
>>
>>
>> 2440.41 115893.57
>>
>>
>>
>>
>> On Monday, 11 November 2013 19:18:03 UTC-8, Leonel Câmara wrote:
>>>
>>> This is kind of impossible to answer without knowing what's in row or 
>>> thmdata, It could be simply an error in your parser (you say the data comes 
>>> from parsed files), and it's not getting all the results you were 
>>> expecting.  
>>>   
>>> I suggest you use the debugger included with the framework to inspect 
>>> the variables and see what's happening.
>>>
>>> I also suggest you use css instead of font tags.
>>>
>>> Segunda-feira, 11 de Novembro de 2013 23:57:32 UTC, sonu kumar escreveu:

 Hi,

 I am trying to print my data in table from two parsed files in view :
 here is my code: 

 
 

 P1position
  residue
 Transmembranedomain
 C-mass
 
  
 {{for row in cleavage_res[2:]:}}
 
 
 {{=row[0]}}
 {{=row[1]}}
 
 {{for thm in thmmdata:}}
 {{if row[0] == thm[0]:}}
 {{=thm[2]}}
 {{pass}}
 {{pass}}
 
 {{=row[8]}}  
 
  {{pass}}
 
 

 The problem I am facing in result output is:
 third column prints first value after matching and further on it is 
 blank, although there are matching available for 13 and 18..
 Second loop is trying to fetch data from thmmdata which are similar to 
 row[0] and thm[0]. please help me out where I am doing wrong?


 10GSPAR-PRRLP 



 iiiMMM972.48117361.50 13ARPRR-LPLLS 




 1381.73116952.25 18LPLLS-VLLLP




 1905.05116428.93 23VLLLP-LLGGT




 2440.41115893.57

>>>  -- 
>> 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: File upload through Ajax

2013-11-12 Thread Tushar Tuteja

Hey,
the example isn't working 
I am using on ubuntu12.04
thanks,
regards,

On Monday, November 11, 2013 7:53:36 PM UTC+5:30, Leonel Câmara wrote:
>
> Here's an example:
>
> http://in10min.blogspot.pt/2013/04/web2py-implement-multiple-files-upload.html
>
> Segunda-feira, 11 de Novembro de 2013 14:07:38 UTC, Tushar Tuteja escreveu:
>>
>> Hey,
>> I want to upload a file, but I want that file to be uploaded via ajax.
>> Is there an example code to do so in web2py.
>> A fully functional app would be of great help.
>> That just uploads one single file to the server from the index page and 
>> then displays that image in the list on the same page.
>> No authorization is required
>> Just file upload through ajax
>>
>> thanks,
>>
>> regards,
>>
>>
>>

-- 
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: Loop problem

2013-11-12 Thread Richard Vézina
Why not create a dict with the id of your data and update the key with the
other data of the other table??

Something like this :

dict123 = {}
for r in cleavage_res:
dict123[r[0]]=[r[1:]]

Then

for r in thmmdata:
dict123[r[0]].append(r[3])  # if position is not important
# or
# dict123[r[0]].insert(2, r[3])  # if postion is important

Richard


On Tue, Nov 12, 2013 at 12:06 PM, sonu kumar
wrote:

> cleavage_res contains:
> 10GSPAR-PRRLP
>
>
>
>
>
> 972.48117361.5013ARPRR-LPLLS
>
>
>
>
> 1381.73116952.2518LPLLS-VLLLP
>
>
>
>
> 1905.05116428.9323VLLLP-LLGGT
>
>
>
>
> 2440.41115893.57
>
> thmmdata contains:
>
> 10
>
>
>
>
> iiiMMM
>
> 13
>
>
>
>
>
> oo
>
> 18
>
>
>
>
>
> 
>
> 23
>
>
>
>
>
> MMM
>
>
> now I would like to present all data in one table like this:
>
> 10GSPAR-PRRLP
> iiiMMM
>
>
>
>
> 972.48117361.5013ARPRR-LPLLS
> oo
>
>
>
> 1381.73116952.2518LPLLS-VLLLP
> 
>
>
>
> 1905.05116428.9323VLLLP-LLGGT
> MMM
>
>
>
> 2440.41115893.57
>
>
>
>
> On Monday, 11 November 2013 19:18:03 UTC-8, Leonel Câmara wrote:
>>
>> This is kind of impossible to answer without knowing what's in row or
>> thmdata, It could be simply an error in your parser (you say the data comes
>> from parsed files), and it's not getting all the results you were
>> expecting.
>>
>> I suggest you use the debugger included with the framework to inspect the
>> variables and see what's happening.
>>
>> I also suggest you use css instead of font tags.
>>
>> Segunda-feira, 11 de Novembro de 2013 23:57:32 UTC, sonu kumar escreveu:
>>>
>>> Hi,
>>>
>>> I am trying to print my data in table from two parsed files in view :
>>> here is my code:
>>>
>>> 
>>> 
>>> 
>>> P1position
>>>  residue
>>> Transmembranedomain
>>> C-mass
>>> 
>>> 
>>> {{for row in cleavage_res[2:]:}}
>>> 
>>> 
>>> {{=row[0]}}
>>> {{=row[1]}}
>>> 
>>> {{for thm in thmmdata:}}
>>> {{if row[0] == thm[0]:}}
>>> {{=thm[2]}}
>>> {{pass}}
>>> {{pass}}
>>> 
>>> {{=row[8]}}
>>> 
>>>  {{pass}}
>>> 
>>> 
>>>
>>> The problem I am facing in result output is:
>>> third column prints first value after matching and further on it is
>>> blank, although there are matching available for 13 and 18..
>>> Second loop is trying to fetch data from thmmdata which are similar to
>>> row[0] and thm[0]. please help me out where I am doing wrong?
>>>
>>>
>>> 10GSPAR-PRRLP
>>>
>>>
>>>
>>> iiiMMM972.48117361.5013ARPRR-LPLLS
>>>
>>>
>>>
>>>
>>> 1381.73116952.2518LPLLS-VLLLP
>>>
>>>
>>>
>>>
>>> 1905.05116428.9323VLLLP-LLGGT
>>>
>>>
>>>
>>>
>>> 2440.41115893.57
>>>
>>  --
> 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.
>

-- 
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: Loop problem

2013-11-12 Thread sonu kumar
cleavage_res contains:
10GSPAR-PRRLP





972.48117361.5013ARPRR-LPLLS




1381.73116952.2518LPLLS-VLLLP




1905.05116428.9323VLLLP-LLGGT




2440.41115893.57

thmmdata contains:

10




iiiMMM

13





oo

18







23





MMM


now I would like to present all data in one table like this:

10GSPAR-PRRLP
iiiMMM




972.48117361.5013ARPRR-LPLLS
oo



1381.73116952.2518LPLLS-VLLLP




1905.05116428.9323VLLLP-LLGGT
MMM



2440.41115893.57




On Monday, 11 November 2013 19:18:03 UTC-8, Leonel Câmara wrote:
>
> This is kind of impossible to answer without knowing what's in row or 
> thmdata, It could be simply an error in your parser (you say the data comes 
> from parsed files), and it's not getting all the results you were 
> expecting.  
>   
> I suggest you use the debugger included with the framework to inspect the 
> variables and see what's happening.
>
> I also suggest you use css instead of font tags.
>
> Segunda-feira, 11 de Novembro de 2013 23:57:32 UTC, sonu kumar escreveu:
>>
>> Hi,
>>
>> I am trying to print my data in table from two parsed files in view :
>> here is my code: 
>>
>> 
>> 
>>
>> P1position
>>  residue
>> Transmembranedomain
>> C-mass
>> 
>>  
>> {{for row in cleavage_res[2:]:}}
>> 
>> 
>> {{=row[0]}}
>> {{=row[1]}}
>> 
>> {{for thm in thmmdata:}}
>> {{if row[0] == thm[0]:}}
>> {{=thm[2]}}
>> {{pass}}
>> {{pass}}
>> 
>> {{=row[8]}}  
>> 
>>  {{pass}}
>> 
>> 
>>
>> The problem I am facing in result output is:
>> third column prints first value after matching and further on it is 
>> blank, although there are matching available for 13 and 18..
>> Second loop is trying to fetch data from thmmdata which are similar to 
>> row[0] and thm[0]. please help me out where I am doing wrong?
>>
>>
>> 10GSPAR-PRRLP
>>
>>
>>
>> iiiMMM972.48117361.5013ARPRR-LPLLS
>>
>>
>>
>>
>> 1381.73116952.2518LPLLS-VLLLP
>>
>>
>>
>>
>> 1905.05116428.9323VLLLP-LLGGT
>>
>>
>>
>>
>> 2440.41115893.57
>>
>

-- 
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: web2py "Components" for layout.html and other HTML pages [ not derived from layout.html]

2013-11-12 Thread JoeCodeswell
Dear Anthony and other discussants,

My original thought was JUST to *modularize *GUI entities at a more 
granular level. I thought of Components [as in Microsoft land] and how 
web2py has the Component concept. So i thought "why not use it?"

Then i discovered that according to the book, web2py Component engineers 
were "interested" in Ajax being part of the infrastructure. So I began my 
research in that direction.

As far as I am concerned, as long as Components provide *modularity*, they 
can use Ajax or NOT as a matter of performance choice.

The modularity i am talking about links css, javascript and server-side 
dependencies for each Component so that it may be "included" statically or 
dynamically or via Ajax or NOT in the rendering of a page.

I am happy to have begun this discussion. I trust in the *web2py community 
spirit *to make progress in this direction.

Thanks for the GREAT framework.

Thanks EVEN MORE for the *web2py community spirit.*

Love and peace,

Joe

On Tuesday, November 12, 2013 7:02:47 AM UTC-8, Anthony wrote:
>
> OK, the original suggestion was to use Ajax components, but using 
> {{include}}'s certainly makes sense. I'm not sure how much of this we want 
> to do in the scaffolding app, though. It makes the code a bit more complex 
> to follow, and for non-compiled views, it will slow down the template 
> processing as well. The scaffolding app is intended to be a basic starting 
> point. If you have a special use case that requires multiple layouts that 
> are different enough that they can't be generated from a single layout.html 
> but that nevertheless need common components that themselves don't change 
> from layout to layout, it's easy enough to break up the standard layout 
> yourself in a way that exactly meets your needs (the example you linked 
> would only take a few minutes to create).
>
> Separating out at least some of the  section as well as the scripts 
> section at the bottom of the layout might be particularly useful because 
> those sections are not tied to the styling of the scaffolding app and 
> should therefore be more portable to other layouts (in fact, part of the 
> head section is already modularized into web2py_ajax.html).
>
> Anthony
>
> On Tuesday, November 12, 2013 1:20:00 AM UTC-5, Kiran Subbaraman wrote:
>>
>>  I wasn't thinking in terms of Ajax calls to stitch together these 
>> components/templates, but rather the {{include...}} mechanism to do this. 
>> I do agree that the current layout is modular, but then if I want re-use 
>> a piece of functionality present in that layout.html in some other page or 
>> in my own custom template, then I have to resort to cut-and-paste of the 
>> code. The intention is to keep this cut-and-paste to a minimum, or none at 
>> all. 
>> The other thing to consider is what should be the granularity of these 
>> templates, and if the "configuration" that brings these templates together 
>> can be defined in a single place. 
>>
>> A sample of what am thinking (needs to be refined further): 
>> https://github.com/kirsn/web2py_layout_template/blob/master/views/layout.html
>>
>> 
>> Kiran Subbaramanhttp://subbaraman.wordpress.com/about/
>>
>> On 11/12/2013 10:39 AM, Anthony wrote:
>>  
>> On Monday, November 11, 2013 11:28:37 PM UTC-5, Kiran Subbaraman wrote:
>>
>>>  My view is:
>>> Splitting / refactoring the contents of the layout.html into 
>>> 'components' - which contains a combination of css + html as mentioned in 
>>> the original note: 
>>> https://groups.google.com/forum/#!topic/web2py/3NmrocjbwzM 
>>>  
>>
>>  Are you saying you'd like something like this to be offered as an 
>> optional alternative or to replace the current layout.html? I don't think 
>> we want to have separate Ajax requests for every little piece of the layout.
>>
>>  Note, the current layout is already fairly modular, with separate 
>> blocks for the head, center, sidebars, and footer. It also allows you to 
>> conditionally include the left and right sidebars, Auth navbar, menu, logo, 
>> flash message, page title, and subtitle (by setting various attributes and 
>> global variables in the model, controller, and extending view code).
>>
>>  Maybe it would help if you provide some examples of what you are trying 
>> to achieve so we can figure out the best approach. If you want to re-use 
>> pieces of the layout in alternative layouts, perhaps we could put each 
>> piece in a separate template file and then just use {{include 
>> ...}}statements to insert them where needed. This would probably be much 
>> more 
>> efficient than running multiple Ajax requests to get what could just as 
>> easily be generated in a single request.
>>
>>  Anthony
>>  -- 
>> 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 a

[web2py] Re: How is the current menu styled to be horizontal?

2013-11-12 Thread JoeCodeswell
Dear Paolo,

Thanks for the GREAT DETAILED reply. You indeed sensed the meaning of my 
original question which was related to my post - web2py "Components" for 
layout.html and other HTML pages [ not derived from 
layout.html]

I will do some experiments and report back.

Thanks again, Paolo.

Love and peace,

Joe

On Monday, November 11, 2013 4:53:18 PM UTC-8, Paolo Caruccio wrote:
>
> Currently the default layout.html is based on bootstrap framework (see 
> http://getbootstrap.com/2.3.2/index.html)
>
> As far as I know the minimum dependencies required from web2py for any 
> layout are:
> - web2py.css
> - web2py_ajax.html (which in turn refers to web2py.js and jquery)
>
> However, in order to render horizontally the menu without bootstrap or any 
> other html/css framework, you must apply your own css rules, since the 
> above mentioned two files are not useful for this.
> For example, assuming that you would keep the current html template, after 
> you removed from it any reference to bootstrap framework, you should add 
> just before  tag:
>
> 
>   .navbar-inner .container:before, .navbar-inner .container:after {display
> : table;line-height: 0;content: "";}
>   .navbar-inner .container:after {clear:both;}
>   a.brand, div.nav {float:left;}
>   div.nav ul, #navbar, #navbar ul {margin:0; padding:0; list-style:none; 
> white-space:nowrap; text-align:left; padding:1px 1px 0 1px; 
> background:#eee;}
>   div.nav li, #navbar li {margin:0; padding:0; 
> list-style:none;display:inline;}
>   div.nav ul ul {position:absolute; left:-px;}
>   #navbar ul {position:absolute; right:0; top:-px;}
>   div.nav ul.nav>li, #navbar>li {display:inline-block;position:relative;}
>   div.nav a, #navbar a {display:block; color:#000; line-height:22px; 
> text-decoration:none; padding:0 20px 0 10px;} 
>   div.nav li a:hover, #navbar li a:hover {background-color:#09c; 
> color:#fff;} 
>   div.nav li:hover > a, #navbar li:hover > a {background-color:#09c; 
> color:#fff;}
>   div.nav ul li:hover > ul {left:100%; margin-top:-23px; margin-left:-1px
> ;}
>   div.nav ul.nav>li:hover > ul {left:0; margin-top:-1px; margin-left:-1px
> ;}
>   #navbar>li:hover > ul {top:23px; margin-top:-1px; margin-right:-1px;}
> 
>
> That will render a very simple horizontal multilevel menu. Of course there 
> are many other ways to accomplish the same result.
>
>
> Il giorno lunedì 11 novembre 2013 20:12:11 UTC+1, JoeCodeswell ha scritto:
>>
>> Dear Web2py forum,
>>
>> I can't find superfish.css in the application structure anymore. I think 
>> i remember that web2py went through a menu overhaul. 
>>
>> Can someone please tell me the *minimum dependencies *for the new menus 
>> to be rendered horizontally?
>>
>> Thanks in advance.
>>
>> Love and peace,
>>
>> Joe
>>
>

-- 
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] Scheduler TIMEOUT

2013-11-12 Thread LightOfMooN
How to disable timeout in scheduler?
I'm using scheduler to update availability of thing from supplier site.

So, I parse supplier's site, and when one url not loaded, scheduler task 
get status 'TIMEOUT' and stops all work. It's really bad, because there are 
thousands things in database, and I can't check every hour, if the 
scheduler stopped.
For now I just use second task to fix it:

def remove_timeout():
db(db.scheduler_task.status=='TIMEOUT').update(status='QUEUED')
db.commit()
return True

But it's not a good solution.
Is there other way to solve the problem?
I just need task not stopped by timeout.

-- 
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: web2py "Components" for layout.html and other HTML pages [ not derived from layout.html]

2013-11-12 Thread Anthony
On Tuesday, November 12, 2013 6:36:32 AM UTC-5, viniciusban wrote:

> You can use LOAD(..., ajax=False).
>

That will still probably result in a lot of unnecessary processing relative 
to using simple {{include}} statements.

Anthony 

-- 
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: web2py "Components" for layout.html and other HTML pages [ not derived from layout.html]

2013-11-12 Thread Anthony
OK, the original suggestion was to use Ajax components, but using 
{{include}}'s certainly makes sense. I'm not sure how much of this we want 
to do in the scaffolding app, though. It makes the code a bit more complex 
to follow, and for non-compiled views, it will slow down the template 
processing as well. The scaffolding app is intended to be a basic starting 
point. If you have a special use case that requires multiple layouts that 
are different enough that they can't be generated from a single layout.html 
but that nevertheless need common components that themselves don't change 
from layout to layout, it's easy enough to break up the standard layout 
yourself in a way that exactly meets your needs (the example you linked 
would only take a few minutes to create).

Separating out at least some of the  section as well as the scripts 
section at the bottom of the layout might be particularly useful because 
those sections are not tied to the styling of the scaffolding app and 
should therefore be more portable to other layouts (in fact, part of the 
head section is already modularized into web2py_ajax.html).

Anthony

On Tuesday, November 12, 2013 1:20:00 AM UTC-5, Kiran Subbaraman wrote:
>
>  I wasn't thinking in terms of Ajax calls to stitch together these 
> components/templates, but rather the {{include...}} mechanism to do this. 
> I do agree that the current layout is modular, but then if I want re-use a 
> piece of functionality present in that layout.html in some other page or in 
> my own custom template, then I have to resort to cut-and-paste of the code. 
> The intention is to keep this cut-and-paste to a minimum, or none at all. 
> The other thing to consider is what should be the granularity of these 
> templates, and if the "configuration" that brings these templates together 
> can be defined in a single place. 
>
> A sample of what am thinking (needs to be refined further): 
> https://github.com/kirsn/web2py_layout_template/blob/master/views/layout.html
>
> 
> Kiran Subbaramanhttp://subbaraman.wordpress.com/about/
>
> On 11/12/2013 10:39 AM, Anthony wrote:
>  
> On Monday, November 11, 2013 11:28:37 PM UTC-5, Kiran Subbaraman wrote:
>
>>  My view is:
>> Splitting / refactoring the contents of the layout.html into 'components' 
>> - which contains a combination of css + html as mentioned in the original 
>> note: https://groups.google.com/forum/#!topic/web2py/3NmrocjbwzM 
>>  
>
>  Are you saying you'd like something like this to be offered as an 
> optional alternative or to replace the current layout.html? I don't think 
> we want to have separate Ajax requests for every little piece of the layout.
>
>  Note, the current layout is already fairly modular, with separate blocks 
> for the head, center, sidebars, and footer. It also allows you to 
> conditionally include the left and right sidebars, Auth navbar, menu, logo, 
> flash message, page title, and subtitle (by setting various attributes and 
> global variables in the model, controller, and extending view code).
>
>  Maybe it would help if you provide some examples of what you are trying 
> to achieve so we can figure out the best approach. If you want to re-use 
> pieces of the layout in alternative layouts, perhaps we could put each 
> piece in a separate template file and then just use {{include ...}}statements 
> to insert them where needed. This would probably be much more 
> efficient than running multiple Ajax requests to get what could just as 
> easily be generated in a single request.
>
>  Anthony
>  -- 
> 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.


Re: [web2py] Scheduler - a second try

2013-11-12 Thread Johann Spies
Thanks for your answer.

Apologies. I have only seen your email now.

I will try tomorrow.  I have to go in a few minutes.

Regards
Johann


On 12 November 2013 10:57, Niphlod  wrote:

> are the tables created on the server (not just scheduler_task, but also
> scheduler_worker)
> I find hard to believe (or, at least, I was never able to verify) that on
> the first round with only one worker the worker itself can't successfully
> commit a query that basically doesn't do nothing (because there are no
> other workers around)...
> I'm available at night hours (CET, meaning  here are 10:00 AM now, I'm
> available in exactly 12 hours) in a gtalk session to further debug the
> immensely strange issue you're experiencing  of course, if you still
> want to get to the bottom of it.
>
>  --
> 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.
>



-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)

-- 
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] Suggestion for admin Views section

2013-11-12 Thread Tito Garrido
Hi Folks,

It is just a suggestion, why the views files doesn't collapse like the
files in static section?

I think that folders should collapse so we could easily view just the files
from that folder. I am suggesting because I have a big application using a
lot of views separated by folders and the views section is too big,
sometimes I get lost looking for a view file.

 I guess, if we could collapse folders in the views section would be great.

Regards,

Tito

-- 

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

-- 
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: Web2py crash if i define model with function

2013-11-12 Thread Michele Comitini
Seem a threading issue.
Try :
 1) pass a pool_size=n option with different values of n
 2) use preforking instead of threading in apache configuration




2013/11/12 Diogo Munaro 

> Yes, thanks Michele!
>
> Omg, I was using web2py with apache. With the same code and using rocket
> server no errors occurs and the databases was created.
>
> I configured apache with web2py script. Someone knows whats happen?
>
> Anyway, now I can configure database with rocket than manage with apache.
> It's working now!
>
> I think some index makes apache/mysql crazy and returned this error:
>
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
>
>
> Traceback (most recent call last):
>   File "/var/www/sistema/gluon/main.py", line 550, in wsgibase
>
>
> BaseAdapter.close_all_instances('rollback')
>   File "/var/www/sistema/gluon/dal.py", line 558, in close_all_instances
>
>
> db._adapter.close(action)
>   File "/var/www/sistema/gluon/dal.py", line 538, in close
>
>
> getattr(self, action)()
>   File "/var/www/sistema/gluon/dal.py", line 1789, in rollback
>
>
> return self.connection.rollback()
> ProgrammingError: (2014, "Commands out of sync; you can't run this command 
> now")
>
>  Thanks Michele, if I have some news I'll post here. I'll try using
> commits at each index creation.
>
> Em 12/11/2013 07:33, "Michele Comitini" 
> escreveu:
>
>  The error you sent seems to point to some statement that has not been
>> properly closed.  The commit/rollback happens in the middle of an open
>> statement?  That is what mysql seems to say.  The problem could be earlier
>> than when the error raises.
>>
>> Hard to say where. You could try to force db.commit/rollback in different
>> places to see where you start see errors.
>>
>>
>>
>> 2013/11/12 Diogo Munaro 
>>
>>> The error continues, but without index :(
>>>
>>> The indexes are successful created
>>>
>>>
>>> 2013/11/11 Michele Comitini 
>>>
 What happens if you remove the index creation inside the try/except
 block?


 2013/11/11 Diogo Munaro 

> It's not a simple function, but putting the model definition inside
> the function.
>
> Here the code: http://pastebin.com/rN7gvAT8
>
> Attached the error ticket
>
>
> Em segunda-feira, 11 de novembro de 2013 08h34min44s UTC-2, Michele
> Comitini escreveu:
>
>> If you define a function like
>> def f():
>>   pass
>>
>> in a model, you should have no problems.
>> Just show us an extract of code that causes the problem, without
>> violating any reserved information or IP.
>> That way we can help you...
>>
>> mic
>>
>>
>> Il giorno lunedì 11 novembre 2013 10:43:49 UTC+1, Diogo Munaro ha
>> scritto:
>>>
>>> Hi guys, first the problem:
>>>
>>> I need some databases with identical structure, but with different
>>> data. These databases must be stored with the clients because they want
>>> (different locations), but the auth system is unique.
>>>
>>> So, my structure by now is: a centralized auth system and some
>>> disyributed databases. The centralized system controls access to other
>>> databases.
>>>
>>> Teoricaly web2py works great with it, because I defined a function
>>> that I pass connection string, access control db and its made a lot of
>>> databases replicas with foreign keys to access control database.
>>>
>>> Without the function it works great, but with, it make a complete
>>> first client database and then crash all of web2py. It returns a ciclic
>>> ticket error when I try access any application of that web2py, either
>>> Welcome application.
>>>
>>> Im using web2py 2.7.4 with mysql on ubuntu. So, whats happening? I
>>> cant define model with function. Oh, my function is in the same model 
>>> file.
>>>
>>> BR, Diogo
>>>
>>  --
> 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.
>

  --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 You received this message because you are subscribed to a topic in the
 Google Groups "web2py-users" group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/_OnWZGMqkE0/unsubscribe.
 To unsubscribe from this group and all its topics, send a

[web2py] Re: How to use jquery get JSON in order to call web2py exteral API

2013-11-12 Thread Neil
I'm probably too late for this person, but if anyone else comes across this 
problem (like I just did) the answer is here:

https://groups.google.com/d/msg/web2py/kSUtyNcUQGI/Ta1VowPcJMgJ

As I understand it getJSON() is just a wrapper for ajax(). If you use 
ajax(), you have a few more options including one called crossDomain, which 
should be set to true. For example:

  jQuery(document).ready(function ($) {
//attach a jQuery live event to the button
$('#submit-samples').click(function(){
  $.ajax({
type: 'GET',
url: "[url]",
processData: true,
data: {},
crossDomain: true,
dataType: "json",
success: function (data) {
  alert(data); 
}
  });
});
  });

Next, if you add the following to your controller function:

if request.env.http_origin:
response.headers['Access-Control-Allow-Origin'] = 
'http://www.[site].com'

it will allow access from any site(s) you specify. Alternatively, you can 
set it to '*' to accept requests from any site.

On Monday, 24 June 2013 22:22:36 UTC+1, Nam Soo In wrote:
>
> in controller
>
>
> from gluon.tools import Service
> service = Service()
>
> def call():
> session.forget()
> return service()
>
> @service.json
> def pullDataToMap():
>   ...logic..
>   return result
>
> result looks like this
> {'San_Jose':102,'Paris':2,'London':38}
>
> I am trying to call that function in javascript
>
> so
> 
>   $(document).ready(function(){
> console.log("hi")
>   $.getJSON('
> https://test.corp.nam.com/test/default/call/json/pullDataToMap', 
> function(data) {
>   console.log(data);
>   });
>  
>  
> });
>   
>
>
> it seems like it is not calling HTTPRequest and I am not getting any data.
> I am getting this error in console windows
> XMLHttpRequest cannot load 
> https://test.corp.nam.com/test/default/call/json/pullDataToMap. Origin 
> null is not allowed by Access-Control-Allow-Origin. 
>
> If I just put that url into the browser I can see the results 
>
> Any thought?
> Thank you in advance.
>
>

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


Re: [web2py] Re: web2py "Components" for layout.html and other HTML pages [ not derived from layout.html]

2013-11-12 Thread Vinicius Assef
You can use LOAD(..., ajax=False).

Doesn't it help you?

On Tue, Nov 12, 2013 at 4:20 AM, Kiran Subbaraman
 wrote:
> I wasn't thinking in terms of Ajax calls to stitch together these
> components/templates, but rather the {{include...}} mechanism to do this.
> I do agree that the current layout is modular, but then if I want re-use a
> piece of functionality present in that layout.html in some other page or in
> my own custom template, then I have to resort to cut-and-paste of the code.
> The intention is to keep this cut-and-paste to a minimum, or none at all.
> The other thing to consider is what should be the granularity of these
> templates, and if the "configuration" that brings these templates together
> can be defined in a single place.
>
> A sample of what am thinking (needs to be refined further):
> https://github.com/kirsn/web2py_layout_template/blob/master/views/layout.html
>
> 
> Kiran Subbaraman
> http://subbaraman.wordpress.com/about/
>
> On 11/12/2013 10:39 AM, Anthony wrote:
>
> On Monday, November 11, 2013 11:28:37 PM UTC-5, Kiran Subbaraman wrote:
>>
>> My view is:
>> Splitting / refactoring the contents of the layout.html into 'components'
>> - which contains a combination of css + html as mentioned in the original
>> note: https://groups.google.com/forum/#!topic/web2py/3NmrocjbwzM
>
>
> Are you saying you'd like something like this to be offered as an optional
> alternative or to replace the current layout.html? I don't think we want to
> have separate Ajax requests for every little piece of the layout.
>
> Note, the current layout is already fairly modular, with separate blocks for
> the head, center, sidebars, and footer. It also allows you to conditionally
> include the left and right sidebars, Auth navbar, menu, logo, flash message,
> page title, and subtitle (by setting various attributes and global variables
> in the model, controller, and extending view code).
>
> Maybe it would help if you provide some examples of what you are trying to
> achieve so we can figure out the best approach. If you want to re-use pieces
> of the layout in alternative layouts, perhaps we could put each piece in a
> separate template file and then just use {{include ...}} statements to
> insert them where needed. This would probably be much more efficient than
> running multiple Ajax requests to get what could just as easily be generated
> in a single request.
>
> Anthony
> --
> 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.
>
>
> --
> 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.

-- 
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: Web2py crash if i define model with function

2013-11-12 Thread Diogo Munaro
Yes, thanks Michele!

Omg, I was using web2py with apache. With the same code and using rocket
server no errors occurs and the databases was created.

I configured apache with web2py script. Someone knows whats happen?

Anyway, now I can configure database with rocket than manage with apache.
It's working now!

I think some index makes apache/mysql crazy and returned this error:


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


Traceback (most recent call last):
  File "/var/www/sistema/gluon/main.py", line 550, in wsgibase

BaseAdapter.close_all_instances('rollback')
  File "/var/www/sistema/gluon/dal.py", line 558, in close_all_instances

db._adapter.close(action)
  File "/var/www/sistema/gluon/dal.py", line 538, in close

getattr(self, action)()
  File "/var/www/sistema/gluon/dal.py", line 1789, in rollback

return self.connection.rollback()
ProgrammingError: (2014, "Commands out of sync; you can't run this command now")

 Thanks Michele, if I have some news I'll post here. I'll try using commits
at each index creation.

Em 12/11/2013 07:33, "Michele Comitini" 
escreveu:

> The error you sent seems to point to some statement that has not been
> properly closed.  The commit/rollback happens in the middle of an open
> statement?  That is what mysql seems to say.  The problem could be earlier
> than when the error raises.
>
> Hard to say where. You could try to force db.commit/rollback in different
> places to see where you start see errors.
>
>
>
> 2013/11/12 Diogo Munaro 
>
>> The error continues, but without index :(
>>
>> The indexes are successful created
>>
>>
>> 2013/11/11 Michele Comitini 
>>
>>> What happens if you remove the index creation inside the try/except
>>> block?
>>>
>>>
>>> 2013/11/11 Diogo Munaro 
>>>
 It's not a simple function, but putting the model definition inside the
 function.

 Here the code: http://pastebin.com/rN7gvAT8

 Attached the error ticket


 Em segunda-feira, 11 de novembro de 2013 08h34min44s UTC-2, Michele
 Comitini escreveu:

> If you define a function like
> def f():
>   pass
>
> in a model, you should have no problems.
> Just show us an extract of code that causes the problem, without
> violating any reserved information or IP.
> That way we can help you...
>
> mic
>
>
> Il giorno lunedì 11 novembre 2013 10:43:49 UTC+1, Diogo Munaro ha
> scritto:
>>
>> Hi guys, first the problem:
>>
>> I need some databases with identical structure, but with different
>> data. These databases must be stored with the clients because they want
>> (different locations), but the auth system is unique.
>>
>> So, my structure by now is: a centralized auth system and some
>> disyributed databases. The centralized system controls access to other
>> databases.
>>
>> Teoricaly web2py works great with it, because I defined a function
>> that I pass connection string, access control db and its made a lot of
>> databases replicas with foreign keys to access control database.
>>
>> Without the function it works great, but with, it make a complete
>> first client database and then crash all of web2py. It returns a ciclic
>> ticket error when I try access any application of that web2py, either
>> Welcome application.
>>
>> Im using web2py 2.7.4 with mysql on ubuntu. So, whats happening? I
>> cant define model with function. Oh, my function is in the same model 
>> file.
>>
>> BR, Diogo
>>
>  --
 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.

>>>
>>>  --
>>> Resources:
>>> - http://web2py.com
>>> - http://web2py.com/book (Documentation)
>>> - http://github.com/web2py/web2py (Source code)
>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>> ---
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "web2py-users" group.
>>> To unsubscribe from this topic, visit
>>> https://groups.google.com/d/topic/web2py/_OnWZGMqkE0/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> web2py+unsubscr...@googlegroups.com.
>>>
>>> For more options, visit https://groups.google.com/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 

Re: [web2py] Re: Web2py crash if i define model with function

2013-11-12 Thread Michele Comitini
The error you sent seems to point to some statement that has not been
properly closed.  The commit/rollback happens in the middle of an open
statement?  That is what mysql seems to say.  The problem could be earlier
than when the error raises.

Hard to say where. You could try to force db.commit/rollback in different
places to see where you start see errors.



2013/11/12 Diogo Munaro 

> The error continues, but without index :(
>
> The indexes are successful created
>
>
> 2013/11/11 Michele Comitini 
>
>> What happens if you remove the index creation inside the try/except block?
>>
>>
>> 2013/11/11 Diogo Munaro 
>>
>>> It's not a simple function, but putting the model definition inside the
>>> function.
>>>
>>> Here the code: http://pastebin.com/rN7gvAT8
>>>
>>> Attached the error ticket
>>>
>>>
>>> Em segunda-feira, 11 de novembro de 2013 08h34min44s UTC-2, Michele
>>> Comitini escreveu:
>>>
 If you define a function like
 def f():
   pass

 in a model, you should have no problems.
 Just show us an extract of code that causes the problem, without
 violating any reserved information or IP.
 That way we can help you...

 mic


 Il giorno lunedì 11 novembre 2013 10:43:49 UTC+1, Diogo Munaro ha
 scritto:
>
> Hi guys, first the problem:
>
> I need some databases with identical structure, but with different
> data. These databases must be stored with the clients because they want
> (different locations), but the auth system is unique.
>
> So, my structure by now is: a centralized auth system and some
> disyributed databases. The centralized system controls access to other
> databases.
>
> Teoricaly web2py works great with it, because I defined a function
> that I pass connection string, access control db and its made a lot of
> databases replicas with foreign keys to access control database.
>
> Without the function it works great, but with, it make a complete
> first client database and then crash all of web2py. It returns a ciclic
> ticket error when I try access any application of that web2py, either
> Welcome application.
>
> Im using web2py 2.7.4 with mysql on ubuntu. So, whats happening? I
> cant define model with function. Oh, my function is in the same model 
> file.
>
> BR, Diogo
>
  --
>>> 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.
>>>
>>
>>  --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are subscribed to a topic in the
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/web2py/_OnWZGMqkE0/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> web2py+unsubscr...@googlegroups.com.
>>
>> For more options, visit https://groups.google.com/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.
>

-- 
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: What's the state of background.py (running code in separate threads) ?

2013-11-12 Thread Niphlod
depends on what are you talking about.
if you're talking about the scheduler, then its definitely stable (as long 
as you stick to the documented API).

the separation is made exactly for the usecase you're experiencing: web 
apps should return webpages fast while something else crunches data.

-- 
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] Scheduler - a second try

2013-11-12 Thread Niphlod
are the tables created on the server (not just scheduler_task, but also 
scheduler_worker)
I find hard to believe (or, at least, I was never able to verify) that on 
the first round with only one worker the worker itself can't successfully 
commit a query that basically doesn't do nothing (because there are no 
other workers around)...
I'm available at night hours (CET, meaning  here are 10:00 AM now, I'm 
available in exactly 12 hours) in a gtalk session to further debug the 
immensely strange issue you're experiencing  of course, if you still 
want to get to the bottom of it.

-- 
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: Database insert of time field in web2py not working?

2013-11-12 Thread Niphlod
requires can be a list of validators.

On Tuesday, November 12, 2013 9:32:27 AM UTC+1, User wrote:
>
> Just realized I added the following lines after my db.define_table 
> statement:
>  
> db.sometable.start_time.notnull = True
> db.sometable.start_time.requires = IS_NOT_EMPTY()
>
>  
> I'm thinking that my assignment of IS_NOT_EMPTY() overwrote the default 
> IS_TIME() validator associated with time fields.  Does this sound like what 
> the problem is?  If so, how do I get around it?
>
> On Tuesday, November 12, 2013 3:24:36 AM UTC-5, User wrote:
>
>> I have some code that was working before but I can't quite pinpoint why 
>> it's not working now.  In any case it's a time field in a table and when I 
>> insert into this field the database shows '00:00:00' in the field (by 
>> looking at the record in an SQLite admin tool)
>>
>> Field('start_time','time', default='2:00PM'),
>>
>> I have a form where this value is inserted along with other form values.  
>> The insert statement looks like:
>>
>>  form.vars.id = db.sometable.insert(**db.sometable._filter_fields(form.
>> vars))
>>
>>  
>> I have inspected form.vars in the debugger immediately before this 
>> statement is executed and I can see form.vars.start_time has a string value 
>> such as '3:00PM'.  The insert statement executes with no error and the 
>> record is inserted in the database but the time field shows as 
>> 00:00:00. This further causes an error when trying to view the database 
>> record from web2py:
>>  
>> ValueError: invalid literal for int() with base 10: '00PM'
>>  
>>  
>> Any idea why the time is not inserting properly and how to fix it? Is the 
>> time string in the wrong format?
>>
>>

-- 
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: Database insert of time field in web2py not working?

2013-11-12 Thread User
Just realized I added the following lines after my db.define_table 
statement:
 
db.sometable.start_time.notnull = True
db.sometable.start_time.requires = IS_NOT_EMPTY()

 
I'm thinking that my assignment of IS_NOT_EMPTY() overwrote the default 
IS_TIME() validator associated with time fields.  Does this sound like what 
the problem is?  If so, how do I get around it?

On Tuesday, November 12, 2013 3:24:36 AM UTC-5, User wrote:

> I have some code that was working before but I can't quite pinpoint why 
> it's not working now.  In any case it's a time field in a table and when I 
> insert into this field the database shows '00:00:00' in the field (by 
> looking at the record in an SQLite admin tool)
>
> Field('start_time','time', default='2:00PM'),
>
> I have a form where this value is inserted along with other form values.  
> The insert statement looks like:
>
>  form.vars.id = db.sometable.insert(**db.sometable._filter_fields(form.
> vars))
>
>  
> I have inspected form.vars in the debugger immediately before this 
> statement is executed and I can see form.vars.start_time has a string value 
> such as '3:00PM'.  The insert statement executes with no error and the 
> record is inserted in the database but the time field shows as 
> 00:00:00. This further causes an error when trying to view the database 
> record from web2py:
>  
> ValueError: invalid literal for int() with base 10: '00PM'
>  
>  
> Any idea why the time is not inserting properly and how to fix it? Is the 
> time string in the wrong format?
>
>

-- 
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] Database insert of time field in web2py not working?

2013-11-12 Thread User


I have some code that was working before but I can't quite pinpoint why 
it's not working now.  In any case it's a time field in a table and when I 
insert into this field the database shows '00:00:00' in the field (by 
looking at the record in an SQLite admin tool)

Field('start_time','time', default='2:00PM'),

I have a form where this value is inserted along with other form values.  
The insert statement looks like:

 form.vars.id = db.sometable.insert(**db.sometable._filter_fields(form.vars
))

 
I have inspected form.vars in the debugger immediately before this 
statement is executed and I can see form.vars.start_time has a string value 
such as '3:00PM'.  The insert statement executes with no error and the 
record is inserted in the database but the time field shows as 
00:00:00. This further causes an error when trying to view the database 
record from web2py:
 
ValueError: invalid literal for int() with base 10: '00PM'
 
 
Any idea why the time is not inserting properly and how to fix it? Is the 
time string in the wrong format?

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