[web2py] Re: represent() question.

2013-12-15 Thread Avi A
great thanks.

On Sunday, December 15, 2013 1:00:47 AM UTC+2, Anthony wrote:

 You could always do something like:

 {{for i in range(len(all_items)):}}
 {{=A(all_items.render(i, fields=db.t_stores.owner_id).owner_id,
  _href=URL('default', 'stores', args=all_items[i].owner_id))}}
 {{pass}}

 Note, you don't have to specify the fields argument to .render(), but if 
 you only need one field rendered, that will be more efficient, as it won't 
 bother rendering the other fields.

 Anthony

 On Saturday, December 14, 2013 5:22:03 PM UTC-5, Avi A wrote:

 For example:
 a href=myapp/default/stores/onwer_idrepresnet(owner_id)/a

 On Saturday, December 14, 2013 11:57:02 PM UTC+2, Avi A wrote:

 One more question please,
 The thing is that I need both to be rendered, the represented and NOT 
 represented value, so I can use it in the args() for example to the user 
 profile or store link.?
 I tried back with the represent()method but I still get the:

 NoneType' object is not callable

 So if there is a different way, please let me know.

 thanks.


 On Saturday, December 14, 2013 11:00:53 PM UTC+2, Avi A wrote:

 allright, 2.8.2 is now working and all is rendered referenced as 
 expected using that:
 {{for item in all_items.render():}}
 {{=item.created_by}}
 {{=item.f_item_category}}
 {{=item.f_item_store}}
 {{pass}} 
 Thank you very much.
 On Saturday, December 14, 2013 10:28:50 PM UTC+2, Avi A wrote:

 during this chat I upgraded to 2.8.2 and now i am stuck with some erro 
 about:
  maxnum = MAXNFILES)
 in the admin/controller/default.
 :(


 On Saturday, December 14, 2013 10:24:40 PM UTC+2, Anthony wrote:

 Looks like there was a bug in the .render() code up until 2.7.2, so 
 you'll have to upgrade or edit dal.py to make it work. Even with the 
 bug, I 
 think you can instead do:

 {{for item in [all_items.render(i) for i in range(len(all_items))]:}}
 {{=item.created_by}}
 ...

 Anthony

 On Saturday, December 14, 2013 3:17:03 PM UTC-5, Anthony wrote:

 Can you show the whole traceback? I don't know why you'd be getting 
 that error. Which version of web2py?

 On Saturday, December 14, 2013 2:53:11 PM UTC-5, Avi A wrote:

 I tried {{for item in all_items.render():}}

 On Saturday, December 14, 2013 9:48:57 PM UTC+2, Anthony wrote:

 Did you do all_items.render() or all_items.repr()?

 On Saturday, December 14, 2013 2:12:31 PM UTC-5, Avi A wrote:

 when i try the render() metohod I get:

 AttributeError: 'Rows' object has no attribute 'repr'


 So I'm probably on a different versioon?


 On Saturday, December 14, 2013 8:02:08 PM UTC+2, Avi A wrote:

 Hi,
 I want to display item and use the represent() method to display 
 reference fields.
 def home():
 all_items = db(db.t_items).select()
 owner_rep = db.t_stores.created_by
 store_rep = db.t_stores.f_store_name
 category_rep = db.t_categories.f_category_name
 return dict(all_items = all_items, owner_rep = owner_rep, 
 store_rep = store_rep, category_rep = category_rep)

 #On the view page :
 {{for item in all_items:}}
 {{=owner_rep.represent(item.created_by)}}
 {{=category_rep.represent(item.f_item_category)}}
 {{=store_rep.represent(item.f_item_store)}}
 {{pass}}


 While it works for the {{=owner_rep... line, for any of the 
 other line I try to do the same (those under it) I get the error:

 TypeError: 'NoneType' object is not callable.

 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.


[web2py] Re: Distributing as a Binary - External Libraries?

2013-12-15 Thread Niphlod
err... actually it uses bbfreeze (for win) + py2app for mac ^_^


On Sunday, December 15, 2013 5:57:36 AM UTC+1, Massimo Di Pierro wrote:

 Actually web2py uses py2exe+py2app, not pyinstaller. Perhaps we should.

 Anyway, you are right that if you installed BeautifulSoup, it will not 
 ship with your apps. But, for pure python packages (and I think 
 BeautifulSoup is pure python), if you copy the package under your app 
 modules/ folder, then it will ship with it.

 Massimo



 On Saturday, 14 December 2013 19:46:59 UTC-6, Brando wrote:


 Let's say I package my app via this method: 
 http://web2py.com/AlterEgo/default/show/270.  If my underlying python 
 contains external libraries, will the program work?  Let's say I give the 
 app to someone who doesn't have the BeautifulSoup library installed.  Am I 
 correct in assuming the program would not work?  Mac or Windows platform.

 I know Web2py uses pyinstaller, does that handle the external 
 dependencies automatically?  I am new to Web2pysorry if this is a dumb 
 question.



-- 
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: Can not run web2py_no_console.exe. Version 2.8.2 on win 7 x 64

2013-12-15 Thread Niphlod
open a dos prompt, cd into the folder and try to start it from there to see 
if it prints something...

BTW: is web2py.exe working ? 

On Saturday, December 14, 2013 5:19:44 PM UTC+1, Сергей Ткаченко wrote:

 The program simply will not start. Start and exit.

 понедельник, 2 декабря 2013 г., 0:35:29 UTC+4 пользователь Alan Etkin 
 написал:

 Can not run web2py_no_console.exe. Version 2.8.2 on windows 7 x 64


 Can you post how did you execute it and what was the output?



-- 
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: Distributing as a Binary - External Libraries?

2013-12-15 Thread Massimo Di Pierro
That since 2.7.*, since you do the build. Until that we used py2exe. Thanks 
for the clarification.

On Sunday, 15 December 2013 06:33:45 UTC-6, Niphlod wrote:

 err... actually it uses bbfreeze (for win) + py2app for mac ^_^


 On Sunday, December 15, 2013 5:57:36 AM UTC+1, Massimo Di Pierro wrote:

 Actually web2py uses py2exe+py2app, not pyinstaller. Perhaps we should.

 Anyway, you are right that if you installed BeautifulSoup, it will not 
 ship with your apps. But, for pure python packages (and I think 
 BeautifulSoup is pure python), if you copy the package under your app 
 modules/ folder, then it will ship with it.

 Massimo



 On Saturday, 14 December 2013 19:46:59 UTC-6, Brando wrote:


 Let's say I package my app via this method: 
 http://web2py.com/AlterEgo/default/show/270.  If my underlying python 
 contains external libraries, will the program work?  Let's say I give the 
 app to someone who doesn't have the BeautifulSoup library installed.  Am I 
 correct in assuming the program would not work?  Mac or Windows platform.

 I know Web2py uses pyinstaller, does that handle the external 
 dependencies automatically?  I am new to Web2pysorry if this is a dumb 
 question.



-- 
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] how to custmize the layout in web2py

2013-12-15 Thread Asme
Hello,

After a long hesitation between Flask and web2py, I decide to give a try to 
web2py, It was the easier to install and create a simple web app (imo) 
after following this tutorial Crash Course in 
Web2pyhttp://mherman.org/blog/2012/11/27/crash-course-in-web2py-part-1/
.
BUT, here is my problem, I've no idea about how to customize the pages, I 
know it's possible to use those layout http://www.web2py.com/layouts, but I 
want use my own design with my own HTML and CSS. This is what I loved the 
most in Flask after flowing this tutorial on 
net.tutsplus.comhttp://net.tutsplus.com/tutorials/python-tutorials/an-introduction-to-pythons-flask-framework
. 

So can I achieve this?

Thank for your understanding and sorry for my english, I speak french.

-- 
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: Can not run web2py_no_console.exe. Version 2.8.2 on win 7 x 64

2013-12-15 Thread Rob Paire
Hello all,
 I am having same problem running on Windows server 2003 32bit. When I 
launch web2py.exe the following dialog error appears: 

*Title: Error Entry Point Not Found*

*Description: The procedure entry point wcscpy_s could not be located in 
the dynamic link library msvcrt.dll*

Clicking OK returns control to the web2py executable which fails with the 
following console message:

C:\web2pyweb2py
Traceback (most recent call last):
  File string, line 6, in module
  File __main__.py, line 128, in module
  File __main__web2py__.py, line 18, in module
  File /home/mdipierro/make_web2py/web2py/gluon/__init__.py, line 15, in 
modu
le
  File /home/mdipierro/make_web2py/web2py/gluon/globals.py, line 19, in 
modul
e
  File /home/mdipierro/make_web2py/web2py/gluon/xmlrpc.py, line 10, in 
module

  File SimpleXMLRPCServer.py, line 102, in module
  File xmlrpclib.py, line 144, in module
  File httplib.py, line 79, in module
  File mimetools.py, line 6, in module
  File tempfile.py, line 35, in module
  File random.py, line 879, in module
  File random.py, line 97, in __init__
  File random.py, line 111, in seed
WindowsError: [Error -2146893795] Provider DLL failed to initialize 
correctly

I reverted back to 2.7.4 for the time being.




-- 
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: how to custmize the layout in web2py

2013-12-15 Thread Anthony


 BUT, here is my problem, I've no idea about how to customize the pages, I 
 know it's possible to use those layout http://www.web2py.com/layouts, but 
 I want use my own design with my own HTML and CSS. This is what I loved the 
 most in Flask after flowing this tutorial on 
 net.tutsplus.comhttp://net.tutsplus.com/tutorials/python-tutorials/an-introduction-to-pythons-flask-framework
 . 

 So can I achieve this?


Of course. The welcome app is just a scaffolding app to get you started. 
You can completely scrap the default layout.html and start from scratch if 
you like. I suggest reading through the Page 
Layouthttp://web2py.com/books/default/chapter/29/05/the-views#Page-layoutsection
 of the book. Note, you'll likely want to have {{include 
'web2py_ajax.html'}} in your layout head (or at least load web2py.js).

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.


[web2py] Re: how to custmize the layout in web2py

2013-12-15 Thread Andrew W
And adding to what Anthony said, look at this web2py tutorial site which builds 
the ui from scratch.
http://killer-web-development.com/section/4/2

-- 
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: how to custmize the layout in web2py

2013-12-15 Thread Alan Etkin


 Thank for your understanding and sorry for my english, I speak french.


https://groups.google.com/forum/?fromgroups#!forum/web2py-fr 

-- 
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: how to custmize the layout in web2py

2013-12-15 Thread Asme
OK, maybe I was fast to take a look at the link you posted but, here is the 
thing: It feels like I've never see an HTML/CSS codes, ...
It's a little bit hard to explain what I want but here is the thing: After 
flowing this tutorial for 
Flaskhttp://net.tutsplus.com/tutorials/python-tutorials/an-introduction-to-pythons-flask-framework,
 
I have a full control on how the View side work.

So now, *How to completely scrap the default layout.html and start from 
SCRATCH?*

I think those Bootstrap stuff should be optional, It make things more 
confusing for beginner IMO,   
Le dimanche 15 décembre 2013 17:13:01 UTC, Anthony a écrit :


 Of course. The welcome app is just a scaffolding app to get you started. 
 You can completely scrap the default layout.html and start from scratch if 
 you like. I suggest reading through the Page 
 Layouthttp://web2py.com/books/default/chapter/29/05/the-views#Page-layoutsection
  of the book. Note, you'll likely want to have {{include 
 'web2py_ajax.html'}} in your layout head (or at least load web2py.js).

 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.


[web2py] Wappalyzer

2013-12-15 Thread Massimo Di Pierro
Can somebody help with this? It would be nice if it could recognize web2py.
One can submit a patch as explained here:

https://github.com/ElbertF/Wappalyzer/wiki/Contributing

To recognize web2py probably should look for web2py.js

-- 
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] web2py show() function. (explanation of a line of code)

2013-12-15 Thread deepak sandhu


so this is a function show() which I am trying to understand. in the model 
I do have a db.image table where I stored some images which is pointed in 
the function.

the only line I am not understanding here is

#image = db.image(request.args(0,cast=int))

In request.args(0, cast=int) why it has 0 as argument? and what does 
cast=int does? the complete function is below:

def show():
  image = db.image(request.args(0,cast=int)) or redirect(URL('index'))
  return dict(image=image)

-- 
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] web2py show() function. (explanation of a line of code)

2013-12-15 Thread Mirko Scavazzin
0=first arg
cast=int = convert it into int (it is a string actually)
IMHO


2013/12/15 deepak sandhu colirs...@gmail.com

 so this is a function show() which I am trying to understand. in the model
 I do have a db.image table where I stored some images which is pointed in
 the function.

 the only line I am not understanding here is

 #image = db.image(request.args(0,cast=int))

 In request.args(0, cast=int) why it has 0 as argument? and what does
 cast=int does? the complete function is below:

 def show():
   image = db.image(request.args(0,cast=int)) or redirect(URL('index'))
   return dict(image=image)

  --
 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: error using auth.wiki('slug') on service pages

2013-12-15 Thread Janko Strusa
Can at least someone try to reproduce this. I am using web2py version 2.8.2.

-- 
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: how to custmize the layout in web2py

2013-12-15 Thread Asme


Le dimanche 15 décembre 2013 19:36:11 UTC, Asme a écrit :


 Of course. The welcome app is just a scaffolding app to get you 
 started. You can completely scrap the default layout.html and start from 
 scratch if you like. I suggest reading through the Page 
 Layouthttp://web2py.com/books/default/chapter/29/05/the-views#Page-layout 
 section 
 of the book. Note, you'll likely want to have {{include 
 'web2py_ajax.html'}} in your layout head (or at least load web2py.js).

 Anthony


  
 It's a little bit hard to explain what I want but here is the thing: After 
 flowing this tutorial for 
 Flaskhttp://net.tutsplus.com/tutorials/python-tutorials/an-introduction-to-pythons-flask-framework,
  
 I have a full understanding on how the View side work.  


Ok, after some search on this forum, I found someone who have the *same 
problem 
https://groups.google.com/forum/#!searchin/web2py/scratch$20layout/web2py/H6OF-KtjtdQ/dddz0CTDM5cJ.
 *
Hope this will help you to help me.

-- 
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] DAL issues on production server (xen VM)

2013-12-15 Thread Yassen D.
Hello guys,

Recently updated from w2p 2.2.1 to 2.8.2 as I was advised; now random 
errors on database inserts started to raise for stuff that worked on the 
old version (2.2.1). Tracebacks of the two errors:

This is the most common one:

  File /home/www-data/web2py/gluon/scheduler.py, line 238, in executor
result = dumps(_function(*args, **vars))
  File applications/socialjack/modules/contactManager.py, line 97, in 
importSocialMediaContacts
if db.contacts.insert(contact_name=contact_name, url=url, 
network=network, user_id=user_id, ring=4):
  File /home/www-data/web2py/gluon/dal.py, line 9118, in insert
ret =  self._db._adapter.insert(self, self._listify(fields))
  File /home/www-data/web2py/gluon/dal.py, line 1347, in insert
id = self.lastrowid(table)
  File /home/www-data/web2py/gluon/dal.py, line 2724, in lastrowid
return int(self.cursor.fetchone()[0])
TypeError: 'NoneType' object has no attribute '__getitem__'

And I just noticed one more (more rare):

  File /home/www-data/web2py/gluon/scheduler.py, line 238, in executor
result = dumps(_function(*args, **vars))
  File applications/socialjack/modules/contactManager.py, line 97, in 
importSocialMediaContacts
if not db((db.contacts.url == url)  (db.contacts.user_id == 
user_id)).select():
  File /home/www-data/web2py/gluon/dal.py, line 10471, in select
return adapter.select(self.query,fields,attributes)
  File /home/www-data/web2py/gluon/dal.py, line 1862, in select
return self._select_aux(sql,fields,attributes)
  File /home/www-data/web2py/gluon/dal.py, line 1843, in _select_aux
return processor(rows,fields,self._colnames,cacheable=cacheable)
  File /home/www-data/web2py/gluon/dal.py, line 2227, in parse
value = row[j]
IndexError: tuple index out of range

These appear during long-running scheduler task that inserts records into a 
db table. The exact insert code is:

if not db((db.contacts.url == url)  (db.contacts.user_id == 
user_id)).select():
if db.contacts.insert(contact_name=contact_name, url=url, 
network=network, user_id=user_id, ring=4):
import_count += 1

Any suggestions why this happens?

The app runs on an ubuntu 12.04 xen VM;
w2p version: 2.8.2-stable+timestamp.2013.12.14.20.02.42
mysql-server version: 5.5.29-0ubuntu0.12.04.2

Any help is very much appreciated, thanks!
Yassen




-- 
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: error using auth.wiki('slug') on service pages

2013-12-15 Thread Alan Etkin


 Can at least someone try to reproduce this. I am using web2py version 
 2.8.2.


I will asap. Would you please file an issue at web2py.googlecode.com?

-- 
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: DAL issues on production server (xen VM)

2013-12-15 Thread Massimo Di Pierro
Do you user virtual fields? Are you doing migrations while the scheduler 
tasks are running. This is strange because it is a very fundamental piece 
of web2py code that has not changed in long time:

for (i,row) in enumerate(rows):
for (j,colname) in enumerate(colnames):
value = row[j]
 

On Sunday, 15 December 2013 15:39:34 UTC-6, Yassen D. wrote:

 Hello guys,

 Recently updated from w2p 2.2.1 to 2.8.2 as I was advised; now random 
 errors on database inserts started to raise for stuff that worked on the 
 old version (2.2.1). Tracebacks of the two errors:

 This is the most common one:

   File /home/www-data/web2py/gluon/scheduler.py, line 238, in executor
 result = dumps(_function(*args, **vars))
   File applications/socialjack/modules/contactManager.py, line 97, in 
 importSocialMediaContacts
 if db.contacts.insert(contact_name=contact_name, url=url, 
 network=network, user_id=user_id, ring=4):
   File /home/www-data/web2py/gluon/dal.py, line 9118, in insert
 ret =  self._db._adapter.insert(self, self._listify(fields))
   File /home/www-data/web2py/gluon/dal.py, line 1347, in insert
 id = self.lastrowid(table)
   File /home/www-data/web2py/gluon/dal.py, line 2724, in lastrowid
 return int(self.cursor.fetchone()[0])
 TypeError: 'NoneType' object has no attribute '__getitem__'

 And I just noticed one more (more rare):

   File /home/www-data/web2py/gluon/scheduler.py, line 238, in executor
 result = dumps(_function(*args, **vars))
   File applications/socialjack/modules/contactManager.py, line 97, in 
 importSocialMediaContacts
 if not db((db.contacts.url == url)  (db.contacts.user_id == 
 user_id)).select():
   File /home/www-data/web2py/gluon/dal.py, line 10471, in select
 return adapter.select(self.query,fields,attributes)
   File /home/www-data/web2py/gluon/dal.py, line 1862, in select
 return self._select_aux(sql,fields,attributes)
   File /home/www-data/web2py/gluon/dal.py, line 1843, in _select_aux
 return processor(rows,fields,self._colnames,cacheable=cacheable)
   File /home/www-data/web2py/gluon/dal.py, line 2227, in parse
 value = row[j]
 IndexError: tuple index out of range

 These appear during long-running scheduler task that inserts records into 
 a db table. The exact insert code is:

 if not db((db.contacts.url == url)  (db.contacts.user_id == 
 user_id)).select():
 if db.contacts.insert(contact_name=contact_name, url=url, 
 network=network, user_id=user_id, ring=4):
 import_count += 1

 Any suggestions why this happens?

 The app runs on an ubuntu 12.04 xen VM;
 w2p version: 2.8.2-stable+timestamp.2013.12.14.20.02.42
 mysql-server version: 5.5.29-0ubuntu0.12.04.2

 Any help is very much appreciated, thanks!
 Yassen






-- 
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: how to custmize the layout in web2py

2013-12-15 Thread Ovidio Marinho
hello, look this:
http://www.web2pyslices.com/slice/show/1516/adapt-a-css-template-to-web2py-layouthtml




 Ovidio Marinho Falcao Neto
  ITJP.NET.BR
 ovidio...@gmail.com
 Brasil



2013/12/15 Asme 4good...@gmail.com



 Le dimanche 15 décembre 2013 19:36:11 UTC, Asme a écrit :


 Of course. The welcome app is just a scaffolding app to get you
 started. You can completely scrap the default layout.html and start from
 scratch if you like. I suggest reading through the Page 
 Layouthttp://web2py.com/books/default/chapter/29/05/the-views#Page-layout 
 section
 of the book. Note, you'll likely want to have {{include
 'web2py_ajax.html'}} in your layout head (or at least load web2py.js).

 Anthony



 It's a little bit hard to explain what I want but here is the thing:
 After flowing this tutorial for 
 Flaskhttp://net.tutsplus.com/tutorials/python-tutorials/an-introduction-to-pythons-flask-framework,
 I have a full understanding on how the View side work.


 Ok, after some search on this forum, I found someone who have the *same
 problem
 https://groups.google.com/forum/#!searchin/web2py/scratch$20layout/web2py/H6OF-KtjtdQ/dddz0CTDM5cJ.
  *
 Hope this will help you to help me.

 --
 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] Jump to specific record with smartgrid

2013-12-15 Thread Scott Hunter
Is there a way to have a link go to a controller function that uses a smart 
grid, but instead of going to the top-level list view, goes directly to a 
record to be edited?  It looks like when going to such a page from the 
smart grid's list, it includes a signature which, if left out, causes a 
not authorized message; that is, if I take the URL that gets generated  
strip off the signature, I get the aforementioned message.

Or is the solution to use some other mechanism (CRUD, for example) to 
create my own edit page?

Thanks,
Scott

-- 
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: error using auth.wiki('slug') on service pages

2013-12-15 Thread Alan Etkin
What is the error you get?

Note that to prevent the wiki from caching the content (and then retrieving 
the same content for each auth.wiki) you should use the force_render=True 
kwarg option (False by default). Also, it seems that using that option 
would fail with your version. Check this issue

https://code.google.com/p/web2py/issues/detail?id=1818

-- 
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: how to custmize the layout in web2py

2013-12-15 Thread Anthony


 OK, maybe I was fast to take a look at the link you posted but, here is 
 the thing: It feels like I've never see an HTML/CSS codes, ...


I'm not sure what you mean. The Page Layout section of the book includes 
sample template code, which is of course a mixture of HTML and the web2py 
template syntax (just like the sample template code in the Flask tutorial). 
The book doesn't show any CSS samples because you use normal CSS files in 
web2py and simply link them in the head of the layout, as you would in any 
web page.
 

 It's a little bit hard to explain what I want but here is the thing: After 
 flowing this tutorial for 
 Flaskhttp://net.tutsplus.com/tutorials/python-tutorials/an-introduction-to-pythons-flask-framework,
  
 I have a full understanding on how the View side work.


Note, the beginning of the Page Layout section of the books shows a simple 
layout.html:

html
  head
titlePage Title/title
  /head
  body
{{include}}
  /body
/html

as well as a simple page that extends the layout:

{{extend 'layout.html'}}
h1Hello World/h1
{{include 'page.html'}}


It works much like the Flask example, with somewhat different syntax.
 

 So now, *How to completely scrap the default layout.html and start from 
 SCRATCH?*

 I think those Bootstrap stuff should be optional, It make things more 
 confusing for beginner IMO,   


The Bootstrap stuff *is* optional. As noted, you can create your own 
layout.html from scratch (see the simple example above).

Since it's not quite clear what you're looking for, it might be easier if 
you get started on your custom layout and come back with specific questions 
as you run into difficulties.

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.


[web2py] Re: how to custmize the layout in web2py

2013-12-15 Thread Anthony
Here is that Flask layout translated to web2py:

!DOCTYPE html
html
  head
titleweb2py/title
stronglink rel=stylesheet href={{=URL('static', 'css/main.css')}}
/strong
  /head
  body
header
  div class=container
h1 class=logoFlask App/h1
  /div
 /header

div class=container
  {{include}}
/div
  /body
/html

And the home page:

{{extend layout.html}}
  div class=jumbo
h2Welcome to the Flask apph2
h3This is the home page for the Flask apph3
  /div

Anthony

On Sunday, December 15, 2013 9:37:12 PM UTC-5, Anthony wrote:

 OK, maybe I was fast to take a look at the link you posted but, here is 
 the thing: It feels like I've never see an HTML/CSS codes, ...


 I'm not sure what you mean. The Page Layout section of the book includes 
 sample template code, which is of course a mixture of HTML and the web2py 
 template syntax (just like the sample template code in the Flask tutorial). 
 The book doesn't show any CSS samples because you use normal CSS files in 
 web2py and simply link them in the head of the layout, as you would in any 
 web page.
  

 It's a little bit hard to explain what I want but here is the thing: 
 After flowing this tutorial for 
 Flaskhttp://net.tutsplus.com/tutorials/python-tutorials/an-introduction-to-pythons-flask-framework,
  
 I have a full understanding on how the View side work.


 Note, the beginning of the Page Layout section of the books shows a simple 
 layout.html:

 html
   head
 titlePage Title/title
   /head
   body
 {{include}}
   /body
 /html

 as well as a simple page that extends the layout:

 {{extend 'layout.html'}}
 h1Hello World/h1
 {{include 'page.html'}}


 It works much like the Flask example, with somewhat different syntax.
  

 So now, *How to completely scrap the default layout.html and start from 
 SCRATCH?*

 I think those Bootstrap stuff should be optional, It make things more 
 confusing for beginner IMO,   


 The Bootstrap stuff *is* optional. As noted, you can create your own 
 layout.html from scratch (see the simple example above).

 Since it's not quite clear what you're looking for, it might be easier if 
 you get started on your custom layout and come back with specific questions 
 as you run into difficulties.

 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.


[web2py] Re: SQLForm Grid

2013-12-15 Thread LaDarrius Stewart
Nah that still brings back the entire set of records

On Friday, December 13, 2013 10:38:03 AM UTC-6, LaDarrius Stewart wrote:

 Is there to only give the add(create) functionality of the sqlform.grid 
 Example:
 db.define_table('Participant',
 Field('FirstName' , 'text'),
 Field('LastName' , 'text')

 fields = [ db.Participant.FirstName ]
 headers = {'Participant.FirstName': 'FirstName'}
 form2=SQLFORM.grid(db.Participant, fields=fields, searchable=False)

 On the grid displayed on a page it currently shows all Participant 
 records. I dont really even want the grid I just want the Add(create) 
 functionality. I dont even need the grid to bring back like somehow make 
 the query not auto execute so it doesnt bring back all the Participants. My 
 explanation might not be that clear if anyone needs further clarification 
 let me know any help is appreciated.


-- 
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: DAL issues on production server (xen VM)

2013-12-15 Thread Yassen D.


On Monday, December 16, 2013 2:46:00 AM UTC+2, Massimo Di Pierro wrote:

 Do you user virtual fields? Are you doing migrations while the scheduler 
 tasks are running. This is strange because it is a very fundamental piece 
 of web2py code that has not changed in long time:



Massimo, thanks for your reply!

No migration is done at all. No virtual fields as well. What I forgot to 
tell is that when it used to work, it was NOT run as a scheduled task, it 
was run within a controller.

I also find this very very strange -- the return 
int(self.cursor.fetchone()[0]) should always work once the record has been 
inserted. Also, It  breaks at a random record -- it is different each time. 
Seems like the MySQL server gets confused somehow ...

Can it be a memory problem? Or the VM system is not syncing properly? Just 
shooting in the dark.
Any clue anyone?  Thanks!
Yassen

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