[web2py] Re: list:string type field output format

2013-04-17 Thread 黄祥
thank you so much for your hint, anthony both of it is work well.

{{extend 'layout.html'}}

{{for i, row in enumerate(rows):}}
{{=DIV(', '.join(row.test))}}
{{=DIV(db.test.test.represent(row.test))}}
{{pass}}

On Wednesday, April 17, 2013 10:33:13 AM UTC+7, Anthony wrote:

 In the database, the value is stored as a string with the individual 
 values separated by pipe characters (i.e., |a|b|). However, when you 
 select from the DB using the DAL, the value gets converted to a list. 
 list:string fields get a default represent attribute that displays the 
 values as a comma-separated list in grids, etc., but you have to do it 
 yourself or explicitly call the represent function in other contexts:

 DIV(', '.join(row.test))

 or

 DIV(db.test.test.represent(row.test))

 Anthony

 On Tuesday, April 16, 2013 10:37:20 PM UTC-4, 黄祥 wrote:

 hi folks,

 is it possible to change list:string type field output format?

 e.g.
 *in grid output : a, b*
 *in shell output :  |a|b|*
  print db(db.test.test.contains('b')).select()
 test.id,test.test
 1,|a|b|
 *in view using query output : ab*
 {{for i, row in enumerate(rows):}}
 {{=DIV(row.test)}}
 {{pass}}
 *in view using query output : ['a', 'b']*
 {{for i, row in enumerate(rows):}}
 {{=DIV(str(row.test))}}
 {{pass}}

 i want to have the output format for list:string type field in view : *a, 
 b* or *a; b* instead of ab. did anyone know how to produce the output 
 like that in web2py?

 thank you very much in advance



-- 

--- 
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] Queries with AND in GAE

2013-04-17 Thread José Manuel López
I'm trying to make a very simple query:

 offersInRange= db(db.Offer.hotel == request.vars.hotel 
anddb.Offer.valid_from_date 
= form.vars.valid_to_date and 

 db.Offer.valid_from_date =form.vars.valid_to_date
).select(db.Offer.ALL)

I have test this too:

offersInRange= db(db.Offer.hotel == request.vars.hotel_name 
anddb.Offer.valid_from_date 
 form.vars.valid_to_date and 

 db.Offer.valid_from_date form.vars.valid_to_date
).select(db.Offer.ALL)

This query must returns the Offers which are in a range and with an 
specific ID. Instead that it returns me every row that match: 
db.Offer.valid_from_date  form.vars.valid_to_date. Why is this happening?. 
Any clues about the problem?.

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: Queries with AND in GAE

2013-04-17 Thread Niphlod
db((condition)  (condition)).select()
is the way to do it: you're doing
db(condition and condition).select()

On Wednesday, April 17, 2013 8:52:09 AM UTC+2, José Manuel López wrote:

 I'm trying to make a very simple query:

  offersInRange= db(db.Offer.hotel == request.vars.hotel 
 anddb.Offer.valid_from_date 
 = form.vars.valid_to_date and 

  db.Offer.valid_from_date 
 =form.vars.valid_to_date
 ).select(db.Offer.ALL)

 I have test this too:

 offersInRange= db(db.Offer.hotel == request.vars.hotel_name 
 anddb.Offer.valid_from_date 
  form.vars.valid_to_date and 

  db.Offer.valid_from_date form.vars.valid_to_date
 ).select(db.Offer.ALL)

 This query must returns the Offers which are in a range and with an 
 specific ID. Instead that it returns me every row that match: 
 db.Offer.valid_from_date  form.vars.valid_to_date. Why is this 
 happening?. Any clues about the problem?.

 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: AppStats doesn't work in my App. [GAE]

2013-04-17 Thread José Manuel López
Thank you Christian!. Now it works. 
Any clues to low the overhead?

On Tuesday, April 16, 2013 6:28:30 PM UTC+2, Christian Foster Howes wrote:

 ahhh yes...i remember.  given that appstats, while helpful for testing, 
 has a significant performance overhead (200ish ms per request i think), 
 and that some (like me) have custom appengine_config.py files we moved 
 web2py's appengine_config.py to appengine_config.example.py. 

 rename the file, redeploy and you should be all set.  if you have a 
 moment, consider submitting a patch to the documentation to clarify that! 
 ;) 

 christian 

 On 4/16/13 8:41 , Jos� Manuel L�pez wrote: 
  Hi Christian, 
  First thank you for your response :) !. 
  In app.yaml I have: appstats:on 
  Regarding appengine_config.py, I don't have it!... the only one is 
  appengine_config.example.py that contains: 
  def webapp_add_wsgi_middleware(app): 
   from google.appengine.ext.appstats import recording 
   app = recording.appstats_wsgi_middleware(app) 
   return app 
  I think this can be the problem?. 
  
  
  
  On Tuesday, April 16, 2013 8:19:51 AM UTC+2, Christian Foster Howes 
 wrote: 
  
  Jose, 
  
  i'm behind in my web2py upgrades but can you check: 
  
- do you have app stats enabled in app.yaml? 
- what does your appengine_config.py look like? 
  
  cfh 
  
  On Monday, April 15, 2013 12:28:59 AM UTC-7, Jos� Manuel L�pez 
 wrote: 
  
  
  
 https://lh4.googleusercontent.com/-xPEFarglbpA/UWvXiWWPdnI/AB0/vB3xDkBUeVY/s1600/Captura+de+pantalla+2013-04-15+a+la%28s%29+09.25.48.png
  

  Hi, 
  AppStats doesn't work in my App although I have this in gaehandler.py: 
  
  LOG_STATS = TrueAPPSTATS = True 
  DEBUG = False 
  
  I have do anything wrong because it doesn't work in Local or in 
  googlespot. 
  As you can see in the screenshot I've the AppStats link in the CUSTOM 
  section, but when I select it, nothing is showed. 
  What is needed to enable the AppStats, I need to profile my 
 Application. 
  Thank you for your help. 
  
  EDIT: I have the version 2.4.6 stable. 
  
  
  


-- 

--- 
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: MySQL server has gone away errors happening more and more with db-based sessions?

2013-04-17 Thread Niphlod
everyone with a different unique_key ?

On Wednesday, April 17, 2013 12:43:35 AM UTC+2, Yarin wrote:

 OK, now I've run into some special weirdness- I don't know if it's 
 related, but it makes no sense to me:

 When I run a count of session records grouped by client IP, I get some 
 very big numbers at the top end:

 SELECThttps://my.sidekickhq.com/phpMyAdmin/url.php?url=http%3A%2F%2Fdev.mysql.com%2Fdoc%2Frefman%2F5.1%2Fen%2Fselect.htmltoken=b7e16822d6a72a4a32629ba16b760d59
  client_ip, 
 COUNThttps://my.sidekickhq.com/phpMyAdmin/url.php?url=http%3A%2F%2Fdev.mysql.com%2Fdoc%2Frefman%2F5.1%2Fen%2Fgroup-by-functions.html%23function_counttoken=b7e16822d6a72a4a32629ba16b760d59
 ( * ) AS count
 FROM `web2py_session_sidekick` 
 GROUP BY client_ip
 ORDER BY count DESC 
 LIMIT 0 , 30

 Some client ips have 100+ session records associated with them!? For 
 example, my own IP has 186 session records- including 13 where the 
 modified_datetime field equals TODAY... This makes no sense.  I did not log 
 into my app from 13 different devices today. Why would a single user 
 connecting from a single device have so many session records??






 On Tuesday, April 16, 2013 6:21:56 PM UTC-4, Yarin wrote:

 Largest session_data fields were 12 KiB

 On Tuesday, April 16, 2013 5:49:45 PM UTC-4, Niphlod wrote:

 either than a large blob/object in the session I really can't see how an 
 update so simple (syntax-wise) takes 50 seconds (when the minimum reported 
 time is 0.8ms) on mysql end.
 edit: did you try to inspect how much data is in the longest 
 session_data column ? 



-- 

--- 
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: Return value from javascript to controller

2013-04-17 Thread Niphlod
that's exactly what I tested yesterday evening... can you please try to 
strip out the next=URL('index') part ?
It's the only thing that is different.

On Wednesday, April 17, 2013 4:14:58 AM UTC+2, fun man wrote:

 Hi Niphlod,

 I downloaded the new one, and copied the files over. Keeping my original 
 model. This is now my controller.

 1) fast_tz returns None, 
 2) the submit button to the db was not taken, and the still ask me to 
 fill out the form again.

 Would you mind to take a look at it? thanks for your help.

 def test():
 fast_tz = fast_tz_detector()
 #create a new appt
 form = SQLFORM(db.sometable).process(next=URL('index'))
 if form.process().accepted:
 response.flash = 'form accepted'
 elif form.errors:
 response.flash = 'form has errors'
 else:
 response.flash = 'please fill out the form'
 return dict(form=form, fast_tz=fast_tz)
 




 On Wed, Apr 17, 2013 at 3:17 AM, Niphlod nip...@gmail.com 
 javascript:wrote:



 On Tuesday, April 16, 2013 8:10:38 PM UTC+2, fun man wrote:

 Hi Niphlod,

 I need to trouble you again for your guidance.

 I've successfully copied the files. I've added a new application tz_test 
 to test the plugin.

 This is my controller and there are some other scaffolding coded not 
 included.
 ==**==
 import pytz
 from plugin_timezone import fast_tz_detector

 def detect_timezone():
 tz = fast_tz_detector()
 return dict(tz=tz)

 def test():
 detect_timezone()
 zone = session.plugin_timezone_tz
 form = SQLFORM.grid(db.sometable)
 return dict(form=form)
 
 This is my model.
 =
 db = DAL(sqlite://storage.sqlite)
 import pytz
 user_timezone = session.plugin_timezone_tz or 'UTC'
 db.define_table('sometable',
   Field('appointment', 'datetime', 
 requires=IS_DATETIME(timezone=**pytz.timezone(user_timezone))
   )
 )


 Ohhh, whoopsie. it needs a fix, sorry ^_^ 
 Redownload the plugin from github.

 PS: That will work ok if a user landed on the detect_timezone 
 pageif you need to autodetect in the same page as the form, you should 
 be able to do

 def test():
   fast_tz = fast_tz_detector()
   form = yourform .

   .
   return dict(form=form, fast_tz=fast_tz)


 all in one shot (given that you use the generic template nothing has to 
 be done, if you use your own you need to include somewhere {{=fast_tz}} in 
 it)

  -- 
  
 --- 
 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/aV1nNiDIwiY/unsubscribe?hl=en.
 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: Queries with AND in GAE

2013-04-17 Thread José Manuel López
!!! OMG .
I'm developing in two languages (client and server) same time and it's 
giving me crazy :/  
Thank you Niphlod.

On Wednesday, April 17, 2013 9:00:19 AM UTC+2, Niphlod wrote:

 db((condition)  (condition)).select()
 is the way to do it: you're doing
 db(condition and condition).select()

 On Wednesday, April 17, 2013 8:52:09 AM UTC+2, José Manuel López wrote:

 I'm trying to make a very simple query:

  offersInRange= db(db.Offer.hotel == request.vars.hotel 
 anddb.Offer.valid_from_date 
 = form.vars.valid_to_date and 

  db.Offer.valid_from_date 
 =form.vars.valid_to_date
 ).select(db.Offer.ALL)

 I have test this too:

 offersInRange= db(db.Offer.hotel == request.vars.hotel_name 
 anddb.Offer.valid_from_date 
  form.vars.valid_to_date and 

  db.Offer.valid_from_date 
 form.vars.valid_to_date
 ).select(db.Offer.ALL)

 This query must returns the Offers which are in a range and with an 
 specific ID. Instead that it returns me every row that match: 
 db.Offer.valid_from_date  form.vars.valid_to_date. Why is this 
 happening?. Any clues about the problem?.

 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: list:string type field output format

2013-04-17 Thread 黄祥
it seems can not make it work for the link, i've tried both, but same result
{{=SPAN(T('Email : '), A(', '.join(row.email), _title=T('Send Email'), 
_target='_blank', _href='mailto:%s' % row.email), _id='email_%s' % i)}}
{{=SPAN(T('Email : '), A(db.branch.email.represent(row.email), 
_title=T('Send Email'), _target='_blank', _href='mailto:%s' % row.email), 
_id='email_%s' % i)}}

yet the output is correct but when i clicked, it will produce :
['a...@a.com', 'b...@b.com']
in the email from field value

is it possible to make the list value separated in link output format? so 
that when i hover to a...@a.com will send email to a...@a.com, vice versa, not 
send to both email
thank you so much

-- 

--- 
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 type field output format

2013-04-17 Thread Niphlod
then you want to have 2 separate A, one for each email!

On Wednesday, April 17, 2013 9:41:02 AM UTC+2, 黄祥 wrote:

 it seems can not make it work for the link, i've tried both, but same 
 result
 {{=SPAN(T('Email : '), A(', '.join(row.email), _title=T('Send Email'), 
 _target='_blank', _href='mailto:%s' % row.email), _id='email_%s' % i)}}
 {{=SPAN(T('Email : '), A(db.branch.email.represent(row.email), 
 _title=T('Send Email'), _target='_blank', _href='mailto:%s' % row.email), 
 _id='email_%s' % i)}}

 yet the output is correct but when i clicked, it will produce :
 ['a...@a.com javascript:', 'b...@b.com javascript:']
 in the email from field value

 is it possible to make the list value separated in link output format? so 
 that when i hover to a...@a.com javascript: will send email to 
 a...@a.com javascript:, vice versa, not send to both email
 thank you so much


-- 

--- 
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: Check if exist table (dal)

2013-04-17 Thread damufo
Hi,
Thanks.

My solution was:

if self.table_name not in db._migrated:
self.install()


Best regards.

On Tuesday, April 16, 2013 3:31:12 PM UTC+2, dam...@gmail.com wrote:


 Hi,
 In my init class have a install() with create table.
 When creates second instance, fail.

 type 'exceptions.SyntaxError' table already defined: mytable Version 
 web2py™ Version 2.4.6-stable+timestamp.2013.04.06.17.37.38  Python Python 
 2.7.4: C:\Python27\python.exe (prefix: C:\Python27)
 How check is this exists this table?

 In this moment, i add

 try:
 self.install() #create table
 except:
 pass

 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] Customizing login form

2013-04-17 Thread Aydin S
I am trying to customize the location and appearance of the login form. I 
am looking for the easiest way to do this. I am using return 
dict(login=auth.login()) in my default.py and {{=login} in my html. I have 
tried couple of things posted in here, but I found them vague and not quite 
understandable and non worked. for instance using {{=XML(form.custom.begin.
replace('', ' class=myclass'))}}, my question is where this code goes 
to? to the html file? Where and how to define myclass? and what is the 
replace? How to end this? any simple example code would be so helpful.

-- 

--- 
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] REF: Component + Javascript

2013-04-17 Thread Teddy Nyambe
I have a component am loading in a div
div id=test/div
{{=A('Link to comp', component=URL('research', 'mycomponent.load'),
target='setting-content')}}

div class=span8 id=setting-content

 /div

in this same view page i have a javascript

script type=text/javascript
  jQuery('#mp_257').click(function(){
jQuery('#test').html('Test')
//alert(Test)
  })
/script

The component has a button with an id=mp_257, but when i click on it,
jQuery in the view above is not being executed by replacing the Text in
the div...the component has a grid with a custom button created as follows:

links = [lambda row: A(SPAN(_class='icon-pencil'), 'Personal Details', _id
= 'mp_257', _class='btn')]

Anything why this is not working? But when I put the button in the view
using:

{{=A(SPAN(_class='icon-pencil'), 'Personal Details', _id = 'mp_257',
_class='btn')}}

All works fine, is there something about loaded component that prevents
running of javascript in the same page?

-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 

--- 
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] Newbie Tables Question

2013-04-17 Thread Doug Girard
I want to create a form which I can add multiple 'items' of different 
'types' that have different 'attributes'

For example, lets use two types of food, pizza and steak

You would start by selecting the type of food. Say pizza

Upon selecting this type you would get more form fields, specific to the 
type chosen. Maybe,

dough:
cheese:
sauce:
topping:

Where if you had chosen steak, you would get a different set of attributes. 
Maybe,

cut:
rarity:

etc..

I hope I've made myself clear, I'm just a beginner at python and am a bit 
stuck. 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] Excellent Video about web2py but no sound or subtitles

2013-04-17 Thread António Ramos
http://vimeo.com/8229814

-- 

--- 
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: REF: Component + Javascript

2013-04-17 Thread Niphlod
you're attaching a jquery event to an element that when the script is 
executed is not yet present (it's loading...)

try to rewrite your 

script type=text/javascript
  jQuery('#mp_257').click(function(){
jQuery('#test').html('Test')
//alert(Test)
  })
/script

to 

script type=text/javascript
  jQuery(document).on('click', '#mp_257', function(){
jQuery('#test').html('Test')
//alert(Test)
  })
/script



On Wednesday, April 17, 2013 12:15:03 PM UTC+2, software.ted wrote:

 I have a component am loading in a div
 div id=test/div
 {{=A('Link to comp', component=URL('research', 'mycomponent.load'), 
 target='setting-content')}}

 div class=span8 id=setting-content

  /div

 in this same view page i have a javascript

 script type=text/javascript
   jQuery('#mp_257').click(function(){
 jQuery('#test').html('Test')
 //alert(Test)
   })
 /script

 The component has a button with an id=mp_257, but when i click on it, 
 jQuery in the view above is not being executed by replacing the Text in 
 the div...the component has a grid with a custom button created as follows:

 links = [lambda row: A(SPAN(_class='icon-pencil'), 'Personal Details', _id 
 = 'mp_257', _class='btn')]

 Anything why this is not working? But when I put the button in the view 
 using:

 {{=A(SPAN(_class='icon-pencil'), 'Personal Details', _id = 'mp_257', 
 _class='btn')}}

 All works fine, is there something about loaded component that prevents 
 running of javascript in the same page?

 -- 

 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he is 
 all - Thomas Carlyle 1795-1881

 /~ 


-- 

--- 
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] Using SQLFORM.grid with large datasets

2013-04-17 Thread Johann Spies
By large datasets I mean a database of which one of the tables contain more
than 42 million records.

Using SQLFORM.grid on such a dataset is very slow because the process wants
to count the total number of records.

I am using Postgresql.  I can get an estimated size of the table by
replacing count(*) with

# SELECT reltuples::integer FROM pg_class WHERE oid = 'isi.ritem'::regclass;
 reltuples
---
  42183232
(1 row)

And I get the result in a fraction of a second. When working on such a
scale the exact number of rows (count is also not always accurate on an
active database) is not a necessity.

Is there a way I can replace the count(*) in the grid with the query
illustrated above?

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

-- 

--- 
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: Newbie Tables Question

2013-04-17 Thread 黄祥
i think it can be achieve in the view part by jquery.

e.g. i assume you use sqlform.grid with the table food and have the table 
field food_type (requires=IS_IN_SET('Pizza', 'Steak')) and field 
specific_food
*default/food.html*
{{extend 'layout.html'}}

{{=grid}}

script
jQuery(document).ready(function(){
if(jQuery('#food_food_type').val() == 'Pizza'){
jQuery('#food_specific_food__row').show();
jQuery('#food_food_type').change(function(){
if(jQuery('#food_food_type').val() == 'Pizza')
jQuery('#food_specific_food__row').show();
else 
jQuery('#food_specific_food__row').hide();});}
else {
jQuery('#food_specific_food__row').hide();
jQuery('#food_food_type').change(function(){
if(jQuery('#food_food_type').val() == 'Pizza')
jQuery('#food_specific_food__row').show();
else 
jQuery('#food_specific_food__row').hide();});}
});
/script

hope this can help
best regards

-- 

--- 
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 create / edit / delete help (I feel like I've hit a wall)

2013-04-17 Thread 黄祥


 Field('complete_address', 'string',
   compute=lambda r: '%(address)s %(city)s %(location_state)s 
 %(zipcode)s' % r)


for complete_address, in terms of performance or efficiency, what is the 
difference between store it in table field or just format it in view side?

best regards

-- 

--- 
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 type field output format

2013-04-17 Thread Anthony
You have to make a comma-separated list of A()'s instead of inserting all 
the email addresses in a single mailto:

', '.join([A(email, _title=T('Send Email'), _target='_blank',
 _href='mailto:%s' % email) for email in row.email])

Anthony

On Wednesday, April 17, 2013 3:41:02 AM UTC-4, 黄祥 wrote:

 it seems can not make it work for the link, i've tried both, but same 
 result
 {{=SPAN(T('Email : '), A(', '.join(row.email), _title=T('Send Email'), 
 _target='_blank', _href='mailto:%s' % row.email), _id='email_%s' % i)}}
 {{=SPAN(T('Email : '), A(db.branch.email.represent(row.email), 
 _title=T('Send Email'), _target='_blank', _href='mailto:%s' % row.email), 
 _id='email_%s' % i)}}

 yet the output is correct but when i clicked, it will produce :
 ['a...@a.com javascript:', 'b...@b.com javascript:']
 in the email from field value

 is it possible to make the list value separated in link output format? so 
 that when i hover to a...@a.com javascript: will send email to 
 a...@a.com javascript:, vice versa, not send to both email
 thank you so much


-- 

--- 
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: REF: Component + Javascript

2013-04-17 Thread Teddy Nyambe
No luck, still quiet no activity. How can i debug jQuery?


On Wed, Apr 17, 2013 at 12:20 PM, Niphlod niph...@gmail.com wrote:

 you're attaching a jquery event to an element that when the script is
 executed is not yet present (it's loading...)

 try to rewrite your

 script type=text/javascript
   jQuery('#mp_257').click(**function(){
 jQuery('#test').html('Test')
 //alert(Test)
   })
 /script

 to

 script type=text/javascript
   jQuery(document).on('click', '#mp_257', function(){
 jQuery('#test').html('Test')
 //alert(Test)
   })
 /script



 On Wednesday, April 17, 2013 12:15:03 PM UTC+2, software.ted wrote:

 I have a component am loading in a div
 div id=test/div
 {{=A('Link to comp', component=URL('research', 'mycomponent.load'),
 target='setting-content')}}

 div class=span8 id=setting-content

  /div

 in this same view page i have a javascript

 script type=text/javascript
   jQuery('#mp_257').click(**function(){
 jQuery('#test').html('Test')
 //alert(Test)
   })
 /script

 The component has a button with an id=mp_257, but when i click on it,
 jQuery in the view above is not being executed by replacing the Text in
 the div...the component has a grid with a custom button created as follows:

 links = [lambda row: A(SPAN(_class='icon-pencil'), 'Personal Details',
 _id = 'mp_257', _class='btn')]

 Anything why this is not working? But when I put the button in the view
 using:

 {{=A(SPAN(_class='icon-pencil'**), 'Personal Details', _id = 'mp_257',
 _class='btn')}}

 All works fine, is there something about loaded component that prevents
 running of javascript in the same page?

 --
 ..**..**
 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he is
 all - Thomas Carlyle 1795-1881

 /~

  --

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






-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 

--- 
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: REF: Component + Javascript

2013-04-17 Thread Niphlod
are you sure that the button has not yet an event attached that prevents 
your custom one ?

On Wednesday, April 17, 2013 12:15:03 PM UTC+2, software.ted wrote:

 I have a component am loading in a div
 div id=test/div
 {{=A('Link to comp', component=URL('research', 'mycomponent.load'), 
 target='setting-content')}}

 div class=span8 id=setting-content

  /div

 in this same view page i have a javascript

 script type=text/javascript
   jQuery('#mp_257').click(function(){
 jQuery('#test').html('Test')
 //alert(Test)
   })
 /script

 The component has a button with an id=mp_257, but when i click on it, 
 jQuery in the view above is not being executed by replacing the Text in 
 the div...the component has a grid with a custom button created as follows:

 links = [lambda row: A(SPAN(_class='icon-pencil'), 'Personal Details', _id 
 = 'mp_257', _class='btn')]

 Anything why this is not working? But when I put the button in the view 
 using:

 {{=A(SPAN(_class='icon-pencil'), 'Personal Details', _id = 'mp_257', 
 _class='btn')}}

 All works fine, is there something about loaded component that prevents 
 running of javascript in the same page?

 -- 

 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he is 
 all - Thomas Carlyle 1795-1881

 /~ 


-- 

--- 
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] Old DAL bug (?) ValueError: invalid literal for int() with base 10: 'AssetTypes\\Character.png'

2013-04-17 Thread Arnon Marcus
We are using an old version of web2py in production (1.89.5), and are 
having issues with the DAL:

if limit: return 
db().select(db[table].ALL,orderby=db[table][orderby],limitby=(0,limit))
  File C:\wamp\www\web2py_1_89_5\gluon\sql.py, line 3307, in select
return self.parse(db, rows, self.colnames, SetClass=Set)
  File C:\wamp\www\web2py_1_89_5\gluon\sql.py, line 3353, in parse
colset[fieldname] = rid = Reference(value)
ValueError: invalid literal for int() with base 10: 'AssetTypes\\Character.png'


The relevant section we pinpointed is this:

@staticmethod
def parse(db, rows, colnames, blob_decode=True, SetClass=None):
 ...
if not '.' in referee:
*colset[fieldname] = rid = Reference(value)*
(rid._table, rid._record) = (db[referee], None)
else: ### reference not by id
colset[fieldname] = value
elif field_type == 'boolean':


We suspect that what is happening is a shift in the field-names list, that 
is causing the DAL to treat a string field as an id field.
We have some suspected culprits for thinking this - we suspect that there 
might be a discrepency between the order/length of the data-fields being 
returned, and that order/length in the field-names being passes,  which 
leads us back to suspect that something might be wrong with the colnames 
being passes in to parse from select, but that is being set in _select
:

def *_select*(self, **fields*, **attributes):
   ..
# ## if not fields specified take them all from the requested tables

if not fields:
fields = [self._db[table].ALL for table in self._tables]
*sql_f* = ', '.join([str(f) for f in *fields*])
tablenames = parse_tablenames(self.sql_w + ' ' + sql_f)
if len(tablenames)  1:
raise SyntaxError, 'Set: no tables selected'
w2p_tablenames = [ t for t in tablenames if 
isinstance(self._db[t],Table) ]
*self.colnames* = [c.strip() for c in *sql_f*.split(', ')]
if self.sql_w:
sql_w = ' WHERE ' + self.sql_w
   


def *select*(self, **fields*, **attributes):

Always returns a Rows object, even if it may be empty

 ...
return self.*parse*(db, rows, *self.colnames*, SetClass=Set)

@staticmethod
def *parse*(db, *rows*, *colnames*, blob_decode=True, SetClass=None):
virtualtables = []
new_rows = []
for (i,*row*) in enumerate(*rows*):
new_row = Row()
for* j*,colname in enumerate(*colnames*):
*value *= *row*[*j*]



I checked to see what has been changed regarding this in the current 
version:


def *_select*(self, query, *fields*, attributes):
.
if len(tablenames)  1:
raise SyntaxError('Set: no tables selected')
*sql_f* = *', '.join(map(self.expand, fields))*
*self._**c**olnames* = [c.strip() for c in *sql_f*.split(', ')]
if query:
sql_w = ' WHERE ' + self.expand(query)

def *_select_aux*(self,sql,*fields*,attributes):
   
*return processor(rows,fields,self._colnames,cacheable=cacheable)*

def *select*(self, query, fields, attributes):

Always returns a Rows object, possibly empty.
   .
return self.*_select_aux*(sql,*fields*,attributes)

...

def parse(self, rows, *fields*, *colnames*, blob_decode=True,
   .
*value* = *self.parse_value(value,ft,blob_decode)*
if field.filter_out:
value = field.filter_out(value)
*colset[fieldname] = value*


It seems a much safer implementation.

Now, we have scheduled an upgrade of web2py in our road-map, but that will 
take some time...
In the mean-time, I was wondering weather we could use some/all of the 
new*dal.py + sql.py 
*to replace our current web2py's ones.
I was wondering if that would be safe, or if we could get into unforeseen 
trouble 
doing that...
I had seen Massimo saying that the* dal.py* is now *web-framework agnostic*
The question is weather the old one is also that... In a way, does this 
mean that dal.py versions are inter-changeable across web2py versions, at 
least in this case...

What do you say? 
 

-- 

--- 
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 create / edit / delete help (I feel like I've hit a wall)

2013-04-17 Thread Anthony


 I think I've gotten the model down now correctly. Would you have any 
 advice with the controller and views ? I know the way I'm doing it now with 
 a nested for loop and counter probably isn't the best way. Maybe there is a 
 much better way to do this instead of defining the edit and delete form in 
 the view?


Not sure -- haven't studied the view code in detail to figure what you're 
trying to do, and you haven't shown the full controller code. In general, 
if you just want to be able to show a list of all records in a given table 
and allow creating and updating of records, either Crud or SQLFORM.grid are 
the way to go.
 


 Anyway, If I understand correctly, to create an edit form you simply pass 
 a record to the sqlform SQLFORM(db, record)


Yes.

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: Using SQLFORM.grid with large datasets

2013-04-17 Thread Niphlod
currently not but it is planned to be configurable (at the very minimum, 
cacheable). 

Your method BTW works only if all the table is shown, doesn't take into 
account a possible condition passed to the grid (such as db.table.user_id 
== auth.user_id) or keyword queries.

I'll start working on that as soon as possible, shouldn't be hard.
Talking about extensibility, what you'd like to pass as a parameter ?
I'm thinking to allow:
 - a callable (to which query and keywords are passed) -- you can pass the 
result of your custom query in this case, just watch out for the 
shortcomings explained earlier
 - an integer (which will trigger the cache this count for n seconds)

Would that be enough?

On Wednesday, April 17, 2013 12:58:27 PM UTC+2, Johann Spies wrote:

 By large datasets I mean a database of which one of the tables contain 
 more than 42 million records.

 Using SQLFORM.grid on such a dataset is very slow because the process 
 wants to count the total number of records.

 I am using Postgresql.  I can get an estimated size of the table by 
 replacing count(*) with 

 # SELECT reltuples::integer FROM pg_class WHERE oid = 
 'isi.ritem'::regclass;
  reltuples
 ---
   42183232
 (1 row)

 And I get the result in a fraction of a second. When working on such a 
 scale the exact number of rows (count is also not always accurate on an 
 active database) is not a necessity.

 Is there a way I can replace the count(*) in the grid with the query 
 illustrated above?

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

-- 

--- 
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] Multiple session objects being created for the same client IP

2013-04-17 Thread Yarin
(This question stems from an issue first brought up 
herehttps://groups.google.com/forum/?fromgroups=#!topic/web2py/iAlrv6yaHWk
)

We store user sessions in the DB using the web2py_session_{app} table. 
Inspecting the table, we've noticed a strange pattern happening over and 
over again:

Many of our app actions update the session. Generally, when a user hits the 
app and causes a session update, a single session record associated with 
that client gets updated in the DB. Additionally, however, we're noticing a 
large number of one-time 'orphan' session records which will also be tied 
to the same IP, but that have created_datetime = modified_datetime, meaning 
they were never updated. 

These one-time session records are usually spaced a few seconds or minutes 
apart, as if they were being created once per request. Some days there are 
dozens of these records, other days there are none. Each of these session 
records has its own unique key.

It's happening in both remote production (LAMP) and local dev (MAMP) 
environments. In both environments, however, no session records exist that 
are older than 3/10 (Today is 4/17), so something is clearing them out.

I can't make sense of this. Ideas?




-- 

--- 
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: MySQL server has gone away errors happening more and more with db-based sessions?

2013-04-17 Thread Yarin
Yes- I've documented this issue in a new question - please 
see: https://groups.google.com/d/msg/web2py/A7P4HoST-Lg/NZ3kmTTwVG0J


On Wednesday, April 17, 2013 3:08:38 AM UTC-4, Niphlod wrote:

 everyone with a different unique_key ?

 On Wednesday, April 17, 2013 12:43:35 AM UTC+2, Yarin wrote:

 OK, now I've run into some special weirdness- I don't know if it's 
 related, but it makes no sense to me:

 When I run a count of session records grouped by client IP, I get some 
 very big numbers at the top end:

 SELECThttps://my.sidekickhq.com/phpMyAdmin/url.php?url=http%3A%2F%2Fdev.mysql.com%2Fdoc%2Frefman%2F5.1%2Fen%2Fselect.htmltoken=b7e16822d6a72a4a32629ba16b760d59
  client_ip, 
 COUNThttps://my.sidekickhq.com/phpMyAdmin/url.php?url=http%3A%2F%2Fdev.mysql.com%2Fdoc%2Frefman%2F5.1%2Fen%2Fgroup-by-functions.html%23function_counttoken=b7e16822d6a72a4a32629ba16b760d59
 ( * ) AS count
 FROM `web2py_session_sidekick` 
 GROUP BY client_ip
 ORDER BY count DESC 
 LIMIT 0 , 30

 Some client ips have 100+ session records associated with them!? For 
 example, my own IP has 186 session records- including 13 where the 
 modified_datetime field equals TODAY... This makes no sense.  I did not log 
 into my app from 13 different devices today. Why would a single user 
 connecting from a single device have so many session records??






 On Tuesday, April 16, 2013 6:21:56 PM UTC-4, Yarin wrote:

 Largest session_data fields were 12 KiB

 On Tuesday, April 16, 2013 5:49:45 PM UTC-4, Niphlod wrote:

 either than a large blob/object in the session I really can't see how 
 an update so simple (syntax-wise) takes 50 seconds (when the minimum 
 reported time is 0.8ms) on mysql end.
 edit: did you try to inspect how much data is in the longest 
 session_data column ? 



-- 

--- 
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 create / edit / delete help (I feel like I've hit a wall)

2013-04-17 Thread Anthony
On Tuesday, April 16, 2013 4:07:53 PM UTC-4, Trevor Overman wrote:

 I looked at SQLFORM.grid, but to me it seemed limited to styling options. 
 I may be completely wrong and just not know how to do it correctly.


If you can't achieve what you want with the standard arguments to the grid 
method, you can manipulate the structure of the produced grid via the 
server-side 
DOMhttp://web2py.com/books/default/chapter/29/05#Server-side-DOM-and-parsing, 
and you can style it via custom CSS.

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: Newbie Tables Question

2013-04-17 Thread Anthony
On the client side, you can handle the UI changes using Javascript/Ajax. 
The problem is modeling the data in the DAL and the database. If there 
aren't too many distinct attributes across the types of items, you can use 
a single database table as usual, only populating the fields that are 
relevant for each given type. Another option might be a separate table for 
each type, again, if there is a relatively small fixed number of types. 
However, if there are a large number of types and/or attributes, and if you 
must be able to easily add more and more types/attributes over time 
(perhaps allowing users to do so directly), then you'll probably need a 
different modeling approach, such as the EAV 
modelhttp://en.wikipedia.org/wiki/Entity%E2%80%93attribute%E2%80%93value_model.
 
web2py doesn't have any built-in facilities for defining and managing such 
a model, so you'd have to manually code the CRUD operations for such a 
model.

This kind of situation is actually better handled by a document-based 
datastore, such as MongoDB, which doesn't require a fixed schema for each 
document. The DAL does have an adapter for MongoDB, but it probably 
wouldn't be useful here because the DAL still expects a fixed schema. You 
would probably just have to use a native driver and queries with something 
like MongoDB.

Anthony

On Tuesday, April 16, 2013 7:34:40 PM UTC-4, Doug Girard wrote:

 I want to create a form which I can add multiple 'items' of different 
 'types' that have different 'attributes'

 For example, lets use two types of food, pizza and steak

 You would start by selecting the type of food. Say pizza

 Upon selecting this type you would get more form fields, specific to the 
 type chosen. Maybe,

 dough:
 cheese:
 sauce:
 topping:

 Where if you had chosen steak, you would get a different set of 
 attributes. Maybe,

 cut:
 rarity:

 etc..

 I hope I've made myself clear, I'm just a beginner at python and am a bit 
 stuck. 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: Multiple session objects being created for the same client IP

2013-04-17 Thread Massimo Di Pierro
Which web2py version?

On Wednesday, 17 April 2013 08:08:48 UTC-5, Yarin wrote:

 (This question stems from an issue first brought up 
 herehttps://groups.google.com/forum/?fromgroups=#!topic/web2py/iAlrv6yaHWk
 )

 We store user sessions in the DB using the web2py_session_{app} table. 
 Inspecting the table, we've noticed a strange pattern happening over and 
 over again:

 Many of our app actions update the session. Generally, when a user hits 
 the app and causes a session update, a single session record associated 
 with that client gets updated in the DB. Additionally, however, we're 
 noticing a large number of one-time 'orphan' session records which will 
 also be tied to the same IP, but that have created_datetime = 
 modified_datetime, meaning they were never updated. 

 These one-time session records are usually spaced a few seconds or minutes 
 apart, as if they were being created once per request. Some days there are 
 dozens of these records, other days there are none. Each of these session 
 records has its own unique key.

 It's happening in both remote production (LAMP) and local dev (MAMP) 
 environments. In both environments, however, no session records exist that 
 are older than 3/10 (Today is 4/17), so something is clearing them out.

 I can't make sense of this. Ideas?






-- 

--- 
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: SQLFORM create / edit / delete help (I feel like I've hit a wall)

2013-04-17 Thread Jim Steil
You can use custom forms with .grid also. No limitations there.

Jim
On Apr 17, 2013 8:13 AM, Anthony abasta...@gmail.com wrote:

 On Tuesday, April 16, 2013 4:07:53 PM UTC-4, Trevor Overman wrote:

 I looked at SQLFORM.grid, but to me it seemed limited to styling options.
 I may be completely wrong and just not know how to do it correctly.


 If you can't achieve what you want with the standard arguments to the grid
 method, you can manipulate the structure of the produced grid via the 
 server-side
 DOMhttp://web2py.com/books/default/chapter/29/05#Server-side-DOM-and-parsing,
 and you can style it via custom CSS.

 Anthony

 --

 ---
 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/FZ3BwheICUo/unsubscribe?hl=en.
 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.




Re: [web2py] Re: Async Web3Py ?

2013-04-17 Thread Arnon Marcus
Just notices, I was writing SAP instead of SPA the whole time... :)

I get what you are saying - the underlying unspoken agenda here, is this : 
Web2py should remain Pure-Python in it's default implementation
This places us on a discussion that is assuming a threaded-deployment, as 
it is also the default-implementation that would be publicized.
So, we then any argument about using evented-single-threaded deployment, is 
no longer relevant within the boundaries of this discussion.
In this case, we inevitable going to refer Tornado, which IS ALSO a 
pure-python implementation, and yet is doing non-blocking-I/O, by using 
threads.
The way I saw it in Tornado, it is wrapping async-style code that is 
abstracted away from the developers -cClasses of a kind they call 
YieldPoints (Callback, Task, Future):
http://youtu.be/4Ztq-Yz1ero?t=40m57s
* Guido has basically stolen these classes for Tulip...

So essentially, if you run web2py on-top of tornado's I/O-loop, you should 
be able to use these YieldPoint classes within the controller-actions.
The question that remains open to me is, can you do it even without 
tornado's I/O-loop... (?)
If you can, than it should be relatively straight-forward to implement a 
service that wraps around these classes, and decorate controller-actions 
with it.
If you can't, than we are in a plugin/contrib story.. Can it include a 
service? Really, what I am simply asking could be expressed and 
answered-for by a simple service...
Can a plug-in/contib be a web2py-service?

-- 

--- 
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: Multiple session objects being created for the same client IP

2013-04-17 Thread Anthony
Are clients making any kind of requests that don't send cookies?

On Wednesday, April 17, 2013 9:08:48 AM UTC-4, Yarin wrote:

 (This question stems from an issue first brought up 
 herehttps://groups.google.com/forum/?fromgroups=#!topic/web2py/iAlrv6yaHWk
 )

 We store user sessions in the DB using the web2py_session_{app} table. 
 Inspecting the table, we've noticed a strange pattern happening over and 
 over again:

 Many of our app actions update the session. Generally, when a user hits 
 the app and causes a session update, a single session record associated 
 with that client gets updated in the DB. Additionally, however, we're 
 noticing a large number of one-time 'orphan' session records which will 
 also be tied to the same IP, but that have created_datetime = 
 modified_datetime, meaning they were never updated. 

 These one-time session records are usually spaced a few seconds or minutes 
 apart, as if they were being created once per request. Some days there are 
 dozens of these records, other days there are none. Each of these session 
 records has its own unique key.

 It's happening in both remote production (LAMP) and local dev (MAMP) 
 environments. In both environments, however, no session records exist that 
 are older than 3/10 (Today is 4/17), so something is clearing them out.

 I can't make sense of this. Ideas?






-- 

--- 
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: Multiple session objects being created for the same client IP

2013-04-17 Thread Yarin
2.2.1

On Wednesday, April 17, 2013 9:16:41 AM UTC-4, Massimo Di Pierro wrote:

 Which web2py version?

 On Wednesday, 17 April 2013 08:08:48 UTC-5, Yarin wrote:

 (This question stems from an issue first brought up 
 herehttps://groups.google.com/forum/?fromgroups=#!topic/web2py/iAlrv6yaHWk
 )

 We store user sessions in the DB using the web2py_session_{app} table. 
 Inspecting the table, we've noticed a strange pattern happening over and 
 over again:

 Many of our app actions update the session. Generally, when a user hits 
 the app and causes a session update, a single session record associated 
 with that client gets updated in the DB. Additionally, however, we're 
 noticing a large number of one-time 'orphan' session records which will 
 also be tied to the same IP, but that have created_datetime = 
 modified_datetime, meaning they were never updated. 

 These one-time session records are usually spaced a few seconds or 
 minutes apart, as if they were being created once per request. Some days 
 there are dozens of these records, other days there are none. Each of these 
 session records has its own unique key.

 It's happening in both remote production (LAMP) and local dev (MAMP) 
 environments. In both environments, however, no session records exist that 
 are older than 3/10 (Today is 4/17), so something is clearing them out.

 I can't make sense of this. Ideas?






-- 

--- 
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: Multiple session objects being created for the same client IP

2013-04-17 Thread Yarin
Anthony- what type of requests would those be? Are you referring to 
browsers with cookies disabled? For example, this is happening on my own 
IP, and my browser's cookies are not disabled. 

On Wednesday, April 17, 2013 9:26:14 AM UTC-4, Anthony wrote:

 Are clients making any kind of requests that don't send cookies?

 On Wednesday, April 17, 2013 9:08:48 AM UTC-4, Yarin wrote:

 (This question stems from an issue first brought up 
 herehttps://groups.google.com/forum/?fromgroups=#!topic/web2py/iAlrv6yaHWk
 )

 We store user sessions in the DB using the web2py_session_{app} table. 
 Inspecting the table, we've noticed a strange pattern happening over and 
 over again:

 Many of our app actions update the session. Generally, when a user hits 
 the app and causes a session update, a single session record associated 
 with that client gets updated in the DB. Additionally, however, we're 
 noticing a large number of one-time 'orphan' session records which will 
 also be tied to the same IP, but that have created_datetime = 
 modified_datetime, meaning they were never updated. 

 These one-time session records are usually spaced a few seconds or 
 minutes apart, as if they were being created once per request. Some days 
 there are dozens of these records, other days there are none. Each of these 
 session records has its own unique key.

 It's happening in both remote production (LAMP) and local dev (MAMP) 
 environments. In both environments, however, no session records exist that 
 are older than 3/10 (Today is 4/17), so something is clearing them out.

 I can't make sense of this. Ideas?






-- 

--- 
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: Return value from javascript to controller

2013-04-17 Thread fun man
Hi Niplod,

It still behaves similarly.

1) fast_tz returns None,
2) the submit button to the db was not taken, and the still ask me to
fill out the form again.

This is my updated controller.
def test():
fast_tz = fast_tz_detector()
#create a new appt
form = SQLFORM(db.sometable).process()
if form.process().accepted:
response.flash = 'form accepted'
elif form.errors:
response.flash = 'form has errors'
else:
response.flash = 'please fill out the form'
return dict(form=form, fast_tz=fast_tz)



On Wed, Apr 17, 2013 at 3:10 PM, Niphlod niph...@gmail.com wrote:

 that's exactly what I tested yesterday evening... can you please try to
 strip out the next=URL('index') part ?
 It's the only thing that is different.


 On Wednesday, April 17, 2013 4:14:58 AM UTC+2, fun man wrote:

 Hi Niphlod,

 I downloaded the new one, and copied the files over. Keeping my original
 model. This is now my controller.

 1) fast_tz returns None,
 2) the submit button to the db was not taken, and the still ask me to
 fill out the form again.

 Would you mind to take a look at it? thanks for your help.

 def test():
 fast_tz = fast_tz_detector()
 #create a new appt
 form = SQLFORM(db.sometable).process(**next=URL('index'))
 if form.process().accepted:
 response.flash = 'form accepted'
 elif form.errors:
 response.flash = 'form has errors'
 else:
 response.flash = 'please fill out the form'
 return dict(form=form, fast_tz=fast_tz)





 On Wed, Apr 17, 2013 at 3:17 AM, Niphlod nip...@gmail.com wrote:



 On Tuesday, April 16, 2013 8:10:38 PM UTC+2, fun man wrote:

 Hi Niphlod,

 I need to trouble you again for your guidance.

 I've successfully copied the files. I've added a new application
 tz_test to test the plugin.

 This is my controller and there are some other scaffolding coded not
 included.
 ====
 import pytz
 from plugin_timezone import fast_tz_detector

 def detect_timezone():
 tz = fast_tz_detector()
 return dict(tz=tz)

 def test():
 detect_timezone()
 zone = session.plugin_timezone_tz
 form = SQLFORM.grid(db.sometable)
 return dict(form=form)

 This is my model.
 =
 db = DAL(sqlite://storage.sqlite)
 import pytz
 user_timezone = session.plugin_timezone_tz or 'UTC'
 db.define_table('sometable',
   Field('appointment', 'datetime',
 requires=IS_DATETIME(timezone=pytz.timezone(user_timezone))
   )
 )


 Ohhh, whoopsie. it needs a fix, sorry ^_^
 Redownload the plugin from github.

 PS: That will work ok if a user landed on the detect_timezone
 pageif you need to autodetect in the same page as the form, you should
 be able to do

 def test():
   fast_tz = fast_tz_detector()
   form = yourform .

   .
   return dict(form=form, fast_tz=fast_tz)


 all in one shot (given that you use the generic template nothing has to
 be done, if you use your own you need to include somewhere {{=fast_tz}} in
 it)

  --

 ---
 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/aV1nNiDIwiY/**unsubscribe?hl=enhttps://groups.google.com/d/topic/web2py/aV1nNiDIwiY/unsubscribe?hl=en
 .
 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/aV1nNiDIwiY/unsubscribe?hl=en.
 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: Multiple session objects being created for the same client IP

2013-04-17 Thread Anthony
I was thinking of service requests, but that shouldn't generate session 
entries anyway as long as the session isn't changed during the request.

Anthony

On Wednesday, April 17, 2013 9:29:56 AM UTC-4, Yarin wrote:

 Anthony- what type of requests would those be? Are you referring to 
 browsers with cookies disabled? For example, this is happening on my own 
 IP, and my browser's cookies are not disabled. 

 On Wednesday, April 17, 2013 9:26:14 AM UTC-4, Anthony wrote:

 Are clients making any kind of requests that don't send cookies?

 On Wednesday, April 17, 2013 9:08:48 AM UTC-4, Yarin wrote:

 (This question stems from an issue first brought up 
 herehttps://groups.google.com/forum/?fromgroups=#!topic/web2py/iAlrv6yaHWk
 )

 We store user sessions in the DB using the web2py_session_{app} table. 
 Inspecting the table, we've noticed a strange pattern happening over and 
 over again:

 Many of our app actions update the session. Generally, when a user hits 
 the app and causes a session update, a single session record associated 
 with that client gets updated in the DB. Additionally, however, we're 
 noticing a large number of one-time 'orphan' session records which will 
 also be tied to the same IP, but that have created_datetime = 
 modified_datetime, meaning they were never updated. 

 These one-time session records are usually spaced a few seconds or 
 minutes apart, as if they were being created once per request. Some days 
 there are dozens of these records, other days there are none. Each of these 
 session records has its own unique key.

 It's happening in both remote production (LAMP) and local dev (MAMP) 
 environments. In both environments, however, no session records exist that 
 are older than 3/10 (Today is 4/17), so something is clearing them out.

 I can't make sense of this. Ideas?






-- 

--- 
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 insert default value into controller

2013-04-17 Thread Alex Glaros
Tried 4 different places and methods to get the number 1 into 
field partyTypeID.  What is the correct syntax?

thanks,

Alex Glaros

def add_new_person():
##  form.vars.partyTypeID.default = 1### tried this
db.auth_user.partyID.readable = db.auth_user.partyID.writable = False 
## don't let user see field thinking they have to fill it in
db.Party.partyTypeID.readable = db.Party.partyTypeID.writable = False 
## don't let user see field thinking they have to fill it in
form=SQLFORM.factory(db.Party,db.auth_user)
if form.process().accepted:
partyID = db.Party.insert(**db.Party._filter_fields(form.vars))
form.vars.partyID=partyID
partyID = 
db.auth_user.insert(**db.auth_user._filter_fields(form.vars))
##  form.element(_name='partyTypeID').update_record(_value=1)   ### 
tried this
##  update_record(partyTypeID=1)   ### tried this
##form.vars.partyTypeID=1 ### tried this
response.flash='Thanks for filling the form'
return dict(form=form)

-- 

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




[web2py] SQLFORM.factory

2013-04-17 Thread Domagoj Kovač
Hi,

i am trying to make a form with dinamic fields and i am using 
SQLFORM.factory. I have a table where i have a list of fields in my form.

in my controller i have:

fields = []

for asset_class_attribute in asset_class_attributes:

field_name = asset_class_attribute.asset_attribute_id.name

fields.append(Field(field_name, requires=IS_NOT_EMPTY()))

form = SQLFORM.factory(*fields)

I my view u would like to do something like this:

fieldset

{{if asset_class_attributes:}}
{{for asset_class_attribute in asset_class_attributes:}}
div
{{name = asset_class_attribute.asset_attribute_id.name}}
{{=form.custom.label.name}}
{{=form.custom.widget.name}}
/div

{{pass}}
{{pass}}


{{form.custom.submit['_value'] = T(Spremi)}}
{{=form.custom.submit}}

/fieldset

I want to make name dynamic:

{{name = asset_class_attribute.asset_attribute_id.name}}
{{=form.custom.label.name}}
{{=form.custom.widget.name}}

How can i accomplish that?

-- 

--- 
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] how to insert default value into controller

2013-04-17 Thread Richard Vézina
db.Party.partyTypeID.default = 1

At the begining of your fucntion should work

Richard


On Wed, Apr 17, 2013 at 10:58 AM, Alex Glaros alexgla...@gmail.com wrote:

 Tried 4 different places and methods to get the number 1 into
 field partyTypeID.  What is the correct syntax?

 thanks,

 Alex Glaros

 def add_new_person():
 ##  form.vars.partyTypeID.default = 1### tried this
 db.auth_user.partyID.readable = db.auth_user.partyID.writable = False
 ## don't let user see field thinking they have to fill it in
 db.Party.partyTypeID.readable = db.Party.partyTypeID.writable = False
 ## don't let user see field thinking they have to fill it in
 form=SQLFORM.factory(db.Party,db.auth_user)
 if form.process().accepted:
 partyID = db.Party.insert(**db.Party._filter_fields(form.vars))
 form.vars.partyID=partyID
 partyID =
 db.auth_user.insert(**db.auth_user._filter_fields(form.vars))
 ##  form.element(_name='partyTypeID').update_record(_value=1)   
 ###
 tried this
 ##  update_record(partyTypeID=1)   ### tried this
 ##form.vars.partyTypeID=1 ### tried this
 response.flash='Thanks for filling the form'
 return dict(form=form)

 --

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




[web2py] Re: Multiple session objects being created for the same client IP

2013-04-17 Thread Massimo Di Pierro
There was a buggy version that was doing this. Could have been 2.2.1. Not 
sure. Please upgrade to the latest. The reason is that is was saving 
sessions even when data was not stored/changed. Therefore is the cookie was 
not returned it would start making new session files/records.

On Wednesday, 17 April 2013 08:26:30 UTC-5, Yarin wrote:

 2.2.1

 On Wednesday, April 17, 2013 9:16:41 AM UTC-4, Massimo Di Pierro wrote:

 Which web2py version?

 On Wednesday, 17 April 2013 08:08:48 UTC-5, Yarin wrote:

 (This question stems from an issue first brought up 
 herehttps://groups.google.com/forum/?fromgroups=#!topic/web2py/iAlrv6yaHWk
 )

 We store user sessions in the DB using the web2py_session_{app} table. 
 Inspecting the table, we've noticed a strange pattern happening over and 
 over again:

 Many of our app actions update the session. Generally, when a user hits 
 the app and causes a session update, a single session record associated 
 with that client gets updated in the DB. Additionally, however, we're 
 noticing a large number of one-time 'orphan' session records which will 
 also be tied to the same IP, but that have created_datetime = 
 modified_datetime, meaning they were never updated. 

 These one-time session records are usually spaced a few seconds or 
 minutes apart, as if they were being created once per request. Some days 
 there are dozens of these records, other days there are none. Each of these 
 session records has its own unique key.

 It's happening in both remote production (LAMP) and local dev (MAMP) 
 environments. In both environments, however, no session records exist that 
 are older than 3/10 (Today is 4/17), so something is clearing them out.

 I can't make sense of this. Ideas?






-- 

--- 
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] how to insert default value into controller

2013-04-17 Thread Richard Vézina
You may also consider using a request, just to remind what 1 mean :

db.Party.partyTypeID.default = db(db.auth_user.email == 'email').select(
db.auth_user.id).first().id

Richard


On Wed, Apr 17, 2013 at 11:02 AM, Richard Vézina 
ml.richard.vez...@gmail.com wrote:

 db.Party.partyTypeID.default = 1

 At the begining of your fucntion should work

 Richard


 On Wed, Apr 17, 2013 at 10:58 AM, Alex Glaros alexgla...@gmail.comwrote:

 Tried 4 different places and methods to get the number 1 into
 field partyTypeID.  What is the correct syntax?

 thanks,

 Alex Glaros

 def add_new_person():
 ##  form.vars.partyTypeID.default = 1### tried this
 db.auth_user.partyID.readable = db.auth_user.partyID.writable = False
 ## don't let user see field thinking they have to fill it in
 db.Party.partyTypeID.readable = db.Party.partyTypeID.writable = False
 ## don't let user see field thinking they have to fill it in
 form=SQLFORM.factory(db.Party,db.auth_user)
 if form.process().accepted:
 partyID = db.Party.insert(**db.Party._filter_fields(form.vars))
 form.vars.partyID=partyID
 partyID =
 db.auth_user.insert(**db.auth_user._filter_fields(form.vars))
 ##  form.element(_name='partyTypeID').update_record(_value=1)   
 ###
 tried this
 ##  update_record(partyTypeID=1)   ### tried this
 ##form.vars.partyTypeID=1 ### tried this
 response.flash='Thanks for filling the form'
 return dict(form=form)

 --

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




[web2py] Re: how to insert default value into controller

2013-04-17 Thread Niphlod
wouldn't a simple 

db.Party.partyTypeID.default = 1

resolve all your problems ?
I didn't understand if you want that one or the one in the auth_user table, 
but the gist should be clear enough.



On Wednesday, April 17, 2013 4:58:01 PM UTC+2, Alex Glaros wrote:

 Tried 4 different places and methods to get the number 1 into 
 field partyTypeID.  What is the correct syntax?

 thanks,

 Alex Glaros

 def add_new_person():
 ##  form.vars.partyTypeID.default = 1### tried this
 db.auth_user.partyID.readable = db.auth_user.partyID.writable = False 
 ## don't let user see field thinking they have to fill it in
 db.Party.partyTypeID.readable = db.Party.partyTypeID.writable = False 
 ## don't let user see field thinking they have to fill it in
 form=SQLFORM.factory(db.Party,db.auth_user)
 if form.process().accepted:
 partyID = db.Party.insert(**db.Party._filter_fields(form.vars))
 form.vars.partyID=partyID
 partyID = 
 db.auth_user.insert(**db.auth_user._filter_fields(form.vars))
 ##  form.element(_name='partyTypeID').update_record(_value=1)   
 ### 
 tried this
 ##  update_record(partyTypeID=1)   ### tried this
 ##form.vars.partyTypeID=1 ### tried this
 response.flash='Thanks for filling the form'
 return dict(form=form)


-- 

--- 
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: Return value from javascript to controller

2013-04-17 Thread Niphlod
I'll try that again verbatim in a few hours (as soon as I get my hands on a 
pc with python ^_^) and report back.

PS: what error does the form return ?

On Wednesday, April 17, 2013 2:40:25 PM UTC+2, fun man wrote:

 Hi Niplod,

 It still behaves similarly.

 1) fast_tz returns None, 
 2) the submit button to the db was not taken, and the still ask me to 
 fill out the form again.

 This is my updated controller.
 def test():
 fast_tz = fast_tz_detector()
 #create a new appt
 form = SQLFORM(db.sometable).process()
 if form.process().accepted:
 response.flash = 'form accepted'
 elif form.errors:
 response.flash = 'form has errors'
 else:
 response.flash = 'please fill out the form'
 return dict(form=form, fast_tz=fast_tz)



 On Wed, Apr 17, 2013 at 3:10 PM, Niphlod nip...@gmail.com 
 javascript:wrote:

 that's exactly what I tested yesterday evening... can you please try to 
 strip out the next=URL('index') part ?
 It's the only thing that is different.


 On Wednesday, April 17, 2013 4:14:58 AM UTC+2, fun man wrote:

 Hi Niphlod,

 I downloaded the new one, and copied the files over. Keeping my original 
 model. This is now my controller.

 1) fast_tz returns None, 
 2) the submit button to the db was not taken, and the still ask me to 
 fill out the form again.

 Would you mind to take a look at it? thanks for your help.

 def test():
 fast_tz = fast_tz_detector()
 #create a new appt
 form = SQLFORM(db.sometable).process(**next=URL('index'))
 if form.process().accepted:
 response.flash = 'form accepted'
 elif form.errors:
 response.flash = 'form has errors'
 else:
 response.flash = 'please fill out the form'
 return dict(form=form, fast_tz=fast_tz)
 




 On Wed, Apr 17, 2013 at 3:17 AM, Niphlod nip...@gmail.com wrote:



 On Tuesday, April 16, 2013 8:10:38 PM UTC+2, fun man wrote:

 Hi Niphlod,

 I need to trouble you again for your guidance.

 I've successfully copied the files. I've added a new application 
 tz_test to test the plugin.

 This is my controller and there are some other scaffolding coded not 
 included.
 ====
 import pytz
 from plugin_timezone import fast_tz_detector

 def detect_timezone():
 tz = fast_tz_detector()
 return dict(tz=tz)

 def test():
 detect_timezone()
 zone = session.plugin_timezone_tz
 form = SQLFORM.grid(db.sometable)
 return dict(form=form)
 
 This is my model.
 =
 db = DAL(sqlite://storage.sqlite)
 import pytz
 user_timezone = session.plugin_timezone_tz or 'UTC'
 db.define_table('sometable',
   Field('appointment', 'datetime', 
 requires=IS_DATETIME(timezone=
 pytz.timezone(user_timezone))
   )
 )


 Ohhh, whoopsie. it needs a fix, sorry ^_^ 
 Redownload the plugin from github.

 PS: That will work ok if a user landed on the detect_timezone 
 pageif you need to autodetect in the same page as the form, you should 
 be able to do

 def test():
   fast_tz = fast_tz_detector()
   form = yourform .

   .
   return dict(form=form, fast_tz=fast_tz)


 all in one shot (given that you use the generic template nothing has to 
 be done, if you use your own you need to include somewhere {{=fast_tz}} in 
 it)

  -- 
  
 --- 
 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/aV1nNiDIwiY/**unsubscribe?hl=enhttps://groups.google.com/d/topic/web2py/aV1nNiDIwiY/unsubscribe?hl=en
 .
  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/aV1nNiDIwiY/unsubscribe?hl=en.
 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.




Re: [web2py] Re: Async Web3Py ?

2013-04-17 Thread Ricardo Pedroso
I'm didn't follow this discussion closed enough, probably what I have to say
was already said, but ...

 So essentially, if you run web2py on-top of tornado's I/O-loop, you should
 be able to use these YieldPoint classes within the controller-actions.

I guess not, but I may be wrong. Using web2py served by tornado you need
to use the tornado WSGIContainer that invalidates the async nature of tornado.

Tornado is (at least was) not WSGI compliant to be able to be async.

 The question that remains open to me is, can you do it even without
 tornado's I/O-loop... (?)

Yes, with Greenlets. Can be done today without any change to web2py
internals or other WSGI framework.
And probably is, currently, the only option for WSGI Applications.

See bottle docs about it: http://bottlepy.org/docs/dev/async.html

It's just a question how you implement and how you deploy.


Ricardo

-- 

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

2013-04-17 Thread Niphlod
prepare a list of names and return that to make it usable in the view
then
{{for nm in name:}}
 {{=form.custom.label['nm']}}
 {{=form.custom.widget['nm']}}
{{pass}}



On Wednesday, April 17, 2013 5:01:08 PM UTC+2, Domagoj Kovač wrote:

 Hi,

 i am trying to make a form with dinamic fields and i am using 
 SQLFORM.factory. I have a table where i have a list of fields in my form.

 in my controller i have:

 fields = []

 for asset_class_attribute in asset_class_attributes:

 field_name = asset_class_attribute.asset_attribute_id.name

 fields.append(Field(field_name, requires=IS_NOT_EMPTY()))

 form = SQLFORM.factory(*fields)

 I my view u would like to do something like this:

 fieldset

 {{if asset_class_attributes:}}
 {{for asset_class_attribute in asset_class_attributes:}}
 div
 {{name = asset_class_attribute.asset_attribute_id.name
 }}
 {{=form.custom.label.name}}
 {{=form.custom.widget.name}}
 /div

 {{pass}}
 {{pass}}


 {{form.custom.submit['_value'] = T(Spremi)}}
 {{=form.custom.submit}}

 /fieldset

 I want to make name dynamic:

 {{name = asset_class_attribute.asset_attribute_id.name
 }}
 {{=form.custom.label.name}}
 {{=form.custom.widget.name}}

 How can i accomplish that?


-- 

--- 
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 insert default value into controller

2013-04-17 Thread Anthony


 def add_new_person():

##  form.vars.partyTypeID.default = 1### tried this


The form variable doesn't even exist yet. Also, form vars are just 
values, they are not DAL Field objects, so they do not have a default 
attribute.
 

 db.auth_user.partyID.readable = db.auth_user.partyID.writable = False 
 ## don't let user see field thinking they have to fill it in
 db.Party.partyTypeID.readable = db.Party.partyTypeID.writable = False 
 ## don't let user see field thinking they have to fill it in


Before creating the form, you can set the default value for the Field 
object:

db.Party.partyTypeID.default = 1
 

 form=SQLFORM.factory(db.Party,db.auth_user)
 if form.process().accepted:
 partyID = db.Party.insert(**db.Party._filter_fields(form.vars))
 form.vars.partyID=partyID
 partyID = 
 db.auth_user.insert(**db.auth_user._filter_fields(form.vars))
 ##  form.element(_name='partyTypeID').update_record(_value=1)   
 ### 
 tried this


form.element() searches the form HTML DOM and returns the INPUT() object -- 
it is not a DAL Row object and therefore does not have an update_record() 
method.
 

 ##  update_record(partyTypeID=1)   ### tried this


That wouldn't work unless you had defined your own update_record() function 
(and in any case, there's no indication of what is being updated).
 

 ##form.vars.partyTypeID=1 ### tried this


This should work, but as the book indicates, it should happen after the 
form is created, but before it is processed.
 
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: Multiple session objects being created for the same client IP

2013-04-17 Thread Yarin
10 4 Massimo I will upgrade and update you guys on what I find. I wonder 
also if that bug has something to do with the mysql locking issue I 
describe here, which first started manifesting itself in March, a few days 
after the first 'orphan records' began appearing...
https://groups.google.com/d/msg/web2py/iAlrv6yaHWk/m7Dr8ztcN9sJ

On Wednesday, April 17, 2013 11:02:27 AM UTC-4, Massimo Di Pierro wrote:

 There was a buggy version that was doing this. Could have been 2.2.1. Not 
 sure. Please upgrade to the latest. The reason is that is was saving 
 sessions even when data was not stored/changed. Therefore is the cookie was 
 not returned it would start making new session files/records.

 On Wednesday, 17 April 2013 08:26:30 UTC-5, Yarin wrote:

 2.2.1

 On Wednesday, April 17, 2013 9:16:41 AM UTC-4, Massimo Di Pierro wrote:

 Which web2py version?

 On Wednesday, 17 April 2013 08:08:48 UTC-5, Yarin wrote:

 (This question stems from an issue first brought up 
 herehttps://groups.google.com/forum/?fromgroups=#!topic/web2py/iAlrv6yaHWk
 )

 We store user sessions in the DB using the web2py_session_{app} table. 
 Inspecting the table, we've noticed a strange pattern happening over and 
 over again:

 Many of our app actions update the session. Generally, when a user hits 
 the app and causes a session update, a single session record associated 
 with that client gets updated in the DB. Additionally, however, we're 
 noticing a large number of one-time 'orphan' session records which will 
 also be tied to the same IP, but that have created_datetime = 
 modified_datetime, meaning they were never updated. 

 These one-time session records are usually spaced a few seconds or 
 minutes apart, as if they were being created once per request. Some days 
 there are dozens of these records, other days there are none. Each of 
 these 
 session records has its own unique key.

 It's happening in both remote production (LAMP) and local dev (MAMP) 
 environments. In both environments, however, no session records exist that 
 are older than 3/10 (Today is 4/17), so something is clearing them out.

 I can't make sense of this. Ideas?






-- 

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

2013-04-17 Thread Anthony


 {{name = asset_class_attribute.asset_attribute_id.name
 }}
 {{=form.custom.label.name}}
 {{=form.custom.widget.name}}

 {{=form.custom.label[name]}}
{{=form.custom.widget[name]}}

Or maybe simplify as follows:

In the controller:

names = [attribute.asset_class_attribute_id.name for attribute 
inasset_class_attributes
]
fields = [Field(name, requires=IS_NOT_EMPTY()) for name in names]
...
return dict(form=form, names=names)

In the view:

{{for name in names:}}
div
{{=form.custom.label http://form.custom.label.name/[
name]}}
{{=form.custom.widget http://form.custom.widget.name/[
name]}}
/div

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: how to insert default value into controller

2013-04-17 Thread Alex Glaros
thanks everyone ... worked great

db.Party.partyTypeID.default = 1 ## just above where the function started

Alex

On Wednesday, April 17, 2013 8:10:12 AM UTC-7, Anthony wrote:

 def add_new_person():

 ##  form.vars.partyTypeID.default = 1### tried this


 The form variable doesn't even exist yet. Also, form vars are just 
 values, they are not DAL Field objects, so they do not have a default 
 attribute.
  

 db.auth_user.partyID.readable = db.auth_user.partyID.writable = False 
 ## don't let user see field thinking they have to fill it in
 db.Party.partyTypeID.readable = db.Party.partyTypeID.writable = False 
 ## don't let user see field thinking they have to fill it in


 Before creating the form, you can set the default value for the Field 
 object:

 db.Party.partyTypeID.default = 1
  

 form=SQLFORM.factory(db.Party,db.auth_user)
 if form.process().accepted:
 partyID = db.Party.insert(**db.Party._filter_fields(form.vars))
 form.vars.partyID=partyID
 partyID = 
 db.auth_user.insert(**db.auth_user._filter_fields(form.vars))
 ##  form.element(_name='partyTypeID').update_record(_value=1)   
 ### 
 tried this


 form.element() searches the form HTML DOM and returns the INPUT() object 
 -- it is not a DAL Row object and therefore does not have an 
 update_record() method.
  

 ##  update_record(partyTypeID=1)   ### tried this


 That wouldn't work unless you had defined your own update_record() 
 function (and in any case, there's no indication of what is being updated).
  

 ##form.vars.partyTypeID=1 ### tried this


 This should work, but as the book indicates, it should happen after the 
 form is created, but before it is processed.
  
 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: Python Redis Queue

2013-04-17 Thread Ricardo Pedroso
On Tue, Apr 16, 2013 at 12:26 AM, Tito Garrido titogarr...@gmail.com wrote:
  Nice! Is it working? Is there an example of application?

I just put on github one example (https://github.com/rpedroso/rqdboard).
It has the rq-dashboard (https://github.com/nvie/rq-dashboard)
ported to web2py.

Ricardo

-- 

--- 
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: Python Redis Queue

2013-04-17 Thread Niphlod
does this work when queueing, e.g. a function defined in models ? 
Last time I checked all my jobs needed to be in a separate 
modulemaybe the method used to implement the same thing with celery can 
be used for that.

On Wednesday, April 17, 2013 6:03:40 PM UTC+2, Ricardo Pedroso wrote:

 On Tue, Apr 16, 2013 at 12:26 AM, Tito Garrido 
 titog...@gmail.comjavascript: 
 wrote: 
   Nice! Is it working? Is there an example of application? 

 I just put on github one example (https://github.com/rpedroso/rqdboard). 
 It has the rq-dashboard (https://github.com/nvie/rq-dashboard) 
 ported to web2py. 

 Ricardo 


-- 

--- 
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: Return value from javascript to controller

2013-04-17 Thread Funmanhk
Hi Niphlod,

As always, thanks for your help. 

I do not think I got an explicit error this time. However, the input is not 
taken. When I clicked submit, the page blink and showed me a blank Add page. 

Regards,

On 17 Apr, 2013, at 23:05, Niphlod niph...@gmail.com wrote:

 I'll try that again verbatim in a few hours (as soon as I get my hands on a 
 pc with python ^_^) and report back.
 
 PS: what error does the form return ?
 
 On Wednesday, April 17, 2013 2:40:25 PM UTC+2, fun man wrote:
 
 Hi Niplod,
 
 It still behaves similarly.
 
 1) fast_tz returns None, 
 2) the submit button to the db was not taken, and the still ask me to fill 
 out the form again.
 
 This is my updated controller.
 def test():
 fast_tz = fast_tz_detector()
 #create a new appt
 form = SQLFORM(db.sometable).process()
 if form.process().accepted:
 response.flash = 'form accepted'
 elif form.errors:
 response.flash = 'form has errors'
 else:
 response.flash = 'please fill out the form'
 return dict(form=form, fast_tz=fast_tz)
 
 
 
 On Wed, Apr 17, 2013 at 3:10 PM, Niphlod nip...@gmail.com wrote:
 that's exactly what I tested yesterday evening... can you please try to 
 strip out the next=URL('index') part ?
 It's the only thing that is different.
 
 
 On Wednesday, April 17, 2013 4:14:58 AM UTC+2, fun man wrote:
 Hi Niphlod,
 
 I downloaded the new one, and copied the files over. Keeping my original 
 model. This is now my controller.
 
 1) fast_tz returns None, 
 2) the submit button to the db was not taken, and the still ask me to 
 fill out the form again.
 
 Would you mind to take a look at it? thanks for your help.
 
 def test():
 fast_tz = fast_tz_detector()
 #create a new appt
 form = SQLFORM(db.sometable).process(next=URL('index'))
 if form.process().accepted:
 response.flash = 'form accepted'
 elif form.errors:
 response.flash = 'form has errors'
 else:
 response.flash = 'please fill out the form'
 return dict(form=form, fast_tz=fast_tz)
 
 
 
 
 
 On Wed, Apr 17, 2013 at 3:17 AM, Niphlod nip...@gmail.com wrote:
 
 
 On Tuesday, April 16, 2013 8:10:38 PM UTC+2, fun man wrote:
 
 Hi Niphlod,
 
 I need to trouble you again for your guidance.
 
 I've successfully copied the files. I've added a new application tz_test 
 to test the plugin.
 
 This is my controller and there are some other scaffolding coded not 
 included.
 
 import pytz
 from plugin_timezone import fast_tz_detector
 
 def detect_timezone():
 tz = fast_tz_detector()
 return dict(tz=tz)
 
 def test():
 detect_timezone()
 zone = session.plugin_timezone_tz
 form = SQLFORM.grid(db.sometable)
 return dict(form=form)
 
 This is my model.
 =
 db = DAL(sqlite://storage.sqlite)
 import pytz
 user_timezone = session.plugin_timezone_tz or 'UTC'
 db.define_table('sometable',
   Field('appointment', 'datetime', 
 requires=IS_DATETIME(timezone=pytz.timezone(user_timezone))
   )
 )
 
 
 Ohhh, whoopsie. it needs a fix, sorry ^_^ 
 Redownload the plugin from github.
 
 PS: That will work ok if a user landed on the detect_timezone 
 pageif you need to autodetect in the same page as the form, you 
 should be able to do
 
 def test():
   fast_tz = fast_tz_detector()
   form = yourform .
 
   .
   return dict(form=form, fast_tz=fast_tz)
 
 all in one shot (given that you use the generic template nothing has to 
 be done, if you use your own you need to include somewhere {{=fast_tz}} 
 in it)
 
 -- 
  
 --- 
 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/aV1nNiDIwiY/unsubscribe?hl=en.
 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_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/aV1nNiDIwiY/unsubscribe?hl=en.
 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_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/aV1nNiDIwiY/unsubscribe?hl=en.
 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 

Re: [web2py] Re: AppStats doesn't work in my App. [GAE]

2013-04-17 Thread Christian Foster Howes
the appstats overhead is imposed all by things under the covers in GAE. 
 even google recommends that you use it for testing and debugging and 
turn it off for production use.


sorry i don't have a better answer.

cfh

On 4/17/13 0:05 , José Manuel López wrote:

Thank you Christian!. Now it works.
Any clues to low the overhead?

On Tuesday, April 16, 2013 6:28:30 PM UTC+2, Christian Foster Howes wrote:


ahhh yes...i remember.  given that appstats, while helpful for testing,
has a significant performance overhead (200ish ms per request i think),
and that some (like me) have custom appengine_config.py files we moved
web2py's appengine_config.py to appengine_config.example.py.

rename the file, redeploy and you should be all set.  if you have a
moment, consider submitting a patch to the documentation to clarify that!
;)

christian

On 4/16/13 8:41 , Jos� Manuel L�pez wrote:

Hi Christian,
First thank you for your response :) !.
In app.yaml I have: appstats:on
Regarding appengine_config.py, I don't have it!... the only one is
appengine_config.example.py that contains:
def webapp_add_wsgi_middleware(app):
  from google.appengine.ext.appstats import recording
  app = recording.appstats_wsgi_middleware(app)
  return app
I think this can be the problem?.



On Tuesday, April 16, 2013 8:19:51 AM UTC+2, Christian Foster Howes

wrote:


Jose,

i'm behind in my web2py upgrades but can you check:

   - do you have app stats enabled in app.yaml?
   - what does your appengine_config.py look like?

cfh

On Monday, April 15, 2013 12:28:59 AM UTC-7, Jos� Manuel L�pez

wrote:





https://lh4.googleusercontent.com/-xPEFarglbpA/UWvXiWWPdnI/AB0/vB3xDkBUeVY/s1600/Captura+de+pantalla+2013-04-15+a+la%28s%29+09.25.48.png


Hi,
AppStats doesn't work in my App although I have this in gaehandler.py:

LOG_STATS = TrueAPPSTATS = True
DEBUG = False

I have do anything wrong because it doesn't work in Local or in
googlespot.
As you can see in the screenshot I've the AppStats link in the CUSTOM
section, but when I select it, nothing is showed.
What is needed to enable the AppStats, I need to profile my

Application.

Thank you for your help.

EDIT: I have the version 2.4.6 stable.











--

--- 
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: Multiple session objects being created for the same client IP

2013-04-17 Thread Massimo Di Pierro
It could be. 

On Wednesday, 17 April 2013 10:23:45 UTC-5, Yarin wrote:

 10 4 Massimo I will upgrade and update you guys on what I find. I wonder 
 also if that bug has something to do with the mysql locking issue I 
 describe here, which first started manifesting itself in March, a few days 
 after the first 'orphan records' began appearing...
 https://groups.google.com/d/msg/web2py/iAlrv6yaHWk/m7Dr8ztcN9sJ

 On Wednesday, April 17, 2013 11:02:27 AM UTC-4, Massimo Di Pierro wrote:

 There was a buggy version that was doing this. Could have been 2.2.1. Not 
 sure. Please upgrade to the latest. The reason is that is was saving 
 sessions even when data was not stored/changed. Therefore is the cookie was 
 not returned it would start making new session files/records.

 On Wednesday, 17 April 2013 08:26:30 UTC-5, Yarin wrote:

 2.2.1

 On Wednesday, April 17, 2013 9:16:41 AM UTC-4, Massimo Di Pierro wrote:

 Which web2py version?

 On Wednesday, 17 April 2013 08:08:48 UTC-5, Yarin wrote:

 (This question stems from an issue first brought up 
 herehttps://groups.google.com/forum/?fromgroups=#!topic/web2py/iAlrv6yaHWk
 )

 We store user sessions in the DB using the web2py_session_{app} table. 
 Inspecting the table, we've noticed a strange pattern happening over and 
 over again:

 Many of our app actions update the session. Generally, when a user 
 hits the app and causes a session update, a single session record 
 associated with that client gets updated in the DB. Additionally, 
 however, 
 we're noticing a large number of one-time 'orphan' session records which 
 will also be tied to the same IP, but that have created_datetime = 
 modified_datetime, meaning they were never updated. 

 These one-time session records are usually spaced a few seconds or 
 minutes apart, as if they were being created once per request. Some days 
 there are dozens of these records, other days there are none. Each of 
 these 
 session records has its own unique key.

 It's happening in both remote production (LAMP) and local dev (MAMP) 
 environments. In both environments, however, no session records exist 
 that 
 are older than 3/10 (Today is 4/17), so something is clearing them out.

 I can't make sense of this. Ideas?






-- 

--- 
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] bootstrap interface builder

2013-04-17 Thread Massimo DiPierro
http://www.layoutit.com/

-- 

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

2013-04-17 Thread Domagoj Kovač
Thanks guys! I will try it.

-- 

--- 
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] bootstrap interface builder

2013-04-17 Thread Ovidio Marinho
Very,very Good +1




 Ovidio Marinho Falcao Neto
 Web Developer
 ovidio...@gmail.com
   83   8826 9088 - Oi
   83   9336 3782 - Claro
Brasil



2013/4/17 Massimo DiPierro massimo.dipie...@gmail.com

 http://www.layoutit.com/

 --

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




[web2py] Re: SQLFORM.factory

2013-04-17 Thread Domagoj Kovač
This works:

{{=form.custom.label[asset_class_attribute.
asset_attribute_id.name]}}
{{=form.custom.widget[asset_class_attribute.
asset_attribute_id.name]}}

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.




Re: [web2py] Re: EmberJS is the web2py of the client! :)

2013-04-17 Thread Alec Taylor
FYI: The presenter/author has published his examples using metawidget
and AngularJS to generate forms:
http://files.meetup.com/4966012/Metawidget%20AngularJS%20Examples.zip

On Wed, Apr 17, 2013 at 7:12 AM, Niphlod niph...@gmail.com wrote:


 On Tuesday, April 16, 2013 10:38:11 PM UTC+2, Magnitus wrote:

 Well, basically, it limited the usefulness of the form facilities and the
 tight default integration between authentication and the rendered pages took
 some time to bypass and then there was stripping the layout.html file to
 it's bare essentials.

 Overall, I've always been much happier to use web2py for it's server-side
 features and let it be a flexible interface with which 100% custom-made
 client-side code could interact.


 yeah. the real problem is that no-one working on angularjs is making public
 its own widgets.
 All that it takes is overloading SQLFORM.widgets and given that we ship
 web2py with a formstyle parameter that can be a callable from some time, all
 that is needed is something that generates angular templates out of models
 (and someone that is willing to do it).
 Once stable, that formstyle can be included in standard web2py and the
 newwidgets.py module shipped in gluon/contrib.
 then SQLFORM(thetable, formstyle='angularjs') will be all what's needed

 Right now I don't have any interest in angularjs so I call myself out of the
 competition, but feel free to pack a starter app and I'll be more than glad
 to review the code.


 --

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




Re: [web2py] Re: Return value from javascript to controller

2013-04-17 Thread Niphlod
ok.

There was an error in your code, a double call to process() .
But there was also on my end: when you do in the same function that shows 
the form a fast_tz_detector(), basically you trigger a POST request that 
updates the formkey associated with the form. 
Blame on me that use LOAD() all the times.

In order to avoid intricacies of CSRF (that you can definitely circumvent 
by hand, but it's not recommended if you don't understand all the 
implications), it's better either to check for the timezone earlier in the 
process.
Actually the module is in use in a site of mine, where a default landing 
page is hit by every user before having the possibility to fill a form ... 
also, it's not useful to check for the user timezone everytime he loads a 
page ^_^.
Even so, if you want to detect the timezone in the same page where there is 
the form, your safest resort would be to include a LOADed component that 
triggers the timezone detection.

Summary: here's the code to accomplish timezone detection in the form
def mytzdetector(): #just does timezone detection
fast_tz = fast_tz_detector()
return dict(fast_tz=fast_tz)

def test():
if not session.plugin_timezone_tz: #if it's already set, skip detection
fast_tz = LOAD('default', 'mytzdetector.load', ajax=True) #load 
with ajax
else:
fast_tz = None

form = SQLFORM(db.sometable)

if form.process().accepted:
response.flash = 'form accepted'
elif form.errors:
response.flash = 'form has errors'
else:
response.flash = 'please fill out the form'
return dict(form=form, fast_tz=fast_tz)


-- 

--- 
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] bootstrap interface builder

2013-04-17 Thread Richard Vézina
Awesome!

Richard


On Wed, Apr 17, 2013 at 2:15 PM, Ovidio Marinho ovidio...@gmail.com wrote:

 Very,very Good +1




  Ovidio Marinho Falcao Neto
  Web Developer
  ovidio...@gmail.com
83   8826 9088 - Oi
83   9336 3782 - Claro
 Brasil



 2013/4/17 Massimo DiPierro massimo.dipie...@gmail.com

 http://www.layoutit.com/

 --

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




-- 

--- 
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] bootstrap interface builder

2013-04-17 Thread Alec Taylor
Not bad!

Also I should mention that there are quite a few players in this
market; using Twitter Bootstrap as base.

On Thu, Apr 18, 2013 at 3:37 AM, Massimo DiPierro
massimo.dipie...@gmail.com wrote:
 http://www.layoutit.com/

 --

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




[web2py] Alternative to SQLFORM for Angular

2013-04-17 Thread RHC
I have recently been exploring the possibilities of AngularJS and so far it 
looks like a great framework for interactive forms and general data editing.

I would love to use it with web2py as I love the way web2py works and much 
prefer python to javascript :-)

My main concern is that web2py's form validation and security features are 
really useful but would clash with the angular way of doing things. It 
seems to me that the way to get the two working together would be to create 
an alternative to FORM/SQLFORM/CRUD that instead of generating HTML would 
generate a json object containing all the field details and data for 
angular to then use to build the form or whatever interface is required.

I would like to have a go at this but I know a lot gets done behind the 
scenes to generate forms and then validate the forms and generate error 
messages where validation fails. I don't want to try and recreate all these 
features from scratch so I'm thinking that maybe it is possible to reuse 
various methods and functions already used by the current form methods to 
do the same thing but generate json instead of HTML. What I would like to 
do is to be able to send a set of data (or a blank template) to the client 
using json and then have this data all posted back to web2py as json and 
have web2py validate this data and update/insert the relevant records.This 
data could be a single record, or a record and many linked records from 
another table.

Does this sound feasible to those who know a bit more about how all these 
form methods work behind the scenes? Can anyone give me a few pointers? 
Even better has anyone already tackled this challenge who can share their 
work? It seems to me that this kind of feature could be very useful for the 
growing number of javascript front end frameworks available.

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: Alternative to SQLFORM for Angular

2013-04-17 Thread Niphlod
on the widgets part, nobody did anything (or, in other words, even if it 
did, he/she didn't share with us).
On the serialize values as json shouldn't be hard, but you must hook up 
your angular model with the data. Same thing goes for errors.
On the receive a json string and use those values to insert into a table 
web2py trunk parses whatever valid json POSTed values (Content-Type: 
application/json) and fills up request.vars with the decoded json dict.

On Wednesday, April 17, 2013 10:15:12 PM UTC+2, RHC wrote:

 I have recently been exploring the possibilities of AngularJS and so far 
 it looks like a great framework for interactive forms and general data 
 editing.

 I would love to use it with web2py as I love the way web2py works and much 
 prefer python to javascript :-)

 My main concern is that web2py's form validation and security features are 
 really useful but would clash with the angular way of doing things. It 
 seems to me that the way to get the two working together would be to create 
 an alternative to FORM/SQLFORM/CRUD that instead of generating HTML would 
 generate a json object containing all the field details and data for 
 angular to then use to build the form or whatever interface is required.

 I would like to have a go at this but I know a lot gets done behind the 
 scenes to generate forms and then validate the forms and generate error 
 messages where validation fails. I don't want to try and recreate all these 
 features from scratch so I'm thinking that maybe it is possible to reuse 
 various methods and functions already used by the current form methods to 
 do the same thing but generate json instead of HTML. What I would like to 
 do is to be able to send a set of data (or a blank template) to the client 
 using json and then have this data all posted back to web2py as json and 
 have web2py validate this data and update/insert the relevant records.This 
 data could be a single record, or a record and many linked records from 
 another table.

 Does this sound feasible to those who know a bit more about how all these 
 form methods work behind the scenes? Can anyone give me a few pointers? 
 Even better has anyone already tackled this challenge who can share their 
 work? It seems to me that this kind of feature could be very useful for the 
 growing number of javascript front end frameworks available.

 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: response.menu args

2013-04-17 Thread Robin Manoli
The second argument here tells whether this menu item is active or not. 
Setting this to true adds the class=web2py-menu-active to the li of the 
menu-item.

Unfortunately though, this class is not implemented by default in web2py, 
and nor is the argument set to (request.function=='index') which would be 
more pedagogic. However, since the default menu is made in twitter 
bootstrap, it would be neater to use bootstrap's own active class, which is 
simply named active.

How can I change the current line of code to set the active class to 
active instead of web2py-menu-active?
The current menu code in layout.html is:
{{=MENU(response.menu, _class='mobile-menu nav' if is_mobile else 
'nav',mobile=is_mobile,li_class='dropdown',ul_class='dropdown-menu')}}


Den onsdagen den 19:e september 2012 kl. 17:55:09 UTC+2 skrev lyn2py:

 Hi guys,

 This is a typical code
 response.menu = [
 (T('Home'), False, URL('default','index'), [])
 ]

 I would like to ask, what does the 2nd arg, False actually refer to?
 I tried changing it to True but it didn't seem to have any effect on the 
 menu.
 I tried a quick search on the manual and the groups, but didn't manage to 
 find out. 

 Thanks for the quick help!


-- 

--- 
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: Alternative to SQLFORM for Angular

2013-04-17 Thread Richard Vézina
There is validate_and_insert() and validate_and_update(), never use them
but was planning to... So I don't know if they return error that you could
exploit in angular and the retroaction can become weird I don't know you
may have a read about those methodes

Richard


On Wed, Apr 17, 2013 at 4:19 PM, Niphlod niph...@gmail.com wrote:

 on the widgets part, nobody did anything (or, in other words, even if it
 did, he/she didn't share with us).
 On the serialize values as json shouldn't be hard, but you must hook up
 your angular model with the data. Same thing goes for errors.
 On the receive a json string and use those values to insert into a table
 web2py trunk parses whatever valid json POSTed values (Content-Type:
 application/json) and fills up request.vars with the decoded json dict.


 On Wednesday, April 17, 2013 10:15:12 PM UTC+2, RHC wrote:

 I have recently been exploring the possibilities of AngularJS and so far
 it looks like a great framework for interactive forms and general data
 editing.

 I would love to use it with web2py as I love the way web2py works and
 much prefer python to javascript :-)

 My main concern is that web2py's form validation and security features
 are really useful but would clash with the angular way of doing things. It
 seems to me that the way to get the two working together would be to create
 an alternative to FORM/SQLFORM/CRUD that instead of generating HTML would
 generate a json object containing all the field details and data for
 angular to then use to build the form or whatever interface is required.

 I would like to have a go at this but I know a lot gets done behind the
 scenes to generate forms and then validate the forms and generate error
 messages where validation fails. I don't want to try and recreate all these
 features from scratch so I'm thinking that maybe it is possible to reuse
 various methods and functions already used by the current form methods to
 do the same thing but generate json instead of HTML. What I would like to
 do is to be able to send a set of data (or a blank template) to the client
 using json and then have this data all posted back to web2py as json and
 have web2py validate this data and update/insert the relevant records.This
 data could be a single record, or a record and many linked records from
 another table.

 Does this sound feasible to those who know a bit more about how all these
 form methods work behind the scenes? Can anyone give me a few pointers?
 Even better has anyone already tackled this challenge who can share their
 work? It seems to me that this kind of feature could be very useful for the
 growing number of javascript front end frameworks available.

 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.




-- 

--- 
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 somebody hack a user tracker and download counter for us ?

2013-04-17 Thread smoggy
Just saying that if there is somebody with some free time and in need of a 
challenge that would be great. It would also further enhance our beloved 
web2py. You people are so judgmental these days.

Terça-feira, 16 de Abril de 2013 22:24:03 UTC+1, Anthony escreveu:

 Are you saying you don't know how to do it, or you just want someone to do 
 your work for you?

 On Tuesday, April 16, 2013 3:16:07 PM UTC-4, smoggy wrote:

 I was wondering if somebody could hack a web2py slice that wraps the 
 A(_href) and adds the clicks to a db, also for downloads, for each session 
 it could track the user actions and create a behavior/path from it.

 It would be great for everybody.

 This slice could be a nice base
 http://www.web2pyslices.com/slice/show/1358/a-simple-page-statistics-model
  


-- 

--- 
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 type field output format

2013-04-17 Thread 黄祥
thank you so much for your hint anthony, it seems must be string type, when 
i try to use your hints it return an error 
*not work*
{{=SPAN(T('Email : '), ', '.join([A(email, _title=T('Send Email'), 
_target='_blank',
 _href='mailto:%s' % email) for email in row.email]), 
_id='email_%s' % i)}}

Traceback

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

Traceback (most recent call last):
  File /host/Download/web2py/gluon/restricted.py, line 212, in restricted
exec ccode in environment
  File 
/host/Download/web2py/applications/stifix/views/default/contact_us.html, line 
92, in module
TypeError: sequence item 0: expected string, A found


*work but the output result not expected (no link A href)*
{{=SPAN(T('Email : '), ', '.join([str(email) for email in row.email]), 
_id='email_%s' % i)}}

any idea how to accomplished it?
thank you very much in advance

-- 

--- 
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] bootstrap interface builder

2013-04-17 Thread 黄祥
+1

-- 

--- 
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] could web editor highlight py syntax in templates (not just html)?

2013-04-17 Thread Jurgis Pralgauskis
Hi, 

I thought w2p templates are very similar to PHP idea.

and that was one of the reasons, why php became so popular -- starting to 
develop was very simple -- everything in one file.

in this supposition, I thought - I can give it for (very) introductory web 
dev.

and *if the web editor would do py syntax highliting alongside with html, 
it would be very nice :) *
I imagine it's possible to regexp these py-islands in template and do the 
highliting... maybe there are issues I should know before I try..

or vice verse -- in controller -- try to highlight any string (or ) 
syntax as html

-- 

--- 
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: Using SQLFORM.grid with large datasets

2013-04-17 Thread Niphlod
check trunk as soon as the Pull Request gets merged


def test3(dbset, request_vars):
##you can retrieve the current query with
##dbset._select(), i.e. dbset is a db(query) object

##request_vars are the current request.vars
###so you can check for keywods etc etc etc
###checking for groupby, distinct, etc is up to you!

##given that is a callable you may cache it externally
## with a return dbset.count(cache=(cache.ram, 60))
## and do all your crazy things

## method that works on postgresql only for a full-table-count
result = db.executesql(SELECT reltuples::integer FROM pg_class WHERE 
oid = 'public.awesome'::regclass;)
return result[0][0]

def test2():
#mode1
cache_count = 127
#mode2
cache_count = (cache.ram, 60)
#mode3
cache_count = test3
grid = SQLFORM.grid(db.awesome, cache_count=cache_count)
return dict(grid=grid)


Can I leave documentation up to someone willing to test it and report back 
? :P


PS: self_confidence mode=onfixed 8 hours later.web2py is 
awesome/self_confidence

PS2: on a test table with 4M rows, two 'string' fields, postgresql 9.2 
takes 1.9sec to do a standard count(*). 
Things definitely improved (although it remains a heavy operation for MVCC 
databases) on the count(*) since previous versions.

-- 

--- 
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 somebody hack a user tracker and download counter for us ?

2013-04-17 Thread Anthony
So, the latter, then?

On Wednesday, April 17, 2013 5:07:27 PM UTC-4, smoggy wrote:

 Just saying that if there is somebody with some free time and in need of a 
 challenge that would be great. It would also further enhance our beloved 
 web2py. You people are so judgmental these days.

 Terça-feira, 16 de Abril de 2013 22:24:03 UTC+1, Anthony escreveu:

 Are you saying you don't know how to do it, or you just want someone to 
 do your work for you?

 On Tuesday, April 16, 2013 3:16:07 PM UTC-4, smoggy wrote:

 I was wondering if somebody could hack a web2py slice that wraps the 
 A(_href) and adds the clicks to a db, also for downloads, for each session 
 it could track the user actions and create a behavior/path from it.

 It would be great for everybody.

 This slice could be a nice base

 http://www.web2pyslices.com/slice/show/1358/a-simple-page-statistics-model
  


-- 

--- 
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 type field output format

2013-04-17 Thread Niphlod
yep, html helpers aren't properly strings, so they can't be joined with a 
simple ','.join()
However, you can do it with the CAT (from conCAT)

try 

SPAN(T('Email'), CAT([A(email) for a in emails]))

On Wednesday, April 17, 2013 11:12:26 PM UTC+2, 黄祥 wrote:

 thank you so much for your hint anthony, it seems must be string type, 
 when i try to use your hints it return an error 
 *not work*
 {{=SPAN(T('Email : '), ', '.join([A(email, _title=T('Send Email'), 
 _target='_blank',
  _href='mailto:%s' % email) for email in row.email]), 
 _id='email_%s' % i)}}

 Traceback

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

 Traceback (most recent call last):
   File /host/Download/web2py/gluon/restricted.py, line 212, in restricted
 exec ccode in environment
   File 
 /host/Download/web2py/applications/stifix/views/default/contact_us.html, 
 line 92, in module
 TypeError: sequence item 0: expected string, A found


 *work but the output result not expected (no link A href)*
 {{=SPAN(T('Email : '), ', '.join([str(email) for email in row.email]), 
 _id='email_%s' % i)}}

 any idea how to accomplished it?
 thank you very much in advance


-- 

--- 
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 somebody hack a user tracker and download counter for us ?

2013-04-17 Thread Niphlod
/me shows Anthony some love...

On Wednesday, April 17, 2013 11:29:00 PM UTC+2, Anthony wrote:

 So, the latter, then?


 

-- 

--- 
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: Excellent Video about web2py but no sound or subtitles

2013-04-17 Thread Rufus
I'm only 5 minutes into it, and I had to reply!

It is great to be watching over the shoulder of a person who knows what 
he (or she) is doing!

I can't wait to watch the rest

-- 

--- 
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: help with css

2013-04-17 Thread Mark
bootstrap-responsive.min.css caused the problems. Maybe the whole bootstrap 
need to be re-configured. Removed  
response.files.append(URL('static','css/bootstrap-responsive.min.css')) 
from layout.html will fix most of the problems.

Mark

On Saturday, April 13, 2013 5:29:39 PM UTC-4, Massimo Di Pierro wrote:

 In twitter bootstrap and web2py when the screen is too narrow the menu 
 display as a single button which triggers a drop down. This happens to me 
  every time I give a talk and the menu disappears because the screen gets 
 narrower on a projector. Moreover when the menu is a dropdown, submenus do 
 not work?

 Any suggestions for changing this behavior?

 Massimo 


-- 

--- 
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: Alternative to SQLFORM for Angular

2013-04-17 Thread Alan Etkin
 My main concern is that web2py's form validation and security features 
are really useful but would clash with the angular way of doing 
 things. It seems to me that the way to get the two working together would 
be to create an alternative to FORM/SQLFORM/CRUD that 
 instead of generating HTML would generate a json object containing all 
the field details and data for angular to then use to build the 
 form or whatever interface is required.

I think you mean something like this:

http://code.google.com/p/plugin-clientapi

Nobody bothered to try it yet. Instead, I keep reading that there's no 
interface between client frameworks and web2py. Also, I really don't get 
why would web2py need to build AngularJS widgets, when you can just define 
the model client-side, by simply doing the following from any web2py app 
(since ~2.4):

def getmodel():
return db.as_json()

Or, for a more sophisticated setup, retrieve a dictionary with db.as_dict() 
and use it in a .json view or service.

-- 

--- 
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 type field output format

2013-04-17 Thread Anthony
Sorry, wasn't thinking -- you could do:

{{=SPAN(T('Email : '), XML(', '.join([A(email, _title=T('Send Email'),_target
='_blank',
   _href='mailto:%s' % email).xml() for email in row.email])), _id=
'email_%s' % i)}}

Anthony

On Wednesday, April 17, 2013 5:12:26 PM UTC-4, 黄祥 wrote:

 thank you so much for your hint anthony, it seems must be string type, 
 when i try to use your hints it return an error 
 *not work*
 {{=SPAN(T('Email : '), ', '.join([A(email, _title=T('Send Email'), 
 _target='_blank',
  _href='mailto:%s' % email) for email in row.email]), 
 _id='email_%s' % i)}}

 Traceback

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

 Traceback (most recent call last):
   File /host/Download/web2py/gluon/restricted.py, line 212, in restricted
 exec ccode in environment
   File 
 /host/Download/web2py/applications/stifix/views/default/contact_us.html, 
 line 92, in module
 TypeError: sequence item 0: expected string, A found


 *work but the output result not expected (no link A href)*
 {{=SPAN(T('Email : '), ', '.join([str(email) for email in row.email]), 
 _id='email_%s' % i)}}

 any idea how to accomplished it?
 thank you very much in advance


-- 

--- 
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: help with css

2013-04-17 Thread LightDot
Well, of course bootstrap-responsive.min.css integration is where the 
problem is... But it can't just be removed, welcome app being responsive, 
in other words mobile ready, is a widely used feature.

Alan's first reply is absolutely correct in assessing the problem. I 
actually noticed this while testing apps before, but couldn't think of a 
valid use case for small non-mobile screens and thus didn't think much of 
it. Hah, a projector...! Just goes to show how hard it is to think of all 
the ways something is used in real life.

I just tested Paolo's fix with multiple complex submenus on 800x600 
non-mobile and various mobile emulations and it works as expected. Good 
work!

Regards,
Ales


On Thursday, April 18, 2013 12:05:15 AM UTC+2, Mark wrote:

 bootstrap-responsive.min.css caused the problems. Maybe the whole 
 bootstrap need to be re-configured. Removed  
 response.files.append(URL('static','css/bootstrap-responsive.min.css')) 
 from layout.html will fix most of the problems.

 Mark

 On Saturday, April 13, 2013 5:29:39 PM UTC-4, Massimo Di Pierro wrote:

 In twitter bootstrap and web2py when the screen is too narrow the menu 
 display as a single button which triggers a drop down. This happens to me 
  every time I give a talk and the menu disappears because the screen gets 
 narrower on a projector. Moreover when the menu is a dropdown, submenus do 
 not work?

 Any suggestions for changing this behavior?

 Massimo 



-- 

--- 
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] Where did the auth_user table go (v. 2.4.x) that used to be in db.py

2013-04-17 Thread wdtnh
I need to modify the auth_user table to add a field.  It used to be in 
db.py file?  Where is it defined now?

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: Where did the auth_user table go (v. 2.4.x) that used to be in db.py

2013-04-17 Thread Anthony
Are you talking about in the welcome scaffolding application? In there, 
auth.define_tables(...) automatically defines the auth_user table (always 
has). If you just want to add fields, no need to manually define the whole 
table -- instead use auth.settings.extra_fields (see 
http://web2py.com/books/default/chapter/29/09#Customizing-Auth).

Anthony

On Wednesday, April 17, 2013 7:58:00 PM UTC-4, wdtnh wrote:

 I need to modify the auth_user table to add a field.  It used to be in 
 db.py file?  Where is it defined now?

 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] Getting SSL to work with web2py

2013-04-17 Thread Marko Poutiainen
Sorry if this is a double post by I posted this question 10 minutes ago and 
still can't see the original post.

I have been trying to get SSL to work with web2py so that I can access the 
admin panel. Now I'm running out of ideas. I attached the logs that I get 
when I reload Apache to this message and they do include some suspicious 
stuff but I have no clue whether they are the issue or not.

Apache settings should be the same as in the Ubuntu setup script: 
https://code.google.com/p/web2py/source/browse/scripts/setup-web2py-ubuntu.sh , 
file permissions should be correct as well etc.

So what am I doing wrong?

-- 

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


[Wed Apr 17 23:00:21 2013] [notice] Graceful restart requested, doing restart
[Wed Apr 17 23:00:21 2013] [info] mod_wsgi (pid=26906): Destroying interpreters.
[Wed Apr 17 23:00:21 2013] [info] mod_wsgi (pid=26906): Cleanup interpreter ''.
[Wed Apr 17 23:00:21 2013] [info] mod_wsgi (pid=26861): Shutdown requested 'web2
py'.
[Wed Apr 17 23:00:21 2013] [info] mod_wsgi (pid=26861): Stopping process 'web2py
'.
[Wed Apr 17 23:00:21 2013] [info] mod_wsgi (pid=26861): Destroying interpreters.
[Wed Apr 17 23:00:21 2013] [info] mod_wsgi (pid=26861): Destroy interpreter 'www
2.olka.fi|'.
[Wed Apr 17 23:00:21 2013] [info] [client ::1] Connection to child 8 
established (server www2.olka.fi:443)
[Wed Apr 17 23:00:21 2013] [info] Seeding PRNG with 648 bytes of entropy
[Wed Apr 17 23:00:21 2013] [debug] ssl_engine_kernel.c(1866): OpenSSL: 
Handshake: start
[Wed Apr 17 23:00:21 2013] [debug] ssl_engine_kernel.c(1874): OpenSSL: Loop: 
before/accept initialization
[Wed Apr 17 23:00:21 2013] [info] [client ::1] Connection to child 6 
established (server www2.olka.fi:443)
[Wed Apr 17 23:00:21 2013] [info] Seeding PRNG with 648 bytes of entropy
[Wed Apr 17 23:00:21 2013] [debug] ssl_engine_kernel.c(1866): OpenSSL: 
Handshake: start
[Wed Apr 17 23:00:21 2013] [debug] ssl_engine_kernel.c(1874): OpenSSL: Loop: 
before/accept initialization
[Wed Apr 17 23:00:21 2013] [debug] ssl_engine_io.c(1882): OpenSSL: read 11/11 
bytes from BIO#b8fa9da8 [mem: b9012658] (BIO dump follows)
[Wed Apr 17 23:00:21 2013] [debug] ssl_engine_io.c(1815): 
+-+
[Wed Apr 17 23:00:21 2013] [debug] ssl_engine_io.c(1854): | : 4f 50 54 49 
4f 4e 53 20-2a 20 48 OPTIONS * H  |
[Wed Apr 17 23:00:21 2013] [debug] ssl_engine_io.c(1860): 
+-+
[Wed Apr 17 23:00:21 2013] [debug] ssl_engine_kernel.c(1903): OpenSSL: Exit: 
error in SSLv2/v3 read client hello A
[Wed Apr 17 23:00:21 2013] [info] [client ::1] Connection to child 7 
established (server www2.olka.fi:443)
[Wed Apr 17 23:00:21 2013] [info] Seeding PRNG with 648 bytes of entropy
[Wed Apr 17 23:00:21 2013] [debug] ssl_engine_kernel.c(1866): OpenSSL: 
Handshake: start
[Wed Apr 17 23:00:21 2013] [debug] ssl_engine_kernel.c(1874): OpenSSL: Loop: 
before/accept initialization
[Wed Apr 17 23:00:21 2013] [debug] ssl_engine_io.c(1882): OpenSSL: read 11/11 
bytes from BIO#b8fa9da8 [mem: b9012658] (BIO dump follows)
[Wed Apr 17 23:00:21 2013] [debug] ssl_engine_io.c(1815): 
+-+
[Wed Apr 17 23:00:21 2013] [debug] ssl_engine_io.c(1854): | : 4f 50 54 49 
4f 4e 53 20-2a 20 48 OPTIONS * H  |
[Wed Apr 17 23:00:21 2013] [debug] ssl_engine_io.c(1860): 
+-+
[Wed Apr 17 23:00:21 2013] [debug] ssl_engine_kernel.c(1903): OpenSSL: Exit: 
error in SSLv2/v3 read client hello A
[Wed Apr 17 23:00:21 2013] [info] [client ::1] SSL library error 1 in handshake 
(server www2.olka.fi:443)
[Wed Apr 17 23:00:21 2013] [info] SSL Library Error: 336027900 
error:140760FC:SSL routines:SSL23_GET_CLIENT_HELLO:unknown protocol speaking 
not SSL to HTTPS port!?
[Wed Apr 17 23:00:21 2013] [info] [client ::1] Connection closed to child 7 
with abortive shutdown (server www2.olka.fi:443)
[Wed Apr 17 23:00:21 2013] [info] mod_wsgi (pid=26865): Destroying interpreters.
[Wed Apr 17 23:00:21 2013] [info] mod_wsgi (pid=26865): Cleanup interpreter ''.
[Wed Apr 17 23:00:21 2013] [info] [client ::1] Connection to child 5 
established (server www2.olka.fi:443)
[Wed Apr 17 23:00:21 2013] [info] Seeding PRNG with 648 bytes of entropy
[Wed Apr 17 23:00:21 2013] [debug] ssl_engine_kernel.c(1866): OpenSSL: 
Handshake: start
[Wed Apr 17 23:00:21 2013] [debug] ssl_engine_kernel.c(1874): OpenSSL: Loop: 
before/accept initialization
[Wed Apr 17 23:00:21 2013] [debug] ssl_engine_io.c(1882): OpenSSL: read 11/11 
bytes from BIO#b8fa9da8 [mem: 

[web2py] web2py with SSL is not starting

2013-04-17 Thread Marko Poutiainen
I can't seem to get HTTPS connection to start so that I could use the admin 
panel. I have been trying various things but nothing seems to work. Host 
name is www2.olka.fi and it works through HTTP. 

I do get

Reloading web server config: apache2apache2: Could not reliably determine 
the server's fully qualified domain name, using www2.olka.fi for ServerName
[Wed Apr 17 23:00:21 2013] [warn] NameVirtualHost *:80 has no VirtualHosts
.

When I reload apache.

I also attached the output in error.log after the restart. It looks like 
trying to load the page adds nothing there. There are lots of suspicious 
stuff in that log, IMO, but I have no idea whether they really are 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.


[Wed Apr 17 23:00:21 2013] [notice] Graceful restart requested, doing restart
[Wed Apr 17 23:00:21 2013] [info] mod_wsgi (pid=26906): Destroying interpreters.
[Wed Apr 17 23:00:21 2013] [info] mod_wsgi (pid=26906): Cleanup interpreter ''.
[Wed Apr 17 23:00:21 2013] [info] mod_wsgi (pid=26861): Shutdown requested 'web2
py'.
[Wed Apr 17 23:00:21 2013] [info] mod_wsgi (pid=26861): Stopping process 'web2py
'.
[Wed Apr 17 23:00:21 2013] [info] mod_wsgi (pid=26861): Destroying interpreters.
[Wed Apr 17 23:00:21 2013] [info] mod_wsgi (pid=26861): Destroy interpreter 'www
2.olka.fi|'.
[Wed Apr 17 23:00:21 2013] [info] [client ::1] Connection to child 8 
established (server www2.olka.fi:443)
[Wed Apr 17 23:00:21 2013] [info] Seeding PRNG with 648 bytes of entropy
[Wed Apr 17 23:00:21 2013] [debug] ssl_engine_kernel.c(1866): OpenSSL: 
Handshake: start
[Wed Apr 17 23:00:21 2013] [debug] ssl_engine_kernel.c(1874): OpenSSL: Loop: 
before/accept initialization
[Wed Apr 17 23:00:21 2013] [info] [client ::1] Connection to child 6 
established (server www2.olka.fi:443)
[Wed Apr 17 23:00:21 2013] [info] Seeding PRNG with 648 bytes of entropy
[Wed Apr 17 23:00:21 2013] [debug] ssl_engine_kernel.c(1866): OpenSSL: 
Handshake: start
[Wed Apr 17 23:00:21 2013] [debug] ssl_engine_kernel.c(1874): OpenSSL: Loop: 
before/accept initialization
[Wed Apr 17 23:00:21 2013] [debug] ssl_engine_io.c(1882): OpenSSL: read 11/11 
bytes from BIO#b8fa9da8 [mem: b9012658] (BIO dump follows)
[Wed Apr 17 23:00:21 2013] [debug] ssl_engine_io.c(1815): 
+-+
[Wed Apr 17 23:00:21 2013] [debug] ssl_engine_io.c(1854): | : 4f 50 54 49 
4f 4e 53 20-2a 20 48 OPTIONS * H  |
[Wed Apr 17 23:00:21 2013] [debug] ssl_engine_io.c(1860): 
+-+
[Wed Apr 17 23:00:21 2013] [debug] ssl_engine_kernel.c(1903): OpenSSL: Exit: 
error in SSLv2/v3 read client hello A
[Wed Apr 17 23:00:21 2013] [info] [client ::1] Connection to child 7 
established (server www2.olka.fi:443)
[Wed Apr 17 23:00:21 2013] [info] Seeding PRNG with 648 bytes of entropy
[Wed Apr 17 23:00:21 2013] [debug] ssl_engine_kernel.c(1866): OpenSSL: 
Handshake: start
[Wed Apr 17 23:00:21 2013] [debug] ssl_engine_kernel.c(1874): OpenSSL: Loop: 
before/accept initialization
[Wed Apr 17 23:00:21 2013] [debug] ssl_engine_io.c(1882): OpenSSL: read 11/11 
bytes from BIO#b8fa9da8 [mem: b9012658] (BIO dump follows)
[Wed Apr 17 23:00:21 2013] [debug] ssl_engine_io.c(1815): 
+-+
[Wed Apr 17 23:00:21 2013] [debug] ssl_engine_io.c(1854): | : 4f 50 54 49 
4f 4e 53 20-2a 20 48 OPTIONS * H  |
[Wed Apr 17 23:00:21 2013] [debug] ssl_engine_io.c(1860): 
+-+
[Wed Apr 17 23:00:21 2013] [debug] ssl_engine_kernel.c(1903): OpenSSL: Exit: 
error in SSLv2/v3 read client hello A
[Wed Apr 17 23:00:21 2013] [info] [client ::1] SSL library error 1 in handshake 
(server www2.olka.fi:443)
[Wed Apr 17 23:00:21 2013] [info] SSL Library Error: 336027900 
error:140760FC:SSL routines:SSL23_GET_CLIENT_HELLO:unknown protocol speaking 
not SSL to HTTPS port!?
[Wed Apr 17 23:00:21 2013] [info] [client ::1] Connection closed to child 7 
with abortive shutdown (server www2.olka.fi:443)
[Wed Apr 17 23:00:21 2013] [info] mod_wsgi (pid=26865): Destroying interpreters.
[Wed Apr 17 23:00:21 2013] [info] mod_wsgi (pid=26865): Cleanup interpreter ''.
[Wed Apr 17 23:00:21 2013] [info] [client ::1] Connection to child 5 
established (server www2.olka.fi:443)
[Wed Apr 17 23:00:21 2013] [info] Seeding PRNG with 648 bytes of entropy
[Wed Apr 17 23:00:21 2013] [debug] ssl_engine_kernel.c(1866): OpenSSL: 
Handshake: start
[Wed Apr 17 23:00:21 2013] [debug] ssl_engine_kernel.c(1874): OpenSSL: Loop: 
before/accept initialization
[Wed Apr 17 23:00:21 2013] [debug] 

[web2py] Re: Install in hostgator

2013-04-17 Thread Diogo Munaro
Thx man! You help me a lot!!

Em sábado, 14 de maio de 2011 01h21min13s UTC-3, José Eloy escreveu:

 Hello! 

 Recently a customer bought a hosting plan (business) with hostgator. 
 I'm developing for him a web2py application, I have doubts of how to 
 deploy it. Somebody can help me? The application runs well in 
 localhost (ubuntu). 

 Thanks in advance 



-- 

--- 
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 with SSL is not starting

2013-04-17 Thread Massimo Di Pierro
More than the log we need to see the apache config file. Do you have a lsef 
signed certificate? Do you have a virtual host for post 443? Are you using 
the same domain as in the certificate?

On Wednesday, 17 April 2013 15:05:29 UTC-5, Marko Poutiainen wrote:

 I can't seem to get HTTPS connection to start so that I could use the 
 admin panel. I have been trying various things but nothing seems to work. 
 Host name is www2.olka.fi and it works through HTTP. 

 I do get

 Reloading web server config: apache2apache2: Could not reliably determine 
 the server's fully qualified domain name, using www2.olka.fi for 
 ServerName
 [Wed Apr 17 23:00:21 2013] [warn] NameVirtualHost *:80 has no VirtualHosts
 .

 When I reload apache.

 I also attached the output in error.log after the restart. It looks like 
 trying to load the page adds nothing there. There are lots of suspicious 
 stuff in that log, IMO, but I have no idea whether they really are 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: list:string type field output format

2013-04-17 Thread 黄祥
thank you so much for your hints niphlod and anthony, i've tried both of 
your hints, but the result is not what i'm expected (no error occured)
{{=SPAN(T('Email : '), XML(', '.join([A(email, _title=T('Send Email'), 
_target='_blank',
   _href='mailto:%s' % email).xml() for email in row.email])), 
_id='email_%s' % i)}}

{{=SPAN(T('Email : '), CAT([A(email, _title=T('Send Email'), 
_target='_blank',
   _href='mailto:%s' % email) for email in row.email]), _id='email_%s' 
% i)}}

the result in inspect elements :
a href=mailto:a...@a.com, b...@b.com target=_blank title=Send 
Emaila...@a.com, b...@b.com/a

my expectation is
a href=mailto:a...@a.com; target=_blank title=Send Emaila...@a.com/a
, 
a href=mailto:b...@b.com; target=_blank title=Send Emailb...@b.com/a

any idea how to accomplish it?
thank you so much in advance

-- 

--- 
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: REF: Component + Javascript

2013-04-17 Thread Teddy Nyambe
The button has a href=#mymodal calling a modal window. What I want is to
pass an ID to the modal window. I have a LOAD() in the modal window. so in
essence the situation is i have a grid listing with each row a button, then
click a button calls a modal window which has a div
id=mp_xx{{=LOAD('c','a', args='x')}}/div. Now when a user clicks on
the button i want to change the contents of the div using
jQuery('#id_xx').html({{=LOAD('c','a', args=var)}}). Maybe there is
another way of doing this??? Please advise.


On Wed, Apr 17, 2013 at 2:18 PM, Niphlod niph...@gmail.com wrote:

 are you sure that the button has not yet an event attached that prevents
 your custom one ?


 On Wednesday, April 17, 2013 12:15:03 PM UTC+2, software.ted wrote:

 I have a component am loading in a div
 div id=test/div
 {{=A('Link to comp', component=URL('research', 'mycomponent.load'),
 target='setting-content')}}

 div class=span8 id=setting-content

  /div

 in this same view page i have a javascript

 script type=text/javascript
   jQuery('#mp_257').click(**function(){
 jQuery('#test').html('Test')
 //alert(Test)
   })
 /script

 The component has a button with an id=mp_257, but when i click on it,
 jQuery in the view above is not being executed by replacing the Text in
 the div...the component has a grid with a custom button created as follows:

 links = [lambda row: A(SPAN(_class='icon-pencil'), 'Personal Details',
 _id = 'mp_257', _class='btn')]

 Anything why this is not working? But when I put the button in the view
 using:

 {{=A(SPAN(_class='icon-pencil'**), 'Personal Details', _id = 'mp_257',
 _class='btn')}}

 All works fine, is there something about loaded component that prevents
 running of javascript in the same page?

 --
 ..**..**
 ...
 Teddy Lubasi Nyambe
 Opensource Zambia
 Lusaka, ZAMBIA

 Cell: +260 97 7760473
 website: http://www.opensource.org.zm

 ~/
 Human Knowledge belongs to the world! - AntiTrust

 Man is a tool-using animal. Without tools he is nothing, with tools he is
 all - Thomas Carlyle 1795-1881

 /~

  --

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






-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 

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