Re: [web2py] Re: Deploying on Open Shift Error

2013-08-04 Thread Naveena Elsa Benjamin
Hi,

I tried doing what was said but it didn't work out for me.  I am trying to
install in windows 8 and it just didn't work and I keep getting the same
error again.

Thanks


On Sat, Aug 3, 2013 at 1:17 AM, Massimo Di Pierro 
massimo.dipie...@gmail.com wrote:

 You should use web2py form source and install distutils (
 http://stackoverflow.com/questions/3810521/how-to-install-python-distutils)
 and gitpython (https://pypi.python.org/pypi/GitPython/).

 On Saturday, 3 August 2013 02:51:27 UTC-5, ndave wrote:

 Hi,

 Could anyone tell me how to deploy the app we created on Open shift? I
 tried the option but I keep getting the error distutils not installed

 I need steps on how to deploy and what needs to be exactly done. I am
 stuck here and unable to proceed.

 Thanks,

  --

 ---
 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/4Nw0DcXfCsw/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.




-- 

--- 
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: web2py administrative interface

2013-08-04 Thread Annet
Hi,

Thanks for you reply.

I use ctrl+s without problems to save: did you try it ?


I first tried cmd+s but that invoked a 'save as' dialog, I then tried 
ctrl+s that does
work, however, I experience working with keyboard shortcuts as disruptive, I
prefer icons.

I work on a MacBook Pro with Snow Leopard or an iMac with Lion Server 
installed
and to work with applications that are not available for Mac I have a HP 
with
Windows installed.

I did try using keyboard shortcuts, but since the actions they invoke 
sometimes vary 
between both operating systems I gave up. I also found that the action a 
keyboard shortcut
invokes can vary between applications on the same operating system.


Kind regards,

Annet

-- 

--- 
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] Adjusting the width of the textarea

2013-08-04 Thread Paolo Caruccio
I think that the comment is wrong. Actually, the textarea width is not 
handled by web2py via js. Modern browsers, except IE, have a textarea 
resizable and so its width is calculated by browser itself. In this case in 
order to set a fixed width on all textareas you should set in your custom 
css

textarea {resize:none;}

Therefore, imho, your issue is due to other. If you post the interested 
code (html + css) we may help you.
 

Il giorno domenica 4 agosto 2013 06:50:45 UTC+2, davedigerati ha scritto:

 Actually, it is also set in the web2py_bootstrap.css line 105, which is 
 interesting, but not nearly as interesting as the comment ;)

 /* because web2py handles this via js */
 textarea { width:90%}

 soo, who knows the javascript well enough to say what is happening 
 here, and how we can regain overrideablility (lol that word is getting 
 worse by the post)

 On Saturday, August 3, 2013 9:57:34 AM UTC-4, Anthony wrote:

 Is this in the basic scaffolding app, or are you using custom CSS/JS? If 
 that latter, it's hard to say without seeing any code. In the scaffolding 
 app, the textarea width is set in bootstrap-responsive.min.css and should 
 be overrideable.

 Anthony

 On Saturday, August 3, 2013 12:59:31 AM UTC-4, davedigerati wrote:

 I'm bumping up against this on a form as well, and puzzled why using a 
 custom/clean css sheet loaded last in the page header for precedence, with 
 unique divs/classes aren't working on the textareas... not for size, 
 background-color, text color, nothing.  I can target the row, the parent 
 divs, etc, but not the textareas themselves.

 Is the jquery overwriting/hard-coding style properties?  I am using 
 jqueryui but still would expect specificity to work.

 I really want to find a css solution...???



-- 

--- 
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: web2py administrative interface

2013-08-04 Thread Niphlod
uhm. ok. but ctrl+s will work in any platform web2py is running on, because 
it's browser based, not system dependant. ctrl+s is a pretty standard 
combination for saving the current document in any text editor beyond 
window's notepad.

On Sunday, August 4, 2013 8:58:53 AM UTC+2, Annet wrote:

 Hi,

 Thanks for you reply.

 I use ctrl+s without problems to save: did you try it ?


 I first tried cmd+s but that invoked a 'save as' dialog, I then tried 
 ctrl+s that does
 work, however, I experience working with keyboard shortcuts as disruptive, 
 I
 prefer icons.

 I work on a MacBook Pro with Snow Leopard or an iMac with Lion Server 
 installed
 and to work with applications that are not available for Mac I have a HP 
 with
 Windows installed.

 I did try using keyboard shortcuts, but since the actions they invoke 
 sometimes vary 
 between both operating systems I gave up. I also found that the action a 
 keyboard shortcut
 invokes can vary between applications on the same operating system.


 Kind regards,

 Annet


-- 

--- 
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] Adjusting the width of the textarea

2013-08-04 Thread Anthony
Can you use the browser developer tools to inspect the element and see 
which CSS rule is active and where it comes from? Also, try disabling 
Javascript and see if that affects the display. If all else fails, pack a 
basic app that demonstrates the problem and attach it here.

Anthony

On Sunday, August 4, 2013 12:50:45 AM UTC-4, davedigerati wrote:

 Actually, it is also set in the web2py_bootstrap.css line 105, which is 
 interesting, but not nearly as interesting as the comment ;)

 /* because web2py handles this via js */
 textarea { width:90%}

 soo, who knows the javascript well enough to say what is happening 
 here, and how we can regain overrideablility (lol that word is getting 
 worse by the post)

 On Saturday, August 3, 2013 9:57:34 AM UTC-4, Anthony wrote:

 Is this in the basic scaffolding app, or are you using custom CSS/JS? If 
 that latter, it's hard to say without seeing any code. In the scaffolding 
 app, the textarea width is set in bootstrap-responsive.min.css and should 
 be overrideable.

 Anthony

 On Saturday, August 3, 2013 12:59:31 AM UTC-4, davedigerati wrote:

 I'm bumping up against this on a form as well, and puzzled why using a 
 custom/clean css sheet loaded last in the page header for precedence, with 
 unique divs/classes aren't working on the textareas... not for size, 
 background-color, text color, nothing.  I can target the row, the parent 
 divs, etc, but not the textareas themselves.

 Is the jquery overwriting/hard-coding style properties?  I am using 
 jqueryui but still would expect specificity to work.

 I really want to find a css solution...???



-- 

--- 
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: GET request from kendo ui returning an invalid argument

2013-08-04 Thread Simon Ashley
Solution:

This _=1375342185703 is appended by jQuery.ajax which the Kendo DataSource 
uses under the hood. That thing is used as a cache buster (prevents browser 
caching). The fix is simple - disable jQuery caching:

transport: {
   read: {
  url: your service,
  dataType: jsonp,
  cache: true // enable caching which disables the cache buster
   }
}

-- 

--- 
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 default controller size and line count

2013-08-04 Thread yunus santur
hi web2py users i have two questions

1) in my application admin application is very very slow during edit 
default.py because its size 24Mbyte on disk, i check windows and linux 
reaally seems 24MBytes but it has only 611 lines
really i don't understand .

2) in my applications have 4-5 groups of user and i use  
@auth.requires_membership('admin')   decatorus access the functions,
and use menu for groups for example

1) if grup_A == response.menu += [ some submenus]
2) if grup B == response.menu += [ some other submenus]

its perfectyl run for all grups but one errors with  ValueError: need more 
than 1 value to 
unpackhttp://stackoverflow.com/questions/2814128/python-error-valueerror-need-more-than-1-value-to-unpack
 i 
change grup name and role but 

here is my code for adding response.menu in default.py

*def init1():*
*try:*
*user=auth.user.id*
*
g=db(db.auth_membership.user_id==user).select(db.auth_membership.group_id).first()['auth_membership.group_id']
*
*
grup=db(db.auth_group.id==g).select(db.auth_group.role).first()['auth_group.role']
*
*if grup==paket_lider:*
*pass*
*'''*
*response.menu += [*
*(SPAN('Paket Yönetimi', _class='highlighted'), False, 
False,URL('paket'), [*
* #veri giriş menüleri*
* (T('Paket İşlemleri'), False,URL('paket')),*
* (T('Paketi Gör'), False,URL('paket_lider')),*
*  (T('Paketleri Oyla'), False,URL('paket_oyla')),*
* (T('Firmalar'), False,URL('firmalar')),*
* (T('Kişiler'), False,URL('kisiler')),])]*
*   '''*
*except Exception,e:*
*response.write(error +str(e))*
*return*
*
*
this code perfectly run for grup admin, kisi,firma but not running 
for paket, 

-- 

--- 
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 call a controller funtion on click of a button?

2013-08-04 Thread Anthony


 So the usual button to redirect to another page I use this

 button type=button class=btn btn-primary 
 onclick=location.href='{{=URL('gameTime')}}'Done with my squares/button


 What I am trying to do is click a button that does NOT redirect.  If I use 
 a function in defauly.py that has no view in the URL field above, it loads 
 the generic view as advertised.  Grrr.  Isn't there just a simple way to 
 suppress calling the generic view?  Just leave the view and retreat into 
 the controller for a little code parsing? ;)


First, generic views are disabled by default (though enabled on localhost 
in the welcome app via a line in db.py). Second, views are only called if 
your controller action returns a dictionary -- so just don't return a 
dictionary.

button type=button class=btn btn-primary onclick=jQuery.ajax('{{=URL('
gameTime')}}');Done with my squares/button

def gameTime():
[do something]
return 'OK'

Anthony

-- 

--- 
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: web2py default controller size and line count

2013-08-04 Thread Anthony
On Sunday, August 4, 2013 7:24:55 AM UTC-4, yunus santur wrote:

 hi web2py users i have two questions

 1) in my application admin application is very very slow during edit 
 default.py because its size 24Mbyte on disk, i check windows and linux 
 reaally seems 24MBytes but it has only 611 lines
 really i don't understand .


What happens if you use a text editor to copy the 611 lines to a new text 
file?

-- 

--- 
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] auth.user question

2013-08-04 Thread Mark Finkelstein
I have two lines of code that read as follows:

if auth.user:
if db.auth_user[auth.user.id]['image']=='' or db.auth_user[auth.user.id
]['image']==None:

Recently, while logged in, I dropped all the tables, refreshed the page and 
then got an Internal Error saying

 if db.auth_user[auth.user.id]['image']=='' or db.auth_user[auth.user.id][
'image']==None:
TypeError: 'NoneType' object has no attribute '__getitem__'

I'm guessing it has to do with cookies saving the session, where the web2py 
side recognizes what seems to be a session and building auth.user based off 
of this, but I'm not quite sure why auth.user is built without a query 
check of the database? I was wondering why this is?

-- 

--- 
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: more buttons on the SQLFORM, how to add them into templates using form custom layout ...?

2013-08-04 Thread Massimo Di Pierro
I do not understand. :-(


On Saturday, 3 August 2013 05:21:22 UTC-5, David Marko wrote:

 I would like to add more buttons to SQLFORM using the syntax below. How 
 can I address these buttons on template when I render content manualy? For 
 common submit filed I'm using {{=form.custom.submit}} ... how to address 
 these additional buttons?

 form.add_button('Back', URL('other_page'))

 or

 buttons = [TAG.button('Back',_type=button,_onClick = parent.location='%s' 
  % URL(...),
  TAG.button('Next',_type=submit)]



-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




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

2013-08-04 Thread Massimo Di Pierro
Please open a ticket about this.

On Saturday, 3 August 2013 07:06:13 UTC-5, Adi wrote:

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

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


 Ticket ID 

 127.0.0.1.2013-08-03.08-03-20.34cb1611-c6d4-46fc-b59e-106ad21d723e
 class 'gluon.contrib.pymysql.err.InternalError' (1071, u'Specified key 
 was too long; max key length is 767 bytes') Version  web2py™ Version 
 2.6.0-development+timestamp.2013.08.01.08.22.32  Traceback 

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

 Traceback (most recent call last):
   File /Users/adnan/web2py24/gluon/restricted.py, line 212, in restricted
 exec ccode in environment
   File /Users/adnan/web2py24/applications/bsp/models/db.py 
 http://127.0.0.1:8000/admin/default/edit/bsp/models/db.py, line 84, in 
 module
 auth.wiki(resolve=False)
   File /Users/adnan/web2py24/gluon/tools.py, line 3467, in wiki
 function=function)
   File /Users/adnan/web2py24/gluon/tools.py, line 5152, in __init__
 db.define_table(key, *args, **value['vars'])
   File /Users/adnan/web2py24/gluon/dal.py, line 7779, in define_table
 table = self.lazy_define_table(tablename,*fields,**args)
   File /Users/adnan/web2py24/gluon/dal.py, line 7816, in lazy_define_table
 polymodel=polymodel)
   File /Users/adnan/web2py24/gluon/dal.py, line 1021, in create_table
 fake_migrate=fake_migrate)
   File /Users/adnan/web2py24/gluon/dal.py, line 1126, in migrate_table
 self.execute(sub_query)
   File /Users/adnan/web2py24/gluon/dal.py, line 1816, in execute
 return self.log_execute(*a, **b)
   File /Users/adnan/web2py24/gluon/dal.py, line 1810, in log_execute
 ret = self.cursor.execute(command, *a[1:], **b)
   File /Users/adnan/web2py24/gluon/contrib/pymysql/cursors.py, line 117, in 
 execute
 self.errorhandler(self, exc, value)
   File /Users/adnan/web2py24/gluon/contrib/pymysql/connections.py, line 
 202, in defaulterrorhandler
 raise errorclass, errorvalue
 InternalError: (1071, u'Specified key was too long; max key length is 767 
 bytes')




-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: IS web2py good for largescale

2013-08-04 Thread Massimo Di Pierro
To me there are three issues with scalability:
- database, it is always the bottle neck but there is no differencd between 
web2py and rails in principle. They can use the same database architecture.
- filesystem. web2py by default uses the filesystem more than rails (to 
store sessions for example). It needs to be configured to store everything 
on database or, better, to use sticky sessions
- caching. You need to cache as much as you can. The built-in system is ok 
if you have one web2py instance and if you reuse the same keys else you can 
have a memory leak (keys do not expire with cache.ram). It is better to use 
proper caching, for example redis. Both web2py and rails work well with 
Redis. This should always be the last step in development anyway.
- use nginx to serve static files.

Everything else should not affect scalability.

On Saturday, 3 August 2013 14:18:07 UTC-5, Joe Barnhart wrote:

 I'm not the OP, but I am also risking web2py on a large project...

 In my case I'm replacing a Rails site that services about 15,000 customers 
 and has a variable workload -- about 5000 users compete for time on the 
 site every week.  It has a database size of about 20GB of small records 
 (~1K ea.) and each user will require about 200-500 DB requests over the 
 typical session of about 30 min.  The site currently does about $200k in CC 
 charges per month.

 I am looking at deployment on OpenShift or its brothers, or AWS.  I 
 considered GAE but the limitations on join make life difficult for me as 
 my db is extensively indexed and cross-linked.  It has about 40 tables and 
 they participate in a lot of 1:many joins.  I'm pretty happy with 
 PostgreSQL as my database but I have not determined the right web server 
 platform for me.  I'm actually a bit mystified by the choices (nginx, 
 apache, etc) so I'm getting a friend who knows a lot more than I to help in 
 that area.

 As a developer, web2py thrills me.  Having lurked here a lot I'm pretty 
 confident it can be scaled up to handle the load, but there's always a risk 
 -- is my db schema flawed in some way, or other design decisions that 
 crater performance?  The current Rails site is pretty well loved but it 
 bogs and people are not happy with response time.  Also, my end goal is to 
 scale this site x10 or more, so scalability and stability are paramount!

 -- Joe B.

 P.S.  I'm going to tithe a percentage of my site's profits back to web2py 
 development when it is up. I believe in giving back to those who help you 
 achieve.

 P.P.S.  No, it's not a p0rn site... ;-)

 On Friday, August 2, 2013 2:46:31 PM UTC-7, Aurelio Tinio wrote:

 Curious to hear, what do you consider large scale?
 The more detailed you are about your project the better the response the 
 community can provide.

 Fwiw, having only worked with web2py since the beginning of the year I've 
 been contemplating similar questions too and essentially the answer is... 
 *it depends*. I've predominantly worked with other web frameworks 
 (mainly Django) in the past and there are definite pros/cons/tradeoffs in 
 my mind of why it'd be better to choose one versus the other. Happy to 
 elaborate but again, please provide more info so the reply could be more 
 targeted.

 Cheers.

 On Thursday, August 1, 2013 8:04:27 PM UTC-7, hello world wrote:

 Hey
 I would like to know if web2py framework ...is a good framework for 
 making large scale websites...???..



-- 

--- 
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: auth.user question

2013-08-04 Thread Massimo Di Pierro
If you are not logged in db.auth_user[auth.user.id] is None.


On Sunday, 4 August 2013 09:10:09 UTC-5, Mark Finkelstein wrote:

 I have two lines of code that read as follows:

 if auth.user:
 if db.auth_user[auth.user.id]['image']=='' or db.auth_user[auth.user.
 id]['image']==None:

 Recently, while logged in, I dropped all the tables, refreshed the page 
 and then got an Internal Error saying

  if db.auth_user[auth.user.id]['image']=='' or db.auth_user[auth.user.id][
 'image']==None:
 TypeError: 'NoneType' object has no attribute '__getitem__'

 I'm guessing it has to do with cookies saving the session, where the 
 web2py side recognizes what seems to be a session and building auth.user 
 based off of this, but I'm not quite sure why auth.user is built without a 
 query check of the database? I was wondering why this is?


-- 

--- 
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: web2py administrative interface

2013-08-04 Thread Annet


 uhm. ok. but ctrl+s will work in any platform web2py is running on, 
 because it's browser based, not system dependant. ctrl+s is a pretty 
 standard combination for saving the current document in any text editor 
 beyond window's notepad.


I am not sure it is on Mac, Pages and TextEdit warn me of an incorrect key 
combination when I do ctrl+s. In Safari and Firefox ctrl+s does work, so I 
guess I'll
have to get used to using keyboard shortscuts then.


Kind regards,

Annet

-- 

--- 
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: IS web2py good for largescale

2013-08-04 Thread Loïc
Hello Massimo

Could you please elaborate the following sentence, and if possible give an 
example of what we should do/avoid?

built-in system is ok if you have one web2py instance and if you reuse the 
same keys else you can have a memory leak (keys do not expire with cache.ram).

Thank you

-- 

--- 
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: Deploying on Open Shift Error

2013-08-04 Thread dhmorgan
so are you now running web2py from source, using Python 2.6 or 2.7 ? 



On Sunday, August 4, 2013 1:36:24 AM UTC-5, ndave wrote:

 Hi,

 I tried doing what was said but it didn't work out for me.  I am trying to 
 install in windows 8 and it just didn't work and I keep getting the same 
 error again.

 Thanks


 On Sat, Aug 3, 2013 at 1:17 AM, Massimo Di Pierro 
 massimo@gmail.comjavascript:
  wrote:

 You should use web2py form source and install distutils (
 http://stackoverflow.com/questions/3810521/how-to-install-python-distutils) 
 and gitpython (https://pypi.python.org/pypi/GitPython/).

 On Saturday, 3 August 2013 02:51:27 UTC-5, ndave wrote:

 Hi,

 Could anyone tell me how to deploy the app we created on Open shift? I 
 tried the option but I keep getting the error distutils not installed

 I need steps on how to deploy and what needs to be exactly done. I am 
 stuck here and unable to proceed.

 Thanks,

  -- 
  
 --- 
 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/4Nw0DcXfCsw/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to 
 web2py+un...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/groups/opt_out.
  
  




-- 

--- 
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: auth.user question

2013-08-04 Thread Mark Finkelstein
I get  the following error for trying that:
print db.auth_user[auth.user.id]
AttributeError: 'NoneType' object has no attribute 'id'

I thought `auth.user` is supposed to be used to check if the user is logged 
in?

On Sunday, August 4, 2013 10:35:14 AM UTC-4, Massimo Di Pierro wrote:

 If you are not logged in db.auth_user[auth.user.id] is None.


 On Sunday, 4 August 2013 09:10:09 UTC-5, Mark Finkelstein wrote:

 I have two lines of code that read as follows:

 if auth.user:
 if db.auth_user[auth.user.id]['image']=='' or db.auth_user[auth.user.
 id]['image']==None:

 Recently, while logged in, I dropped all the tables, refreshed the page 
 and then got an Internal Error saying

  if db.auth_user[auth.user.id]['image']=='' or db.auth_user[auth.user.id
 ]['image']==None:
 TypeError: 'NoneType' object has no attribute '__getitem__'

 I'm guessing it has to do with cookies saving the session, where the 
 web2py side recognizes what seems to be a session and building auth.user 
 based off of this, but I'm not quite sure why auth.user is built without a 
 query check of the database? I was wondering why this is?



-- 

--- 
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: Quick contract job

2013-08-04 Thread Dmitri Husti
Hi,
Success?
Your deadline is over, do you need someone else for web2py?
Im not a professional but most of the questions you posted I could answer 
:P.

Best regards
Dmitri Husti

Am Donnerstag, 1. August 2013 06:11:59 UTC+2 schrieb davedigerati:

 I have been learning web2py for a project and while I am really enjoying 
 it I am up against a deadline for my client and looking for help.

 I would like to hire someone (preferably one of the frequent contributors 
 as a way of saying thank you, this is a great community;) to take care of 
 one sticking point, which I suspect a knowledgable web2py'er could knock 
 out in an hour or two.  Deadline is noon E.S.T. this Saturday and I'll pay 
 for a working solution through paypal.

 If interested please contact hyprlyt at the usual big G's email domain and 
 I will explain in more detail.
 Thanks!
 Dave


-- 

--- 
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: Problem with function [pyfpdf] add_font() on GAE.

2013-08-04 Thread Christian Foster Howes
after a quick moment of asking google i saw the suggestions that your error 
indicates something wrong with the pickled itemwhich i think in this 
case is the font file.  is your font file in the right format to be loaded 
by fpdf?  (i have no familiarity with this error or fpdf so i'm just 
throwing out suggestions).

good luck!

cfh

On Saturday, August 3, 2013 4:40:10 AM UTC-7, Brez Yl wrote:

 In FILE: 
 /base/data/home/apps/s~myapp/web2py-04.369240954601780983/applications/app3/controllers/default.py

 Traceback (most recent call last):
   File 
 /base/data/home/apps/s~myapp/web2py-04.369240954601780983/gluon/restricted.py,
  line 212, in restricted
 exec ccode in environment
   File 
 /base/data/home/apps/s~myapp/web2py-04.369240954601780983/applications/app3/controllers/default.py,
  line 674, in module
   File 
 /base/data/home/apps/s~myapp/web2py-04.369240954601780983/gluon/globals.py, 
 line 194, in lambda
 self._caller = lambda f: f()
   File 
 /base/data/home/apps/s~myapp/web2py-04.369240954601780983/applications/app3/controllers/default.py,
  line 493, in up_plik
 pdf.add_font('DejaVu', '', 'DejaVuSansCondensed.ttf', uni=True)
   File 
 /base/data/home/apps/s~myapp/web2py-04.369240954601780983/gluon/contrib/fpdf/fpdf.py,
  line 432, in add_font
 font_dict = pickle.load(fh)
   File 
 /base/data/home/runtimes/python27p/python27_dist/lib/python2.7/pickle.py, 
 line 1378, in load
 return Unpickler(file).load()
   File 
 /base/data/home/runtimes/python27/python27_dist/lib/python2.7/pickle.py, 
 line 858, in load
 dispatch[key](self)
   File 
 /base/data/home/runtimes/python27/python27_dist/lib/python2.7/pickle.py, 
 line 966, in load_string
 raise ValueError, insecure string pickle
 ValueError: insecure string pickle




 On Saturday, August 3, 2013 10:24:28 AM UTC+2, Christian Foster Howes 
 wrote:

 can you post the stack trace to help us understand what went wrong?

 On Friday, August 2, 2013 3:19:43 AM UTC-7, Brez Yl wrote:

 Hello!

 I'm writing an app, which results with pdf file with some text with 
 unicode characters. On local GAE it works good, but after deploy it can't 
 import crash after add_font() (pyfpdf).

 The code is:

 # -*- coding: utf-8 -*-
 def fun1(): 

 from gluon.contrib.pyfpdf import FPDF, HTMLMixin
 class MyFPDF(FPDF, HTMLMixin):
 pass

 pdf =MyFPDF()
 pdf.add_font('DejaVu', '', 'DejaVuSansCondensed.ttf', uni=True)
 pdf.add_page()
 pdf.set_font('DejaVu','',16)
 pdf.write(10,'testąśł')
 
 response.headers['Content-Type']='application/pdf'
 return pdf.output(dest='S')

 The font files (with a file *DejaVuSansCondensed.pkl* generated after 
 first run on web2py server...) is in /gluon/contrib/fpdf/font. I didn't 
 add anything to routers.py (I'm using Pattern-based system) also app.yaml 
 is not changed.

 As I said on local (both web2py and gae) it works well. After deploy 
 only something like this works:
 pdf =MyFPDF()
 pdf.add_page()
 pdf.set_font('Arial','',16)
 pdf.write(10,'testąśł')

 But without unusual characters...

 The best solution would be to add my font files (like DejaVu), but 
 basically I need unicode characters in any font... maybe some 
 half-solution to use generic GAE unicode fonts... if it exist something 
 like this...



-- 

--- 
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: Problem with function [pyfpdf] add_font() on GAE.

2013-08-04 Thread Brez Yl
I think, the file is ok, for pdf/pyfpdf (as I said, it works good on 
devservers). But maybe it is, in some way wrong for GAE... I'm confused. 
But thanks for suggestion.

On Sunday, August 4, 2013 6:42:28 PM UTC+2, Christian Foster Howes wrote:

 after a quick moment of asking google i saw the suggestions that your 
 error indicates something wrong with the pickled itemwhich i think in 
 this case is the font file.  is your font file in the right format to be 
 loaded by fpdf?  (i have no familiarity with this error or fpdf so i'm just 
 throwing out suggestions).

 good luck!

 cfh

 On Saturday, August 3, 2013 4:40:10 AM UTC-7, Brez Yl wrote:

 In FILE: 
 /base/data/home/apps/s~myapp/web2py-04.369240954601780983/applications/app3/controllers/default.py

 Traceback (most recent call last):
   File 
 /base/data/home/apps/s~myapp/web2py-04.369240954601780983/gluon/restricted.py,
  line 212, in restricted
 exec ccode in environment
   File 
 /base/data/home/apps/s~myapp/web2py-04.369240954601780983/applications/app3/controllers/default.py,
  line 674, in module
   File 
 /base/data/home/apps/s~myapp/web2py-04.369240954601780983/gluon/globals.py,
  line 194, in lambda
 self._caller = lambda f: f()
   File 
 /base/data/home/apps/s~myapp/web2py-04.369240954601780983/applications/app3/controllers/default.py,
  line 493, in up_plik
 pdf.add_font('DejaVu', '', 'DejaVuSansCondensed.ttf', uni=True)
   File 
 /base/data/home/apps/s~myapp/web2py-04.369240954601780983/gluon/contrib/fpdf/fpdf.py,
  line 432, in add_font
 font_dict = pickle.load(fh)
   File 
 /base/data/home/runtimes/python27p/python27_dist/lib/python2.7/pickle.py, 
 line 1378, in load
 return Unpickler(file).load()
   File 
 /base/data/home/runtimes/python27/python27_dist/lib/python2.7/pickle.py, 
 line 858, in load
 dispatch[key](self)
   File 
 /base/data/home/runtimes/python27/python27_dist/lib/python2.7/pickle.py, 
 line 966, in load_string
 raise ValueError, insecure string pickle
 ValueError: insecure string pickle




 On Saturday, August 3, 2013 10:24:28 AM UTC+2, Christian Foster Howes 
 wrote:

 can you post the stack trace to help us understand what went wrong?

 On Friday, August 2, 2013 3:19:43 AM UTC-7, Brez Yl wrote:

 Hello!

 I'm writing an app, which results with pdf file with some text with 
 unicode characters. On local GAE it works good, but after deploy it can't 
 import crash after add_font() (pyfpdf).

 The code is:

 # -*- coding: utf-8 -*-
 def fun1(): 

 from gluon.contrib.pyfpdf import FPDF, HTMLMixin
 class MyFPDF(FPDF, HTMLMixin):
 pass

 pdf =MyFPDF()
 pdf.add_font('DejaVu', '', 'DejaVuSansCondensed.ttf', uni=True)
 pdf.add_page()
 pdf.set_font('DejaVu','',16)
 pdf.write(10,'testąśł')
 
 response.headers['Content-Type']='application/pdf'
 return pdf.output(dest='S')

 The font files (with a file *DejaVuSansCondensed.pkl* generated after 
 first run on web2py server...) is in /gluon/contrib/fpdf/font. I 
 didn't add anything to routers.py (I'm using Pattern-based system) also 
 app.yaml is not changed.

 As I said on local (both web2py and gae) it works well. After deploy 
 only something like this works:
 pdf =MyFPDF()
 pdf.add_page()
 pdf.set_font('Arial','',16)
 pdf.write(10,'testąśł')

 But without unusual characters...

 The best solution would be to add my font files (like DejaVu), but 
 basically I need unicode characters in any font... maybe some 
 half-solution to use generic GAE unicode fonts... if it exist 
 something 
 like this...



-- 

--- 
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: Problem with function [pyfpdf] add_font() on GAE.

2013-08-04 Thread Christian Foster Howes
perhaps try printing the string fh at line 42 of 
gluon/contrib/fpdf/fpdf.py ?  maybe that will shed some light


do you know if the path to the font you are adding in your controller is 
correct for GAE?  i don't remember off the top of my head the default 
file path on GAE.


cfh

On 8/4/13 9:47 , Brez Yl wrote:

I think, the file is ok, for pdf/pyfpdf (as I said, it works good on
devservers). But maybe it is, in some way wrong for GAE... I'm confused.
But thanks for suggestion.

On Sunday, August 4, 2013 6:42:28 PM UTC+2, Christian Foster Howes wrote:


after a quick moment of asking google i saw the suggestions that your
error indicates something wrong with the pickled itemwhich i think in
this case is the font file.  is your font file in the right format to be
loaded by fpdf?  (i have no familiarity with this error or fpdf so i'm just
throwing out suggestions).

good luck!

cfh

On Saturday, August 3, 2013 4:40:10 AM UTC-7, Brez Yl wrote:


In FILE: 
/base/data/home/apps/s~myapp/web2py-04.369240954601780983/applications/app3/controllers/default.py

Traceback (most recent call last):
   File 
/base/data/home/apps/s~myapp/web2py-04.369240954601780983/gluon/restricted.py,
 line 212, in restricted
 exec ccode in environment
   File 
/base/data/home/apps/s~myapp/web2py-04.369240954601780983/applications/app3/controllers/default.py,
 line 674, in module
   File /base/data/home/apps/s~myapp/web2py-04.369240954601780983/gluon/globals.py, 
line 194, in lambda
 self._caller = lambda f: f()
   File 
/base/data/home/apps/s~myapp/web2py-04.369240954601780983/applications/app3/controllers/default.py,
 line 493, in up_plik
 pdf.add_font('DejaVu', '', 'DejaVuSansCondensed.ttf', uni=True)
   File 
/base/data/home/apps/s~myapp/web2py-04.369240954601780983/gluon/contrib/fpdf/fpdf.py,
 line 432, in add_font
 font_dict = pickle.load(fh)
   File 
/base/data/home/runtimes/python27p/python27_dist/lib/python2.7/pickle.py, 
line 1378, in load
 return Unpickler(file).load()
   File 
/base/data/home/runtimes/python27/python27_dist/lib/python2.7/pickle.py, line 
858, in load
 dispatch[key](self)
   File 
/base/data/home/runtimes/python27/python27_dist/lib/python2.7/pickle.py, line 
966, in load_string
 raise ValueError, insecure string pickle
ValueError: insecure string pickle




On Saturday, August 3, 2013 10:24:28 AM UTC+2, Christian Foster Howes
wrote:


can you post the stack trace to help us understand what went wrong?

On Friday, August 2, 2013 3:19:43 AM UTC-7, Brez Yl wrote:


Hello!

I'm writing an app, which results with pdf file with some text with
unicode characters. On local GAE it works good, but after deploy it can't
import crash after add_font() (pyfpdf).

The code is:

# -*- coding: utf-8 -*-
def fun1():

 from gluon.contrib.pyfpdf import FPDF, HTMLMixin
 class MyFPDF(FPDF, HTMLMixin):
 pass

 pdf =MyFPDF()
 pdf.add_font('DejaVu', '', 'DejaVuSansCondensed.ttf', uni=True)
 pdf.add_page()
 pdf.set_font('DejaVu','',16)
 pdf.write(10,'testąśł')

 response.headers['Content-Type']='application/pdf'
 return pdf.output(dest='S')

The font files (with a file *DejaVuSansCondensed.pkl* generated after
first run on web2py server...) is in /gluon/contrib/fpdf/font. I
didn't add anything to routers.py (I'm using Pattern-based system) also
app.yaml is not changed.

As I said on local (both web2py and gae) it works well. After deploy
only something like this works:
 pdf =MyFPDF()
 pdf.add_page()
 pdf.set_font('Arial','',16)
 pdf.write(10,'testąśł')

But without unusual characters...

The best solution would be to add my font files (like DejaVu), but
basically I need unicode characters in any font... maybe some
half-solution to use generic GAE unicode fonts... if it exist something
like this...







--

--- 
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: more buttons on the SQLFORM, how to add them into templates using form custom layout ...?

2013-08-04 Thread Anthony
On Saturday, August 3, 2013 6:21:22 AM UTC-4, David Marko wrote:

 I would like to add more buttons to SQLFORM using the syntax below. How 
 can I address these buttons on template when I render content manualy? For 
 common submit filed I'm using {{=form.custom.submit}} ... how to address 
 these additional buttons?

 form.add_button('Back', URL('other_page'))

 In the above case, all the buttons (including the original submit button) 
will be in form.custom.submit.parent (which is a TD object if your form 
uses one of the table formats). To access the list, you can do 
form.custom.submit.parent.components, and then index that to get a 
particular button.

buttons = [TAG.button('Back',_type=button,_onClick = parent.location='%s'  
% URL(...),
  TAG.button('Next',_type=submit)]

 The above is just a list of buttons, so include them in your view as you 
would any other helper objects:

{{=buttons[0]}}

As long as you're constructing custom HTML for the form, another option is 
just to create the buttons in HTML (or using web2py helpers) right where 
you need them in the template.

Anthony

-- 

--- 
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] read a field from a row based on a (wait for it...) variable

2013-08-04 Thread davedigerati
I have my row returning data, and I know I can grab the value of a field as 
long as I know what the field name IS like so
row = db((db.squares.game_code==session.game_code)  
(db.squares.row_num==row_vis)).select()
winner= row[0].nine

but what if my field name is a variable like so?
row = db((db.squares.game_code==session.game_code)  
(db.squares.row_num==row_vis)).select()
winner= row[0].[winning_col]
(I also tried the winning_col in () and '')

They throw syntax errors and I have found nothing via search  google, can 
anyone please advise?

-- 

--- 
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: Quick contract job

2013-08-04 Thread davedigerati
Thanks Dmitri, I'm in the final stages of this one but have others on the 
horizon, please contact me at my email in the OP and I'll add you to my 
list of potential teammates - cheers

On Sunday, August 4, 2013 12:13:19 PM UTC-4, Dmitri Husti wrote:

 Hi,
 Success?
 Your deadline is over, do you need someone else for web2py?
 Im not a professional but most of the questions you posted I could answer 
 :P.

 Best regards
 Dmitri Husti

 Am Donnerstag, 1. August 2013 06:11:59 UTC+2 schrieb davedigerati:

 I have been learning web2py for a project and while I am really enjoying 
 it I am up against a deadline for my client and looking for help.

 I would like to hire someone (preferably one of the frequent contributors 
 as a way of saying thank you, this is a great community;) to take care of 
 one sticking point, which I suspect a knowledgable web2py'er could knock 
 out in an hour or two.  Deadline is noon E.S.T. this Saturday and I'll pay 
 for a working solution through paypal.

 If interested please contact hyprlyt at the usual big G's email domain 
 and I will explain in more detail.
 Thanks!
 Dave



-- 

--- 
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 call a controller funtion on click of a button?

2013-08-04 Thread davedigerati
STUPENDOUS!  Thank you Anthony!  Is there a wiki or QA site somewhere for 
these little tidbits of knowledge?  The manual is fantastic but too 
exhaustive for a quick answer for me anyway... if not maybe I'll build one 
on web2py;)

On Sunday, August 4, 2013 8:21:52 AM UTC-4, Anthony wrote:


 So the usual button to redirect to another page I use this

 button type=button class=btn btn-primary 
 onclick=location.href='{{=URL('gameTime')}}'Done with my squares/button


 What I am trying to do is click a button that does NOT redirect.  If I 
 use a function in defauly.py that has no view in the URL field above, it 
 loads the generic view as advertised.  Grrr.  Isn't there just a simple way 
 to suppress calling the generic view?  Just leave the view and retreat into 
 the controller for a little code parsing? ;)


 First, generic views are disabled by default (though enabled on localhost 
 in the welcome app via a line in db.py). Second, views are only called if 
 your controller action returns a dictionary -- so just don't return a 
 dictionary.

 button type=button class=btn btn-primary onclick=jQuery.ajax(
 '{{=URL('gameTime')}}');Done with my squares/button

 def gameTime():
 [do something]
 return 'OK'

 Anthony



-- 

--- 
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: Problem with function [pyfpdf] add_font() on GAE.

2013-08-04 Thread Brez Yl
I found some solution... it isn't the best one, but it works...

The problem is with using pickle on GAE. The best solution would be to 
overload/rewrite the add_font() function where for GAE, in such a way, that 
it would write to a datastore instead of a filesystem. Additionaly 
ValueError: insecure string pickle error can still occur, I tried b64 
encoding according to 
thishttp://stackoverflow.com/questions/2963602/gae-valueerror-insecure-string-pickle.
 
But still I get errors. So my solution is to overload add_font() function 
with commented out/deleted parts:

if os.path.exists(unifilename):
fh = open(unifilename)
try:
font_dict = pickle.load(fh)
finally:
fh.close()
else:

and
try:
fh = open(unifilename, w)
pickle.dump(font_dict, fh)
fh.close()
except IOError, e:
if not e.errno == errno.EACCES:
raise  # Not a permission error.

Because of this the function every time calculates little bit more instead 
of just reading data from the pickle... but it works on GAE.

Once again thanks for help Christian!


-- 

--- 
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: auth.user question

2013-08-04 Thread Anthony
If the user is not logged in, auth.user will return None, so you can't do 
auth.user.id. Instead, you should use auth.user_id, which will return None 
if not logged in.

Anthony

On Sunday, August 4, 2013 12:04:16 PM UTC-4, Mark Finkelstein wrote:

 I get  the following error for trying that:
 print db.auth_user[auth.user.id]
 AttributeError: 'NoneType' object has no attribute 'id'

 I thought `auth.user` is supposed to be used to check if the user is 
 logged in?

 On Sunday, August 4, 2013 10:35:14 AM UTC-4, Massimo Di Pierro wrote:

 If you are not logged in db.auth_user[auth.user.id] is None.


 On Sunday, 4 August 2013 09:10:09 UTC-5, Mark Finkelstein wrote:

 I have two lines of code that read as follows:

 if auth.user:
 if db.auth_user[auth.user.id]['image']=='' or db.auth_user[auth.user
 .id]['image']==None:

 Recently, while logged in, I dropped all the tables, refreshed the page 
 and then got an Internal Error saying

  if db.auth_user[auth.user.id]['image']=='' or db.auth_user[auth.user.id
 ]['image']==None:
 TypeError: 'NoneType' object has no attribute '__getitem__'

 I'm guessing it has to do with cookies saving the session, where the 
 web2py side recognizes what seems to be a session and building auth.user 
 based off of this, but I'm not quite sure why auth.user is built without a 
 query check of the database? I was wondering why this is?



-- 

--- 
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 call a controller funtion on click of a button?

2013-08-04 Thread Anthony
There's www.web2pyslices.com for recipes, articles, and 
plugins/modules/apps (recently added). It also has QA functionality, 
though most questions get asked here (and to some extent on Stack Overflow).

Anthony

On Sunday, August 4, 2013 1:46:44 PM UTC-4, davedigerati wrote:

 STUPENDOUS!  Thank you Anthony!  Is there a wiki or QA site somewhere for 
 these little tidbits of knowledge?  The manual is fantastic but too 
 exhaustive for a quick answer for me anyway... if not maybe I'll build one 
 on web2py;)

 On Sunday, August 4, 2013 8:21:52 AM UTC-4, Anthony wrote:


 So the usual button to redirect to another page I use this

 button type=button class=btn btn-primary 
 onclick=location.href='{{=URL('gameTime')}}'Done with my squares/button


 What I am trying to do is click a button that does NOT redirect.  If I 
 use a function in defauly.py that has no view in the URL field above, it 
 loads the generic view as advertised.  Grrr.  Isn't there just a simple way 
 to suppress calling the generic view?  Just leave the view and retreat into 
 the controller for a little code parsing? ;)


 First, generic views are disabled by default (though enabled on localhost 
 in the welcome app via a line in db.py). Second, views are only called if 
 your controller action returns a dictionary -- so just don't return a 
 dictionary.

 button type=button class=btn btn-primary onclick=jQuery.ajax(
 '{{=URL('gameTime')}}');Done with my squares/button

 def gameTime():
 [do something]
 return 'OK'

 Anthony



-- 

--- 
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] deployment to google app engine did not include my static files

2013-08-04 Thread davedigerati
as you can see from here: http://sportssquaresonline.appspot.com/
it did upload most of the static files, specifically 30, but the ones I 
added, both images and a css file, it did not.
any idea why???

deployed both through the web2py admin feature and the GAE Launcher

-- 

--- 
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: IS web2py good for largescale

2013-08-04 Thread Anthony
On Sunday, August 4, 2013 11:26:25 AM UTC-4, Loïc wrote:

 Hello Massimo

 Could you please elaborate the following sentence, and if possible give an 
 example of what we should do/avoid?

 built-in system is ok if you have one web2py instance and if you reuse 
 the same keys else you can have a memory leak (keys do not expire with 
 cache.ram).

From the book:

Note, time_expire is used to compare the current time with the time the 
requested object was last saved in the cache. It does not affect future 
requests. This enables time_expire to be set dynamically when an object is 
requested rather than being fixed when the object is saved.

This means that once saved to the cache, objects are never removed from it 
automatically (i.e., they don't get removed after the time_expire period 
has elapsed). So, if you keep saving lots of objects to the cache with 
unique keys but never explicitly remove those items, the cache will 
continue to grow and grow.

Anthony

-- 

--- 
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: deployment to google app engine did not include my static files

2013-08-04 Thread davedigerati
and I only updated the app name in app.yaml and runtime to 2.7 and 
threadsafe to False since true was bombing and I need this dang thing 
running an hour ago...

On Sunday, August 4, 2013 3:12:16 PM UTC-4, davedigerati wrote:

 as you can see from here: http://sportssquaresonline.appspot.com/
 it did upload most of the static files, specifically 30, but the ones I 
 added, both images and a css file, it did not.
 any idea why???

 deployed both through the web2py admin feature and the GAE Launcher



-- 

--- 
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: read a field from a row based on a (wait for it...) variable

2013-08-04 Thread Anthony


 (actually would've just put the .nine into the select and save a line)


That wouldn't save a line -- still have to specify the field even if the 
row contains only one field. 


 BUT what if my field name is a variable like so?
 row = db((db.squares.game_code==session.game_code)  
 (db.squares.row_num==row_vis)).select()
 winner= row[0].[winning_col]
 (I also tried the winning_col in () and '')


A Row object works like a dictionary, so:

row[0][winning_col]

Mentioned near the end of this 
sectionhttp://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#selectin
 the book.

Anthony

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




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

2013-08-04 Thread Niphlod
https://github.com/web2py/web2py/pull/159 fixes it

On Sunday, August 4, 2013 4:21:03 PM UTC+2, Massimo Di Pierro wrote:

 Please open a ticket about this.



-- 

--- 
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: deployment to google app engine did not include my static files

2013-08-04 Thread davedigerati
Aaand, I've wasted the board's time, very sorry.
I had hard-coded a link (see other posting re: problems injecting css 
sheets) and forgot to rebuild with URL().

and on my image that was not loading, just giving a broken link I had 
malformed a URL request, which interestingly worked fine locally but not on 
GAE:
{{=A(IMG(_src=URL('static/images','logo.png'), _alt=Our Logo), 
_href=URL('default','index'))}}

should have been
{{=A(IMG(_src=URL('static','images/logo.png'), _alt=Our Logo), 
_href=URL('default','index'))}}

man I need a break...
 

-- 

--- 
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: groupby in sqlform.grid resulted into unsupported query

2013-08-04 Thread villas
I made a few tests but it appears that groupby produces buggy SQL when used 
with grid,  so I'm not sure what you can do there.  Maybe someone else 
could try it 

Here is a simple example:

def testgrid():
return dict(grid=SQLFORM.grid(db.auth_user, groupby=db.auth_user.
first_name,orderby=db.auth_user.first_name ))



at one point sqlhtml.py produces this invalid SQL (for firebird):

select count(*) from (SELECT  count(*) FROM auth_user WHERE (auth_user.id 
IS NOT
 NULL) GROUP BY auth_user.first_name)

Not sure what's going on,  but it's not going to work like that...


On Sunday, 4 August 2013 06:11:01 UTC+1, Matt Grham wrote:

 Could be but I am trying to do it in SQLFORM.grid statement. How can I do 
 that?

 On Saturday, August 3, 2013 4:04:40 PM UTC-7, villas wrote:

 For the example you provide,  probably better with:  distinct=True 
 That is the usual SQL method of suppressing duplicate rows.



-- 

--- 
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: Deploying on Open Shift Error

2013-08-04 Thread Naveena Elsa Benjamin
I am using python 2.7 version windows 64 bit


On Sun, Aug 4, 2013 at 8:58 AM, dhmorgan dharrimanmor...@gmail.com wrote:

 so are you now running web2py from source, using Python 2.6 or 2.7 ?



 On Sunday, August 4, 2013 1:36:24 AM UTC-5, ndave wrote:

 Hi,

 I tried doing what was said but it didn't work out for me.  I am trying
 to install in windows 8 and it just didn't work and I keep getting the same
 error again.

 Thanks


 On Sat, Aug 3, 2013 at 1:17 AM, Massimo Di Pierro 
 massimo@gmail.comwrote:

 You should use web2py form source and install distutils (
 http://stackoverflow.com/**questions/3810521/how-to-**
 install-python-distutilshttp://stackoverflow.com/questions/3810521/how-to-install-python-distutils)
 and gitpython 
 (https://pypi.python.org/pypi/**GitPython/https://pypi.python.org/pypi/GitPython/
 ).

 On Saturday, 3 August 2013 02:51:27 UTC-5, ndave wrote:

 Hi,

 Could anyone tell me how to deploy the app we created on Open shift? I
 tried the option but I keep getting the error distutils not installed

 I need steps on how to deploy and what needs to be exactly done. I am
 stuck here and unable to proceed.

 Thanks,

  --

 ---
 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/4Nw0DcXfCsw/**unsubscribehttps://groups.google.com/d/topic/web2py/4Nw0DcXfCsw/unsubscribe
 .
 To unsubscribe from this group and all its topics, send an email to
 web2py+un...@**googlegroups.com.

 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .




  --

 ---
 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/4Nw0DcXfCsw/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.




-- 

--- 
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: auth.user question

2013-08-04 Thread Mark Finkelstein
Yes, I thought this was so, my issue is more with the fact that after 
dropping the databases, this seems to give an invalid value, as shown in my 
first post? I may be wrong.

On Sunday, August 4, 2013 3:07:46 PM UTC-4, Anthony wrote:

 If the user is not logged in, auth.user will return None, so you can't do 
 auth.user.id. Instead, you should use auth.user_id, which will return 
 None if not logged in.

 Anthony

 On Sunday, August 4, 2013 12:04:16 PM UTC-4, Mark Finkelstein wrote:

 I get  the following error for trying that:
 print db.auth_user[auth.user.id]
 AttributeError: 'NoneType' object has no attribute 'id'

 I thought `auth.user` is supposed to be used to check if the user is 
 logged in?

 On Sunday, August 4, 2013 10:35:14 AM UTC-4, Massimo Di Pierro wrote:

 If you are not logged in db.auth_user[auth.user.id] is None.


 On Sunday, 4 August 2013 09:10:09 UTC-5, Mark Finkelstein wrote:

 I have two lines of code that read as follows:

 if auth.user:
 if db.auth_user[auth.user.id]['image']=='' or db.auth_user[auth.
 user.id]['image']==None:

 Recently, while logged in, I dropped all the tables, refreshed the page 
 and then got an Internal Error saying

  if db.auth_user[auth.user.id]['image']=='' or db.auth_user[auth.user.
 id]['image']==None:
 TypeError: 'NoneType' object has no attribute '__getitem__'

 I'm guessing it has to do with cookies saving the session, where the 
 web2py side recognizes what seems to be a session and building auth.user 
 based off of this, but I'm not quite sure why auth.user is built without a 
 query check of the database? I was wondering why this is?



-- 

--- 
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: groupby in sqlform.grid resulted into unsupported query

2013-08-04 Thread Massimo Di Pierro
Which web2py version. This may be fixed in trunk. I see that ORDERBY is 
missing. I think that is the problem. Please check trunk and let us know. 
If still a problem, please open an issue.

On Sunday, 4 August 2013 15:13:48 UTC-5, villas wrote:

 I made a few tests but it appears that groupby produces buggy SQL when 
 used with grid,  so I'm not sure what you can do there.  Maybe someone else 
 could try it 

 Here is a simple example:

 def testgrid():
 return dict(grid=SQLFORM.grid(db.auth_user, groupby=db.auth_user.
 first_name,orderby=db.auth_user.first_name ))



 at one point sqlhtml.py produces this invalid SQL (for firebird):

 select count(*) from (SELECT  count(*) FROM auth_user WHERE (auth_user.id 
 IS NOT
  NULL) GROUP BY auth_user.first_name)

 Not sure what's going on,  but it's not going to work like that...


 On Sunday, 4 August 2013 06:11:01 UTC+1, Matt Grham wrote:

 Could be but I am trying to do it in SQLFORM.grid statement. How can I do 
 that?

 On Saturday, August 3, 2013 4:04:40 PM UTC-7, villas wrote:

 For the example you provide,  probably better with:  distinct=True 
 That is the usual SQL method of suppressing duplicate rows.



-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: list:string repeats same error message in SQLFORM grid

2013-08-04 Thread step
Answering my own question, with jQuery I found a way to display just a 
single error message div for a list:string type field. I added this code to 
the view:
{{if grid.update_form or grid.create_form:}}
{{#hide all list:string error divs but the first one, and move it 
before the data}}
script type=text/javascript
$(document).ready(function() {
var f=['email','phone']; //list:strings
for (var i=0; if.length; i++) {
$('#person_'+f[i]+' .error_wrapper').each(function(i) {
if (i==0) $(this).siblings().first().before($(this));
else this.style.display='none';
});
}
});
/script
{{pass}}
{{=grid}}



On Saturday, August 3, 2013 12:52:16 AM UTC+2, step wrote:

 is it possible to display just one error message of a list:string input 
 right after the last input control, using SQLFORM.grid?

 With SQLFORM,grid create/update form, when a list:string field with 
 validators has errors it should be possible to hide the error display on 
 all list inputs but the last one. At least that's how I interpret the 
 current ListWidget code in sqlform.py
 nvalue = value or ['']
 items = [LI(INPUT(_id=_id, _class=_class, _name=_name,
   value=v, hideerror=k  len(nvalue) - 1,
   requires=requires),
 **attributes) for (k, v) in enumerate(nvalue)]
 so hideerror=True for all input items but the last one. Effectively, this 
 should display a single error message after the last string of the list. 
 How nice, but it doesn't seem to work, and the form repeats the same error 
 message under each string of the list - 100 times if the list:string 
 comprises 100 elements.
 I'm not sure where the hideerror attribute gets reset in the chain. I 
 check its value in function _translate, and it's always false, even when I 
 add this code after the above code in the ListWidget - for the sake of 
 investigating this issue.
 for i in items:
 for e in i.elements:
 e.attributes['hideerror'] = True
 hideerror is still == False for all self.components in _translate() while 
 I'd expect it to be True for components that correspond to my list:string 
 inputs.
 def _traverse(self, status, hideerror=False):
 # zip zip...

 # for input, textarea, select, option
 # deal with 'value' and 'validation'

 name = self['_name']
 print name, self['hideerror'] # this always prints False




-- 

--- 
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] Sapo Ink and Web2py

2013-08-04 Thread Hugo Costa
Hello!

So, my friend who was using *Twitter Bootstrap *changed to Sapo 
Inkhttp://ink.sapo.pt/, 
and he loved it. 

I currently have my apps in Bootstrap, but I wanted to change them to the 
Sapo's framework.

Anyone knows what should I delete to make this work? I have some of the 
features, I've deleted most of the bootstrap stuff and copied the Sapo's 
files to the respective folders but I don't have all the features.

Anyone can help me?

Thanks

Hugo

-- 

--- 
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: IS web2py good for largescale

2013-08-04 Thread Loïc
Thank you Anthony.

Maybe I missed a point in the book, but does memory leak with cache.ram also 
applies to select caching?
For example when you do 

rows = db(query).select(cache=(cache.ram,3600),cacheable=True)

Is there any way to specify the key, or to empty the cache after some time?
What is the correct way to do?


Thank you

-- 

--- 
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: IS web2py good for largescale

2013-08-04 Thread Hugo Costa
My cousin is making a social network using web2py and he worked with Rails, 
for example.

I'd use it, I think it has a clean and easy code. But that's up to you.

If you want to know what social network it is, http://tymr.com

Sexta-feira, 2 de Agosto de 2013 4:04:27 UTC+1, hello world escreveu:

 Hey
 I would like to know if web2py framework ...is a good framework for making 
 large scale websites...???..


-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: list:string repeats same error message in SQLFORM grid

2013-08-04 Thread Massimo Di Pierro
Your first solution should also have worked. I will look into it.

On Sunday, 4 August 2013 16:40:57 UTC-5, step wrote:

 Answering my own question, with jQuery I found a way to display just a 
 single error message div for a list:string type field. I added this code to 
 the view:
 {{if grid.update_form or grid.create_form:}}
 {{#hide all list:string error divs but the first one, and move it 
 before the data}}
 script type=text/javascript
 $(document).ready(function() {
 var f=['email','phone']; //list:strings
 for (var i=0; if.length; i++) {
 $('#person_'+f[i]+' .error_wrapper').each(function(i) {
 if (i==0) $(this).siblings().first().before($(this));
 else this.style.display='none';
 });
 }
 });
 /script
 {{pass}}
 {{=grid}}



 On Saturday, August 3, 2013 12:52:16 AM UTC+2, step wrote:

 is it possible to display just one error message of a list:string input 
 right after the last input control, using SQLFORM.grid?

 With SQLFORM,grid create/update form, when a list:string field with 
 validators has errors it should be possible to hide the error display on 
 all list inputs but the last one. At least that's how I interpret the 
 current ListWidget code in sqlform.py
 nvalue = value or ['']
 items = [LI(INPUT(_id=_id, _class=_class, _name=_name,
   value=v, hideerror=k  len(nvalue) - 1,
   requires=requires),
 **attributes) for (k, v) in enumerate(nvalue)]
 so hideerror=True for all input items but the last one. Effectively, this 
 should display a single error message after the last string of the list. 
 How nice, but it doesn't seem to work, and the form repeats the same error 
 message under each string of the list - 100 times if the list:string 
 comprises 100 elements.
 I'm not sure where the hideerror attribute gets reset in the chain. I 
 check its value in function _translate, and it's always false, even when I 
 add this code after the above code in the ListWidget - for the sake of 
 investigating this issue.
 for i in items:
 for e in i.elements:
 e.attributes['hideerror'] = True
 hideerror is still == False for all self.components in _translate() while 
 I'd expect it to be True for components that correspond to my list:string 
 inputs.
 def _traverse(self, status, hideerror=False):
 # zip zip...

 # for input, textarea, select, option
 # deal with 'value' and 'validation'

 name = self['_name']
 print name, self['hideerror'] # this always prints False




-- 

--- 
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: IS web2py good for largescale

2013-08-04 Thread Massimo Di Pierro
If the query depends on user input than yes.
select(cache=(...)) uses the SQL QUERY as key. If it is possible for the 
QUERY that you are caching to always be different because depends on user 
this input you have a memory leak. Actually more than that. You have a DoS 
vulnerability because a user can keep making queries thus exploiting the 
leak easily.

You should only cache selects that do not depend on use input.


On Sunday, 4 August 2013 16:55:08 UTC-5, Loïc wrote:

 Thank you Anthony.

 Maybe I missed a point in the book, but does memory leak with cache.ram 
 also applies to select caching?
 For example when you do 

 rows = db(query).select(cache=(cache.ram,3600),cacheable=True)

 Is there any way to specify the key, or to empty the cache after some time?
 What is the correct way to do?


 Thank you



-- 

--- 
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] Upload image and make a thumbnail question.

2013-08-04 Thread Michael Gheith
Hello web2py community!

I used to be able to use the following web2py slice successfully in the 
past (about a year ago):
http://www.web2pyslices.com/slice/show/1387/upload-image-and-make-a-thumbnail

Now it's not working with the latest build of web2py.  Is anyone able to 
successfully get this slice working with the latest web2py build?

The code is successfully creating the thumbnail and storing it in the 
uploads folder.  I can physically see it on the file system.  But I get a 
ticket whenever I try to access the thumbnail through the DB admin or 
through the URL bar:
type 'exceptions.TypeError' Can't retrieve 
uploads.thumb.16e0d9fd-bc66-4b36-9c75-03aaea1d8603.PNG

I don't think there is anything wrong with what I am doing.  I think the 
problem resides in the slice and web2py breaking backward compatibility... 
 Please provide guidance, thanks!

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: auth.user question

2013-08-04 Thread Anthony
auth.user is stored in the session and is not refreshed from the database 
on every request, which would be inefficient. Presumably you don't 
typically drop your db tables in production.

Anthony

On Sunday, August 4, 2013 4:58:40 PM UTC-4, Mark Finkelstein wrote:

 Yes, I thought this was so, my issue is more with the fact that after 
 dropping the databases, this seems to give an invalid value, as shown in my 
 first post? I may be wrong.

 On Sunday, August 4, 2013 3:07:46 PM UTC-4, Anthony wrote:

 If the user is not logged in, auth.user will return None, so you can't do 
 auth.user.id. Instead, you should use auth.user_id, which will return 
 None if not logged in.

 Anthony

 On Sunday, August 4, 2013 12:04:16 PM UTC-4, Mark Finkelstein wrote:

 I get  the following error for trying that:
 print db.auth_user[auth.user.id]
 AttributeError: 'NoneType' object has no attribute 'id'

 I thought `auth.user` is supposed to be used to check if the user is 
 logged in?

 On Sunday, August 4, 2013 10:35:14 AM UTC-4, Massimo Di Pierro wrote:

 If you are not logged in db.auth_user[auth.user.id] is None.


 On Sunday, 4 August 2013 09:10:09 UTC-5, Mark Finkelstein wrote:

 I have two lines of code that read as follows:

 if auth.user:
 if db.auth_user[auth.user.id]['image']=='' or db.auth_user[auth.
 user.id]['image']==None:

 Recently, while logged in, I dropped all the tables, refreshed the 
 page and then got an Internal Error saying

  if db.auth_user[auth.user.id]['image']=='' or db.auth_user[auth.user.
 id]['image']==None:
 TypeError: 'NoneType' object has no attribute '__getitem__'

 I'm guessing it has to do with cookies saving the session, where the 
 web2py side recognizes what seems to be a session and building auth.user 
 based off of this, but I'm not quite sure why auth.user is built without 
 a 
 query check of the database? I was wondering why this is?



-- 

--- 
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: IS web2py good for largescale

2013-08-04 Thread Anthony


 For example when you do

rows = db(query).select(cache=(cache.ram,3600),cacheable=True)

 Is there any way to specify the key, or to empty the cache after some time?

Not currently a way to specify the key, though I suppose we could add that 
option. Here's the code that generates the key: 
https://code.google.com/p/web2py/source/browse/gluon/dal.py#1705. I suppose 
you could replicate the key in order to clear the value from the cache if 
necessary. In general, you should probably limit yourself to caching only a 
fixed set of queries (that don't take up too much ram). You can also cache 
the Rows object itself (with your own key) if you do .select(..., 
cacheable=True), though in that case you lose some of the Rows 
functionality.

Anthony


 

 What is the correct way to do?


 Thank you



-- 

--- 
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: deployment to google app engine did not include my static files

2013-08-04 Thread Christian Foster Howes
if you get a chance, can you describe how threadsafe==True was failing on 
GAE?  i'm hoping to focus on making that work here in the next couple of 
weeks

thanks,

christian

On Sunday, August 4, 2013 12:16:02 PM UTC-7, davedigerati wrote:

 and I only updated the app name in app.yaml and runtime to 2.7 and 
 threadsafe to False since true was bombing and I need this dang thing 
 running an hour ago...

 On Sunday, August 4, 2013 3:12:16 PM UTC-4, davedigerati wrote:

 as you can see from here: http://sportssquaresonline.appspot.com/
 it did upload most of the static files, specifically 30, but the ones I 
 added, both images and a css file, it did not.
 any idea why???

 deployed both through the web2py admin feature and the GAE Launcher



-- 

--- 
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: Google crawler error

2013-08-04 Thread Christian Foster Howes
there is some variable in index.html that is none, but you are trying to 
access it as a Storage or dict i bet.   does you app expect/require login?  
is there something that is set conditionally based on the user agent?

On Saturday, August 3, 2013 9:07:45 PM UTC-7, James Burke wrote:

 Hi,

 My site seems to be working fine, but when I go onto Google Webmaster 
 Tools there are crawler errors.

 So I run the Fetch as Google tool and get *Unreachable page*. Which 
 produces the following ticket:

 Traceback (most recent call last):
 File 
 /base/data/home/apps/s~kaosaerialart/1.369256777018743792/gluon/restricted.py,
  
 line 212, in restricted
 exec ccode in environment\n File 
 /base/data/home/apps/s~kaosaerialart/1.369256777018743792/applications/init/views/default/index.html,
  
 line 32, in module
 TypeError: \'NoneType\' object has no attribute \'__getitem__\'

 My website is running on GAE.

 Any help appreciated!

 -James


-- 

--- 
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: auth.user question

2013-08-04 Thread Mark Finkelstein
This makes sense. This was what I was wondering. Thanks for the answer!


On Sun, Aug 4, 2013 at 7:27 PM, Anthony abasta...@gmail.com wrote:

 auth.user is stored in the session and is not refreshed from the database
 on every request, which would be inefficient. Presumably you don't
 typically drop your db tables in production.

 Anthony


 On Sunday, August 4, 2013 4:58:40 PM UTC-4, Mark Finkelstein wrote:

 Yes, I thought this was so, my issue is more with the fact that after
 dropping the databases, this seems to give an invalid value, as shown in my
 first post? I may be wrong.

 On Sunday, August 4, 2013 3:07:46 PM UTC-4, Anthony wrote:

 If the user is not logged in, auth.user will return None, so you can't
 do auth.user.id. Instead, you should use auth.user_id, which will
 return None if not logged in.

 Anthony

 On Sunday, August 4, 2013 12:04:16 PM UTC-4, Mark Finkelstein wrote:

 I get  the following error for trying that:
 print db.auth_user[auth.user.id]
 AttributeError: 'NoneType' object has no attribute 'id'

 I thought `auth.user` is supposed to be used to check if the user is
 logged in?

 On Sunday, August 4, 2013 10:35:14 AM UTC-4, Massimo Di Pierro wrote:

 If you are not logged in db.auth_user[auth.user.id] is None.


 On Sunday, 4 August 2013 09:10:09 UTC-5, Mark Finkelstein wrote:

 I have two lines of code that read as follows:

 if auth.user:
 if db.auth_user[auth.user.id]['**image']=='' or db.auth_user[auth
 .user.id]['**image']==None:

 Recently, while logged in, I dropped all the tables, refreshed the
 page and then got an Internal Error saying

  if db.auth_user[auth.user.id]['**image']=='' or db.auth_user[auth.
 user.id]['**image']==None:
 TypeError: 'NoneType' object has no attribute '__getitem__'

 I'm guessing it has to do with cookies saving the session, where the
 web2py side recognizes what seems to be a session and building auth.user
 based off of this, but I'm not quite sure why auth.user is built without 
 a
 query check of the database? I was wondering why this is?

  --

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




-- 

--- 
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] Simplest form of internal messaging

2013-08-04 Thread Alex Glaros
Can anyone help me think of a primitive form of internal messaging between 
users of an app?  No external email, nothing fancy because I have limited 
programming skill.

The only requirement is that a user can leave a message for another user, 
and the other user can reply.

Example: 


   1. User-A leaves a message for User-B, Hi, can you please give me your 
   external email address?  
   2. User-B says: Sure, here it is, use...@gmail.com
   

So I suppose there might be a db.Internal_Mail table.


   - auth_user_message_sender
   - auth_user_message_recipient
   - subject_of_message
   - body_of_message
   - date_time_sent
   - has_this_message_been_read_yet?
   


   1. set up permissions so that users can read all records in 
   db.Internal_Mail table that have their name either in the 
   auth_user_messsage_sender or  auth_user_message_recipient fields
   2. set up permissions so that users can edit/delete all records in 
   db.Internal_Mail table that have their name in the auth_user_sender field
   

Based on above, seems that smartgrid or grid could handle all of the 
requirements except knowing how to reply and to who, which seems 
complicated to program. To reply, perhaps would have a controller named 
reply_to_an_email.  It would let user 

   1. search through the emails
   2. somehow select only one
   3. then create a record in db.Internal_Mail table that switches contents 
   of sender and recipient fields of selected record, copies subject line from 
   the received message, and let's recipient fill out the body of the reply 
   message.
   

Any ideas? Is this already written elsewhere?  If not, would this be useful 
to anyone else?

Thanks,

Alex Glaros

-- 

--- 
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: IS web2py good for largescale

2013-08-04 Thread Ray (a.k.a. Iceberg)
Looks like using a memcache (which using finite memory) is the only way to 
go in this case?

On Monday, August 5, 2013 6:42:09 AM UTC+8, Massimo Di Pierro wrote:

 If the query depends on user input than yes.
 select(cache=(...)) uses the SQL QUERY as key. If it is possible for the 
 QUERY that you are caching to always be different because depends on user 
 this input you have a memory leak. Actually more than that. You have a DoS 
 vulnerability because a user can keep making queries thus exploiting the 
 leak easily.

 You should only cache selects that do not depend on use input.


 On Sunday, 4 August 2013 16:55:08 UTC-5, Loïc wrote:

 Thank you Anthony.

 Maybe I missed a point in the book, but does memory leak with cache.ram 
 also applies to select caching?
 For example when you do 

 rows = db(query).select(cache=(cache.ram,3600),cacheable=True)

 Is there any way to specify the key, or to empty the cache after some 
 time?
 What is the correct way to do?


 Thank you



-- 

--- 
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: IS web2py good for largescale

2013-08-04 Thread Alex Glaros
Hi Joe Barnhart,

can you please tell me how much hosting costs per month for your app? 
 bandwidth, disk, etc.

thanks,

Alex Glaros

On Saturday, August 3, 2013 12:18:07 PM UTC-7, Joe Barnhart wrote:

 I'm not the OP, but I am also risking web2py on a large project...

 In my case I'm replacing a Rails site that services about 15,000 customers 
 and has a variable workload -- about 5000 users compete for time on the 
 site every week.  It has a database size of about 20GB of small records 
 (~1K ea.) and each user will require about 200-500 DB requests over the 
 typical session of about 30 min.  The site currently does about $200k in CC 
 charges per month.

 I am looking at deployment on OpenShift or its brothers, or AWS.  I 
 considered GAE but the limitations on join make life difficult for me as 
 my db is extensively indexed and cross-linked.  It has about 40 tables and 
 they participate in a lot of 1:many joins.  I'm pretty happy with 
 PostgreSQL as my database but I have not determined the right web server 
 platform for me.  I'm actually a bit mystified by the choices (nginx, 
 apache, etc) so I'm getting a friend who knows a lot more than I to help in 
 that area.

 As a developer, web2py thrills me.  Having lurked here a lot I'm pretty 
 confident it can be scaled up to handle the load, but there's always a risk 
 -- is my db schema flawed in some way, or other design decisions that 
 crater performance?  The current Rails site is pretty well loved but it 
 bogs and people are not happy with response time.  Also, my end goal is to 
 scale this site x10 or more, so scalability and stability are paramount!

 -- Joe B.

 P.S.  I'm going to tithe a percentage of my site's profits back to web2py 
 development when it is up. I believe in giving back to those who help you 
 achieve.

 P.P.S.  No, it's not a p0rn site... ;-)

 On Friday, August 2, 2013 2:46:31 PM UTC-7, Aurelio Tinio wrote:

 Curious to hear, what do you consider large scale?
 The more detailed you are about your project the better the response the 
 community can provide.

 Fwiw, having only worked with web2py since the beginning of the year I've 
 been contemplating similar questions too and essentially the answer is... 
 *it depends*. I've predominantly worked with other web frameworks 
 (mainly Django) in the past and there are definite pros/cons/tradeoffs in 
 my mind of why it'd be better to choose one versus the other. Happy to 
 elaborate but again, please provide more info so the reply could be more 
 targeted.

 Cheers.

 On Thursday, August 1, 2013 8:04:27 PM UTC-7, hello world wrote:

 Hey
 I would like to know if web2py framework ...is a good framework for 
 making large scale websites...???..



-- 

--- 
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] Simplest form of internal messaging

2013-08-04 Thread Robert O'Connor
A message queue is also needed potentially...if this is real time...also
this is python...a monkey can do this...
On Aug 4, 2013 9:29 PM, Alex Glaros alexgla...@gmail.com wrote:

 Can anyone help me think of a primitive form of internal messaging between
 users of an app?  No external email, nothing fancy because I have limited
 programming skill.

 The only requirement is that a user can leave a message for another user,
 and the other user can reply.

 Example:


1. User-A leaves a message for User-B, Hi, can you please give me
your external email address?
2. User-B says: Sure, here it is, use...@gmail.com


 So I suppose there might be a db.Internal_Mail table.


- auth_user_message_sender
- auth_user_message_recipient
- subject_of_message
- body_of_message
- date_time_sent
- has_this_message_been_read_yet?



1. set up permissions so that users can read all records in
db.Internal_Mail table that have their name either in the
auth_user_messsage_sender or  auth_user_message_recipient fields
2. set up permissions so that users can edit/delete all records in
db.Internal_Mail table that have their name in the auth_user_sender field


 Based on above, seems that smartgrid or grid could handle all of the
 requirements except knowing how to reply and to who, which seems
 complicated to program. To reply, perhaps would have a controller named
 reply_to_an_email.  It would let user

1. search through the emails
2. somehow select only one
3. then create a record in db.Internal_Mail table that switches
contents of sender and recipient fields of selected record, copies subject
line from the received message, and let's recipient fill out the body of 
 the
reply message.


 Any ideas? Is this already written elsewhere?  If not, would this be
 useful to anyone else?

 Thanks,

 Alex Glaros

 --

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




-- 

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