Re: [web2py] Re: Web2py 2.3.2 broke JSONRPC

2013-03-02 Thread Phyo Arkar
Things changes quite fast lol :D

On Sat, Mar 2, 2013 at 3:48 AM, Michele Comitini michele.comit...@gmail.com
 wrote:

 http://www.jsonrpc.org/specification

 not draft anymore...

 mic

 2013/3/1 Phyo Arkar phyo.arkarl...@gmail.com:
  I c , JSONRPC2 is still in draft right?
  we are not using JSONRPC2 yet so that gave us problem.
 
 
  On Sat, Mar 2, 2013 at 2:12 AM, Niphlod niph...@gmail.com wrote:
 
  yep, to support keyword arguments. It was an oversight of jsonrpc 1 vs 2
  specs.
 
  trunk has it fixed, along with specific 1 vs 2 support (i.e. jsonrpc
 and
  jsonrpc2 decorators)
 
 
  On Friday, March 1, 2013 8:00:30 PM UTC+1, Phyo Arkar wrote:
 
  Any reason there for ** ?
 
  On Sat, Mar 2, 2013 at 12:40 AM, Phyo Arkar phyo.ar...@gmail.com
 wrote:
 
  The bug is at:
 
  gluon/tools.py
 
  s = methods[method](**params)
 
  it should be
  s = methods[method](*params)
 
 
  On Sat, Mar 2, 2013 at 12:16 AM, Phyo Arkar phyo.ar...@gmail.com
  wrote:
 
  We got a problem when we upgrade to 2.3.2 in JSONRPC called via
  qooxdoo.
 
  TypeError: testlogin() argument after ** must be a mapping, not
 list,
  JSONRPCError
 
 
  Which worked fine in 2.2.1
 
 
 
  Below is code for controller :
 
 
 
 
 
 
 
  @service.jsonrpc
  def testlogin(username, password):
  status = 0
  authed = auth.login_bare(str(username), str(password))
 
 
 
 
 
  if authed:
  status = 1
  return dict(status=status)
 
 
 
 
 
 
 
 
 
 
 
 
 
  JSONRPC request code is :
 
  jsonrpc_login.callAsync(handler_login,
 
 
 
 
 
   testlogin,
   textbox_username.getValue(),
   textbox_password.getValue());
 
 
 
 
 
 
 
 
  Full JS Code (qooxdoo) :
 
  qx.Class.define(logintest.login, {
  extend: qx.ui.container.Composite,
 
 
 
 
 
 
  construct : function() {
  this.base(arguments);
  this.setLayout(new qx.ui.layout.VBox());
  var center_hbox = new qx.ui.container.Composite(new
  qx.ui.layout.HBox());
 
 
 
 
 
 
  var loginform = new qx.ui.form.Form();
  var textbox_username = new qx.ui.form.TextField();
  var textbox_password = new qx.ui.form.PasswordField();
 
 
 
 
 
  var button_login = new qx.ui.form.Button(Login,
  logintest/test.png);
 
  loginform.add(textbox_username, User Name);
  loginform.add(textbox_password, Password);
 
 
 
 
 
  loginform.addButton(button_login);
 
  var jsonrpc_login = new
  qx.io.remote.Rpc(/auth_test/default/call/jsonrpc);
 
  center_hbox.add(new qx.ui.core.Spacer(), {flex: 1});
 
 
 
 
 
  center_hbox.add(new qx.ui.form.renderer.Single(loginform));
  center_hbox.add(new qx.ui.core.Spacer(), {flex: 1});
 
  this.add(new qx.ui.core.Spacer(), {flex: 1});
 
 
 
 
 
  this.add(center_hbox);
  this.add(new qx.ui.core.Spacer(), {flex: 1});
 
  var handler_login = function(result, ex, id)
  {
  if (ex == null)
 
 
 
 
 
  {
  alert(result.status);
  } else {
  console.log(=Err=);
  console.log(ex);
  }
 
 
 
 
 
  };
 
  button_login.addListener(execute, function(e) {
 jsonrpc_login.callAsync(handler_login,
   testlogin,
 
 
 
 
 
   textbox_username.getValue(),
   textbox_password.getValue());
  });
  },
 
 
 
 
 
 
  members : {
 
  }
  });
 
 
 
 
 
 
 
 
 
 
  --
 
  ---
  You received this message because you are 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.




-- 

--- 
You received this message because you are 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] RESTful vs JSONRPC

2013-03-02 Thread Phyo Arkar
From what it seems, RESTFUL seems a bit more complex vs JSONRPC.

What are the advantages for using REST, when using full AJAX Framework like
qooxdoo?

-- 

--- 
You received this message because you are 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: Issue with store() method on GAE

2013-03-02 Thread montgomery . global
Sorry if that didn't make sense, let me try again.

I have small (  100 kb) audio files that I am getting on the fly via the 
gluon.tools.fetch method from a third party API. I want to insert them into 
the uploads folder and create entries for them in the database (as if they 
were data uploaded by users). I have been doing this via the store() method 
and have had no problems during development.  On GAE, however, this is not 
working.  Specifically, it is throwing a runtime error you must specify a 
Field(...,uploadfolder=...).  My questions are as follows:

1) When using the store() method on GAE, what should the 'path' argument be?

2) Since this problem appears when using the store() method to save uploads 
to the database on GAE, but not when uploading files using SQLform, it 
seems to be a glitch.  Is this the case, or am I missing something obvious?

Thanks again for the help.

On Saturday, March 2, 2013 10:15:12 AM UTC+8, Massimo Di Pierro wrote:

 What do you mean? 

 On Friday, 1 March 2013 09:54:22 UTC-6, montgome...@gmail.com wrote:

 I just discovered that the insert works with the SQLform, but not 
 manually.  Any idea why that would be?  

 On Friday, March 1, 2013 12:35:08 PM UTC+8, montgome...@gmail.com wrote:

 So my app is getting some small audio files via the gluon.tools fetch 
 method, and then storing them manually in the upload folder via the store() 
 method. While this works fine on a local server, it doesn't seem to work on 
 GAE.  It's throwing a runtime error: you must specify a 
 Field(...,uploadfolder=...).  Looking at the DAL gluon, this seems to 
 imply that there is no path specified for the upload folder, even though 
 that should be a default argument for Field() regardless of backend.   
 Anyone have any ideas why?

 Here is the code:

 audio_file = StringIO.StringIO(fetch(audio_url))
 self.classcont_id = current.db.classcont.insert(, quest_audio = 
 current.db.classcont.quest_audio.store(audio_file, self.audio_name) ,) 
 current.db.commit()

 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: Reference field to string field in a keyed table. MSSQL

2013-03-02 Thread DenesL
It seems that the original code for keyed tables was wrongly patched at 
some point in time.
That part of the code should read:

  ftype = ftype + \
  types['reference FK'] % dict(
  constraint_name = constraint_name,
  foreign_key = '%s (%s)' % (rtablename,
 rfieldname),
  field_name = field_name,
  on_delete_action=field.ondelete)


Denes.

On Saturday, March 2, 2013 12:11:03 AM UTC-5, Dmitry Mosin wrote:

 Hi

 There is another exception

 type 'exceptions.KeyError' 'field_name'*File 
 /var/www/py/web2py/gluon/dal.py in create_table at line 811*

 806.
 807.
 808.
 809.
 810.
 811.

 812.
 813.
 814.
 815.

 ftype = ftype + \
 types['reference FK'] % dict(
 constraint_name = constraint_name, # 
 should be quoted
 foreign_key = '%s (%s)' % (rtablename,
rfieldname),
 on_delete_action=field.ondelete)

 else:
 # make a guess here for circular references
 if referenced in db:
 id_fieldname = db[referenced]._id.name




-- 

--- 
You received this message because you are 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: RESTful vs JSONRPC

2013-03-02 Thread Niphlod
JSONRPC is a method to invoke functions that is standardized. REST is a 
standardized method to represent something.

Standards are constructed on different things: JSONRPC standardizes the 
transport method and the returned values, while REST standardizes how you 
should represent a given entity and how you should interact with the 
entity itself (not the format itself).

That being said, there's no standards on how to implement a particular 
functionality: REST is useful to interact with models, hence it's more 
geared towards representing your objects, and if your objects are db 
records, REST methods map very well to the usual CRUD operations. 

JSONRPC instead is more keen to map to the functional side of things: you 
need to code interactions with the model in your functions.  

That's why you can find largely on the internet both of them, but when the 
exposed API is something that needs to give access to a wide interlinked 
model the preferred method is REST, while if it exposes only features you 
find JSONRPC as the standard.

On Saturday, March 2, 2013 9:45:35 AM UTC+1, Phyo Arkar wrote:

 From what it seems, RESTFUL seems a bit more complex vs JSONRPC.

 What are the advantages for using REST, when using full 
 AJAX Framework like qooxdoo?




-- 

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




[web2py] Re: scheduler and workers

2013-03-02 Thread Niphlod
Nope, you can't start processes adding records to the workers table. You 
need to start workers the same way you did issuing web2py.py -K appname

On Saturday, March 2, 2013 8:19:39 AM UTC+1, mweissen wrote:

 I have started my application with 4 workers.
 But some workers have stopped (?) and now there is only one active worker.

 How can I add additionals workers without having to restart the 
 application? Is it sufficient to add some records to db.scheduler_worker? 
 Which values should I choose for the rows?

 Regards, Martin


-- 

--- 
You received this message because you are 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: RESTful vs JSONRPC

2013-03-02 Thread Alec Taylor
Can you expand a little on features?

Would be interested in a more concrete example of when to use JSONRPC over REST

On Sat, Mar 2, 2013 at 11:53 PM, Niphlod niph...@gmail.com wrote:
 JSONRPC is a method to invoke functions that is standardized. REST is a
 standardized method to represent something.

 Standards are constructed on different things: JSONRPC standardizes the
 transport method and the returned values, while REST standardizes how you
 should represent a given entity and how you should interact with the
 entity itself (not the format itself).

 That being said, there's no standards on how to implement a particular
 functionality: REST is useful to interact with models, hence it's more
 geared towards representing your objects, and if your objects are db
 records, REST methods map very well to the usual CRUD operations.

 JSONRPC instead is more keen to map to the functional side of things: you
 need to code interactions with the model in your functions.

 That's why you can find largely on the internet both of them, but when the
 exposed API is something that needs to give access to a wide interlinked
 model the preferred method is REST, while if it exposes only features you
 find JSONRPC as the standard.


 On Saturday, March 2, 2013 9:45:35 AM UTC+1, Phyo Arkar wrote:

 From what it seems, RESTFUL seems a bit more complex vs JSONRPC.

 What are the advantages for using REST, when using full AJAX Framework
 like qooxdoo?


 --

 ---
 You received this message because you are 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: Creating a basic website with a html layout.

2013-03-02 Thread Niphlod
with the scaffolding app, it's as easy as replacing the standard index 
function with yours and use

return dict(quote=quotes[day])

at the bottom of it instead of  your

return quotes[day]

On Saturday, March 2, 2013 1:26:50 AM UTC+1, Erik Clinger wrote:

 I'm a self taught high school students trying to make a quote of the day 
 website. 
 Essentially what I'm trying to do is assign the day of the month equal to 
 a quote that I have selected. The code runs just fine. I'll post it on the 
 bottom.
 Anyway, the disconnect that I'm getting is inputting the application that 
 I have written in Python to the a html template. I know that you need to 
 have a controller, view and model files all to display the application 
 correctly. I have absolutely no idea how to do this.

 Thank you so much for your time.

 Code: 

 from datetime import date


 def index():
 quotes = {1: We can't help everyone, but everyone can help. -President 
 Ronald W. Reagan,
   2: There are no problems we cannot solve together, and very 
 few that we can solve by ourselves. -President Lyndon B. Johnson,
   3: A people that values its privileges above its principles 
 soon loses both. -President Dwight D. Eisenhower,
   4: Defeat doesn't finish a man, quit does. A man is not 
 finished when he's defeated. He's finished when he quits. -President Richard 
 M. Nixon,
   5: Change will not come if we wait for some other person or 
 some other time. We are the ones we've been waiting for. We are the change 
 that we seek. -President Barack H. Obama,
   6: If you live long enough, you'll make mistakes. But if you 
 learn from them, you'll be a better person. It's how you handle adversity, 
 not how it affects you. The main thing is never quit, never quit, never quit. 
 -President William J. Clinton,
   7: One man with courage makes a majority. -President Andrew 
 Jackson,
   8: Happiness lies in the joy of achievement and the thrill of 
 creative effort. -President Franklin D. Roosevelt,
   9: Do not pray for easy lives. Pray to be stronger men. 
 -President John F. Kennedy,
   10: When you get to the end of your rope, tie a knot and hang 
 on. -President Thomas Jefferson,
   11: It is amazing what you can accomplish if you do not care 
 who gets the credit. -President Harry S. Truman,
   12: Believe you can and you're halfway there. -President Theodore 
 Roosevelt,
   13: Happiness and moral duty are inseparably connected. -President 
 George Washington,
   14: I have a different vision of leadership. A leadership is 
 someone who brings people together. -President George W. Bush,
   15: It is better to be defeated standing for a high principle than 
 to run by committing subterfuge. -President S. Grover Cleaveland,
   16: You can do what you have to do, and sometimes you can do it 
 even better than you think you can. -President E. Jimmy Carter,
   17: The only use of an obstacle is to be overcome. All that an 
 obstacle does with brave men is, not to frighten them, but to challenge them. 
 -President T. Woodrow Wilson,
   18: Patience and perseverance have a magical effect before which 
 difficulties disappear and obstacles vanish. -President John Quincy Adams,
   19: The test of leadership is not to put greatness into humanity, 
 but to elicit it, for the greatness is already there. -President James 
 Buchanan,
   20: Nothing in this world can take the place of persistence. 
 Talent will not; nothing is more common than unsuccessful people with talent. 
 Genius will not; unrewarded genius is almost a proverb. Education will not; 
 the world is full of educated failures. Persistence and determination alone 
 are omnipotent. -President J. Calvin Coolidge,
   21: History and experience tell us that moral progress comes not 
 in comfortable and complacent times, but out of trial and confusion. 
 -President Gerald R. Ford,
   22: Right reason is stronger than force. -President James A. 
 Garfield,
   23: The bud of victory is always in the truth. -President Benjamin 
 Harrison,
   24: For honest merit to succeed amid the tricks and intrigues 
 which are now so lamentably common, I know is difficult; but the honor of 
 success is increased by the obstacles which are to be surmounted. Let me 
 triumph as a man or not at all. -President Rutherford B. Hayes,
   25: Peace is not made at the council table or by treaties, but in 
 the hearts of men. -President Herbert C. Hoover,
   26: Let us tenderly and kindly cherish, therefore, the means of 
 knowledge. Let us dare to read, think, speak, and write. -President John 
 Adams,
   27: Character is like a tree and reputation like a shadow. The 
 shadow is what we think of it; the tree is the real thing. -President Abraham 
 Lincoln,
   28: 

[web2py] Re: login by ajax

2013-03-02 Thread Niphlod
The data is transmitted on the wire in the same exact manner via an ajax 
POST or the usual POST. The only security needed is SSL, for both, if you 
don't want to pass credentials in clear format.

On Saturday, March 2, 2013 12:24:44 AM UTC+1, Alan Etkin wrote:

 +1 for auth,ajax_login()


 I'm also interested in a bare ajax login feature, but, what about the 
 security risks of passing credentials with javascript in the background? 
 What are the issues to take in account for that feature? I there any 
 standard way of securing the passwords and other sensible data that can be 
 used?


-- 

--- 
You received this message because you are 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: RESTful vs JSONRPC

2013-03-02 Thread Niphlod
it's merely a question about angles

suppose you want to give access only to one table, e.g., products. only 
search by name and return just the quantity in stock in addition to the 
name.

with jsonrpc you need to code a function that searches through your 
products and returns a list of tuples (or a dictionary) holding name, 
stock values.

Now, suppose you want to add the possibility to order a product, or 
multiple ones.

again, with jsonrpc you need to code a function that searches through your 
products and returns a list of tuples holding name, ordered_qty values.

Now, suppose you want to give the ability to search through product tags, 
and order products

you need to come up with a representation of your model, code a function 
that searches through tags, links them through products, and then again 
return the result.

In all of this, you need to figure out a result that carries all the info 
needed for an API to be used (such as, e.g., returning tags in the 1st 
function anyway if they are handy, etc etc etc). 

When you add more and more functionality, or features, you need to be 
consistent in what you return, else your API becomes more and more bloated 
and patched and disconnetted from piece to piece. JSONRPC doesn't define 
the state of your products, unless you come up with that. You have to tell 
your users that order_product method returns name, ordered_qty , come up 
with an error when they can't order something, tell them that a product can 
be searched also by tags with the search_by_tag method, etc etc etc.

At any given point in time, clients need to know what feature you expose 
and what to expect back.

On the other side, REST uses urls, response codes http verbs (HEAD, GET, 
POST, PUT, DELETE) and headers to describe both your returned format and 
your model. They know when an operation change something, if they can cache 
the result, etc etc. 

In richer and standards conformant APIs you get back with the results also 
links to access connected resources (i.e. the details about the tag of the 
product). Clients can ask xml or json just changing headers, and generally 
must be informed of your model only  they know already (if your API is 
totally REST certified) that they should use x to achieve y. 

tl;dr: In general, a REST API feels more open but yes, more complicated 
because it involves several base concepts on how the web works. 
JSONRPC on the other end feels more explicit. JSONRPC in an APIs exposes 
more how to work with while REST what to work with.

So, suppose you want to expose an api to access your online store I'd 
go for REST hands down. 
You need instead to expose a service that returns the avatar picture 
location given an email ? JSONRPC. 
You need to expose a service that crops pictures sent by users ? . 
neither (binary formats don't play well with both JSONRPC or REST)
You don't need a service but some means of communication by a server 
written by you and a client that only you use ? JSONRPC will be more 
productive in a short term and if you have all the detailed implementation 
planned, but on the long run REST may be more appropriate.

-- 

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




Re: [web2py] web2py.com moved to PythonAnywhere.com

2013-03-02 Thread Michele Comitini
http://web2py.com/book - invalid request

2013/3/2 Massimo Di Pierro massimo.dipie...@gmail.com:
 Yesterday we moved web2py.com to PythonAnywhere.com hosting.

 Everything should work well. If you experience any problem please report it
 here.

 PythonAnywhere is a fantastic platform for web2py hosting and moving there
 was very simple and painless. The process is now documented in the book. The
 entire build process is now also hosted there. We had fantastic support from
 the PythonAnywhere team. I strongly recommend it.

 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.



-- 

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




Re: [web2py] Re: web2py is moving

2013-03-02 Thread Manuele Pesenti

Il 02/03/13 03:32, Massimo Di Pierro ha scritto:
It is back online. Sorry for the disruption but yesterday we moved to 
PythonAnywhere and routes broke.

it looks off line again now...


 invalid request


M.


--

--- 
You received this message because you are 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: RESTful vs JSONRPC

2013-03-02 Thread Phyo Arkar
Thank you very much for very detailed explanation niphlod. Amazing.

For me , JSONRPC is more useful in current projects (which do not need CURD
, just Update and Read is mostly done ).

For my case it is mostly Machine learning , parsing files , indexing ,
producing Network diagrams , etc.
so that fit this cases :

 You don't need a service but some means of communication by a server
 written by you and a client that only you use ?


I will stick with JSONRPC.
On Sat, Mar 2, 2013 at 8:02 PM, Niphlod niph...@gmail.com wrote:

 it's merely a question about angles

 suppose you want to give access only to one table, e.g., products. only
 search by name and return just the quantity in stock in addition to the
 name.

 with jsonrpc you need to code a function that searches through your
 products and returns a list of tuples (or a dictionary) holding name,
 stock values.

 Now, suppose you want to add the possibility to order a product, or
 multiple ones.

 again, with jsonrpc you need to code a function that searches through your
 products and returns a list of tuples holding name, ordered_qty values.

 Now, suppose you want to give the ability to search through product tags,
 and order products

 you need to come up with a representation of your model, code a function
 that searches through tags, links them through products, and then again
 return the result.

 In all of this, you need to figure out a result that carries all the info
 needed for an API to be used (such as, e.g., returning tags in the 1st
 function anyway if they are handy, etc etc etc).

 When you add more and more functionality, or features, you need to be
 consistent in what you return, else your API becomes more and more bloated
 and patched and disconnetted from piece to piece. JSONRPC doesn't define
 the state of your products, unless you come up with that. You have to tell
 your users that order_product method returns name, ordered_qty , come up
 with an error when they can't order something, tell them that a product can
 be searched also by tags with the search_by_tag method, etc etc etc.

 At any given point in time, clients need to know what feature you expose
 and what to expect back.

 On the other side, REST uses urls, response codes http verbs (HEAD, GET,
 POST, PUT, DELETE) and headers to describe both your returned format and
 your model. They know when an operation change something, if they can cache
 the result, etc etc.

 In richer and standards conformant APIs you get back with the results also
 links to access connected resources (i.e. the details about the tag of the
 product). Clients can ask xml or json just changing headers, and generally
 must be informed of your model only  they know already (if your API is
 totally REST certified) that they should use x to achieve y.

 tl;dr: In general, a REST API feels more open but yes, more complicated
 because it involves several base concepts on how the web works.
 JSONRPC on the other end feels more explicit. JSONRPC in an APIs exposes
 more how to work with while REST what to work with.

 So, suppose you want to expose an api to access your online store I'd
 go for REST hands down.
 You need instead to expose a service that returns the avatar picture
 location given an email ? JSONRPC.
 You need to expose a service that crops pictures sent by users ? .
 neither (binary formats don't play well with both JSONRPC or REST)
 You don't need a service but some means of communication by a server
 written by you and a client that only you use ? JSONRPC will be more
 productive in a short term and if you have all the detailed implementation
 planned, but on the long run REST may be more appropriate.

  --

 ---
 You received this message because you are 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: login by ajax

2013-03-02 Thread Phyo Arkar
If you worry about your credentials visibility over the wire , SSL.
If you worry about your credentials visibility on the screen , None
actually.

On Sat, Mar 2, 2013 at 5:54 AM, Alan Etkin spame...@gmail.com wrote:

 +1 for auth,ajax_login()


 I'm also interested in a bare ajax login feature, but, what about the
 security risks of passing credentials with javascript in the background?
 What are the issues to take in account for that feature? I there any
 standard way of securing the passwords and other sensible data that can be
 used?

 --

 ---
 You received this message because you are 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: Issue with store() method on GAE

2013-03-02 Thread Massimo Di Pierro
Now I understand. Thanks for the clarification. I think there is a bug in 
store on GAE. There is already an open ticket about this. Will take a look 
asap.

On Saturday, 2 March 2013 05:21:34 UTC-6, montgome...@gmail.com wrote:

 Sorry if that didn't make sense, let me try again.

 I have small (  100 kb) audio files that I am getting on the fly via the 
 gluon.tools.fetch method from a third party API. I want to insert them into 
 the uploads folder and create entries for them in the database (as if they 
 were data uploaded by users). I have been doing this via the store() method 
 and have had no problems during development.  On GAE, however, this is not 
 working.  Specifically, it is throwing a runtime error you must specify a 
 Field(...,uploadfolder=...).  My questions are as follows:

 1) When using the store() method on GAE, what should the 'path' argument 
 be?

 2) Since this problem appears when using the store() method to save 
 uploads to the database on GAE, but not when uploading files using SQLform, 
 it seems to be a glitch.  Is this the case, or am I missing something 
 obvious?

 Thanks again for the help.

 On Saturday, March 2, 2013 10:15:12 AM UTC+8, Massimo Di Pierro wrote:

 What do you mean? 

 On Friday, 1 March 2013 09:54:22 UTC-6, montgome...@gmail.com wrote:

 I just discovered that the insert works with the SQLform, but not 
 manually.  Any idea why that would be?  

 On Friday, March 1, 2013 12:35:08 PM UTC+8, montgome...@gmail.com wrote:

 So my app is getting some small audio files via the gluon.tools fetch 
 method, and then storing them manually in the upload folder via the 
 store() 
 method. While this works fine on a local server, it doesn't seem to work 
 on 
 GAE.  It's throwing a runtime error: you must specify a 
 Field(...,uploadfolder=...).  Looking at the DAL gluon, this seems to 
 imply that there is no path specified for the upload folder, even though 
 that should be a default argument for Field() regardless of backend.   
 Anyone have any ideas why?

 Here is the code:

 audio_file = StringIO.StringIO(fetch(audio_url))
 self.classcont_id = current.db.classcont.insert(, quest_audio = 
 current.db.classcont.quest_audio.store(audio_file, self.audio_name) ,) 
 current.db.commit()

 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: Reference field to string field in a keyed table. MSSQL

2013-03-02 Thread Massimo Di Pierro
Fixed. please check it. Thanks Denes.

On Saturday, 2 March 2013 06:12:31 UTC-6, DenesL wrote:

 It seems that the original code for keyed tables was wrongly patched at 
 some point in time.
 That part of the code should read:

   ftype = ftype + \
   types['reference FK'] % dict(
   constraint_name = constraint_name,
   foreign_key = '%s (%s)' % (rtablename,
  rfieldname),
   table_name = table_name,
   field_name = field_name,
   on_delete_action=field.ondelete)


 Denes.

 On Saturday, March 2, 2013 12:11:03 AM UTC-5, Dmitry Mosin wrote:

 Hi

 There is another exception

 type 'exceptions.KeyError' 'field_name'*File 
 /var/www/py/web2py/gluon/dal.py in create_table at line 811*

 806.
 807.
 808.
 809.
 810.
 811.

 812.
 813.
 814.
 815.

 ftype = ftype + \
 types['reference FK'] % dict(
 constraint_name = constraint_name, # 
 should be quoted
 foreign_key = '%s (%s)' % (rtablename,
rfieldname),
 on_delete_action=field.ondelete)

 else:
 # make a guess here for circular references
 if referenced in db:
 id_fieldname = db[referenced]._id.name




-- 

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




Re: [web2py] web2py.com moved to PythonAnywhere.com

2013-03-02 Thread Massimo Di Pierro
I thought I fixed. I will try again. For now use:

web2py.com/books

On Saturday, 2 March 2013 08:24:48 UTC-6, Michele Comitini wrote:

 http://web2py.com/book - invalid request 

 2013/3/2 Massimo Di Pierro massimo@gmail.com javascript:: 
  Yesterday we moved web2py.com to PythonAnywhere.com hosting. 
  
  Everything should work well. If you experience any problem please report 
 it 
  here. 
  
  PythonAnywhere is a fantastic platform for web2py hosting and moving 
 there 
  was very simple and painless. The process is now documented in the book. 
 The 
  entire build process is now also hosted there. We had fantastic support 
 from 
  the PythonAnywhere team. I strongly recommend it. 
  
  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+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] web2py.com moved to PythonAnywhere.com

2013-03-02 Thread Vasile Ermicioi
web2py.com/books

doesn't work either

-- 

--- 
You received this message because you are 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] creating groups

2013-03-02 Thread sasogeek
I have an app where people can sign up and have profiles, but I don't know 
how permissions work, I've tried to read the book but I want a little bit 
more explanation...
What I want to do is allow users to create groups which they can name 
themselves. So that there's a link or button create a group and when they 
click it, they can name the group like say Friends and then they can add 
other users to that group and those groups will have some privileges like 
they'll be able to chat with each other, etc... and if i'm able to do that, 
how do i also allow them to set permissions for those groups they've 
created so that if chat for instance, you can only chat with someone if the 
person has you in a group, and has allowed the chat functionality with that 
group ?

-- 

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




Re: [web2py] Re: web2py is moving

2013-03-02 Thread Massimo Di Pierro
It is not down but we have some DNS issues.

www.web2py.com works fine
www.web2py.com/books works fine
www.web2py.com/book was not redirecting and now fixed
web2py.com worked yesterday but not today. Trying to find out why not 
redirecting.



On Saturday, 2 March 2013 08:29:46 UTC-6, Manuele wrote:

  Il 02/03/13 03:32, Massimo Di Pierro ha scritto:
  
 It is back online. Sorry for the disruption but yesterday we moved to 
 PythonAnywhere and routes broke.

 it looks off line again now...
 invalid request 


 M.
  
  

-- 

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




Re: [web2py] web2py.com moved to PythonAnywhere.com

2013-03-02 Thread Massimo Di Pierro
As I posted in another thread. there is a DNS issue. Use

www.web2py.com/book http://web2py.com/books

or

www.web2py.com/books

On Saturday, 2 March 2013 09:31:43 UTC-6, Vasile Ermicioi wrote:

 web2py.com/books

 doesn't work either


-- 

--- 
You received this message because you are 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: Reference field to string field in a keyed table. MSSQL

2013-03-02 Thread Dmitry Mosin
Hello, friends

Now it looks like

type 'exceptions.NameError' global name 'table_name' is not defined

806.
807.
808.
809.
810.
811.

812.
813.
814.
815.

ftype = ftype + \
types['reference FK'] % dict(
constraint_name = constraint_name, # should 
be quoted
foreign_key = '%s (%s)' % (rtablename,
   rfieldname),
table_name = table_name,

field_name = field_name,
on_delete_action=field.ondelete)
else:
# make a guess here for circular references



Thank you for you time


суббота, 2 марта 2013 г., 21:17:27 UTC+6 пользователь Massimo Di Pierro 
написал:

 Fixed. please check it. Thanks Denes.

 On Saturday, 2 March 2013 06:12:31 UTC-6, DenesL wrote:

 It seems that the original code for keyed tables was wrongly patched at 
 some point in time.
 That part of the code should read:

   ftype = ftype + \
   types['reference FK'] % dict(
   constraint_name = constraint_name,
   foreign_key = '%s (%s)' % (rtablename,
  rfieldname),
   table_name = table_name,
   field_name = field_name,
   on_delete_action=field.ondelete)


 Denes.

 On Saturday, March 2, 2013 12:11:03 AM UTC-5, Dmitry Mosin wrote:

 Hi

 There is another exception

 type 'exceptions.KeyError' 'field_name'*File 
 /var/www/py/web2py/gluon/dal.py in create_table at line 811*

 806.
 807.
 808.
 809.
 810.
 811.

 812.
 813.
 814.
 815.

 ftype = ftype + \
 types['reference FK'] % dict(
 constraint_name = constraint_name, # 
 should be quoted
 foreign_key = '%s (%s)' % (rtablename,
rfieldname),
 on_delete_action=field.ondelete)

 else:
 # make a guess here for circular references
 if referenced in db:
 id_fieldname = db[referenced]._id.name




-- 

--- 
You received this message because you are 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] changing validator of one field based on choice of another field

2013-03-02 Thread brushek
Hello,

I have a form (generated by FORM) in which I want to change validator if 
user checks diffrent radio button, it is somothing like this (pseudocode):

input field is named deg_or_rad

if radio1 checked:
 then deg_or_rad is checked against range (-4:4)
if radio2 checked:
 then de_or_rad is checked against range (-360:360)

Can I do this without using javascript ?

regards
brushek


-- 

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




Re: [web2py] Re: web2py is moving

2013-03-02 Thread LightDot
Well, web2py.com with and without www resolves from my location (EU). DNS 
query shows A records at dns1.vps.net and dns2.vps.net for both, pointing 
at the same IPs, etc..

I can also reach the web site at both addresses, the book app works for me 
now... So both DNS and VPS settings seem ok now.

I can do further tests if needed.

Regards,
Ales

On Saturday, March 2, 2013 4:38:28 PM UTC+1, Massimo Di Pierro wrote:

 It is not down but we have some DNS issues.

 www.web2py.com works fine
 www.web2py.com/books works fine
 www.web2py.com/book was not redirecting and now fixed
 web2py.com worked yesterday but not today. Trying to find out why not 
 redirecting.



 On Saturday, 2 March 2013 08:29:46 UTC-6, Manuele wrote:

  Il 02/03/13 03:32, Massimo Di Pierro ha scritto:
  
 It is back online. Sorry for the disruption but yesterday we moved to 
 PythonAnywhere and routes broke.

 it looks off line again now...
 invalid request 


 M.
  
  

-- 

--- 
You received this message because you are 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 a recursive select but encountered a broken reference

2013-03-02 Thread Marin Pranjić
This happened to an user multiple times. No idea why it happens.

Error ticket doesn't show much, this is everything I can get from there:

Traceback (most recent call last):
 File /home/www-data/web2py/gluon/main.py, line 571, in wsgibase
 session._try_store_in_cookie_or_file(request, response)
 File /home/www-data/web2py/gluon/globals.py, line 738, in 
_try_store_in_cookie_or_file
 self._try_store_in_file(request, response)
 File /home/www-data/web2py/gluon/globals.py, line 745, in _try_store_in_file
 if not response.session_id or self._forget or self._unchanged():
 File /home/www-data/web2py/gluon/globals.py, line 700, in _unchanged
 session_pickled = cPickle.dumps(dict(self))
 File /usr/lib/python2.7/copy_reg.py, line 74, in _reduce_ex
 getstate = self.__getstate__
 File /home/www-data/web2py/gluon/dal.py, line 7355, in __getattr__
 self.__allocate()
 File /home/www-data/web2py/gluon/dal.py, line 7350, in __allocate
 raise RuntimeError, Using a recursive select but encountered a broken 
reference: %s %d%(self._table, int(self))
RuntimeError: Using a recursive select but encountered a broken reference: 
auth_group 5



However, auth_group record with id=5 exists. I have no idea why it raises an 
error.

I'm using web2py 2.2.1, this is production instance so I can't test with other 
versions right now.


Marin

-- 

--- 
You received this message because you are 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] Creating a form using a for loop

2013-03-02 Thread Anthony Bond
I've been working with web2py for about two months now.  I've figured out 
how to do a lot of awesome things with it; however, the problem I'm having 
now has me stumped.

I'm working on an application that allows a user to submit a 
self-evaluation, based on criteria that the user will find on a page.  I 
have a table with 33 rows of of criteria.  The table contains a column 
which hosts the criteria, pre-formatted in HTML.  Each HTML section 
contains a table the gives the users the criteria for each of six levels - 
these individual tables are almost large enough to take up the entire 
content section of the webpage, so I've placed them all in a jQuery 
accordion.  Below each table, I've placed a drop down list, where the user 
can select what criteria they feel as though they've met.  I've added a 
small screenshot to show the look and feel I'm trying to achieve (and 
currently have).

The problem I'm having is getting the values of those drop down lists back 
from the database.  Currently, I iterate through the table containing the 
HTML using a for loop, tacking a drop down list at the end of each.  Right 
now, I'm unable to get the data back from the page.  Here is my code:

def Take_Eval(): 
user = db(db.Person.auth_userUserId == 
auth.user.id).select().first().PersonId
table = db(db.PageContent.ContentId  0).select()
submit = INPUT(_name='submit', _type='submit')
formlist = []

for row in table:
newForm = FORM(H2(row['ContentDescription'], _style=padding-left: 
10px;),
DIV(XML(row.ContentHTML), BR(), P(SELECT(OPTGROUP(OPTION('Does not 
Attempt', _value=0), OPTION('Developing', _value=1), OPTION('Progressing', 
_value=2), OPTION('Established', _value=3), OPTION('Advanced', _value=4), 
OPTION('Master', _value=5)), _id=row['QuestionNumber']), 
_style='text-align: center;')))
formlist.append(newForm)

for form in formlist:
if form.accepts(request, session):
   response.flash = 'Profile Saved Successfully on  ' + 
str(time.strftime(%Y-%m-%d %H:%M:%S, time.localtime()))
   #db.Evaluation.insert(PersonBeingEvaluated, PersonEvaluating, 
EvalDate ,1_1A ,1_1B ,1_2 ,1_3 ,1_4 , 1_5, 1_6, 2_1, 2_2A , 2_2B, 2_3A 
,2_3B ,2_4 ,2_5 ,3_1 , 3_2 , 3_3, 3_4, 3_5A, 3_5B, 3_6, 3_7, 3_8, 3_9A, 
3_9B, 3_9C, 4_1, 4_2, 4_3A, 4_3B, 4_4, BeliefsScore, CharacterScore)
   
   redirect(URL('default', 'index'))
elif form.errors:
   response.flash = 'Profile could not be submitted.  Please try 
again later. '

db.Evaluation.insert(PersonBeingEvaluated=user, PersonEvaluating=0, 
EvalDate=datetime.now(), 1_1A = formlist[0].vars.1_1A, 1_1B = 
formlist[1].vars.1_1B, 1_2 = formlist[2].vars.1_2, 1_3 = 
formlist[3].vars.1_3, 1_4 = formlist[4].vars.1_4, 1_5 = 
formlist[5].vars.1_5, 1_6 = formlist[6].vars.1_6, 2_1 = 
formlist[7].vars.2_1, 2_2A = formlist[8].vars.2_2A, 2_2B = 
formlist[9].vars.2_2B, 2_3A = formlist[10].vars.2_3A, 2_3B = 
formlist[11].vars.2_3B, 2_4 = formlist[12].vars.2_4, 2_5 = 
formlist[13].vars.2_5, 3_1 = formlist[14].vars.3_1, 3_2 = 
formlist[15].vars.3_2, 3_3 = formlist[16].vars.3_3, 3_4 = 
formlist[17].vars.3_4, 3_5A = formlist[18].vars.3_5A, 3_5B = 
formlist[19].vars.3_5B, 3_6 = formlist[20].vars.3_6, 3_7 = 
formlist[21].vars.3_7, 3_8 = formlist[22].vars.3_8, 3_9A = 
formlist[23].vars.3_9A, 3_9B = formlist[24].vars.3_9B, 3_9C = 
formlist[25].vars.3_9C, 4_1 = formlist[26].vars.4_1, 4_2 = 
formlist[27].vars.4_2, 4_3A = formlist[28].vars.4_3A, 4_3B = 
formlist[29].vars.4_3B, 4_4 = formlist[30].vars.4_4, BeliefsScore = 
formlist[31].vars.BeliefsScore, CharacterScore = 
formlist[32].vars.CharacterScore)
  
return locals()


The code is not letting me compile due to a syntax error on the area I've 
highlighted above.  I'm okay with not using a form, or a bunch of forms, as 
long as I can get the values from the drop down list back to the controller 
when the submit button is clicked.  I originally looped through the table 
in the view to make the display.  Each drop down has a unique name that I'd 
be able to access in the controller, but I haven't been able to figure out 
how to do that only after post back.  I appreciate any guidance that could 
be given.  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.


attachment: tesscreenshot.png

[web2py] Re: Using a recursive select but encountered a broken reference

2013-03-02 Thread Marin Pranjić
It seems that the problem is because I run two web2py instances.
One runs on domain.com and the other is on testing.domain.com.

When I turn off testing instance, everything works as it should. With 
testing instance turned on, production instance fails.

So... Can someone help me configure two web2py instances on the same port? 
Domains are different.

I'm using apache virtual hosts.

Marin

Dana subota, 2. ožujka 2013. 20:55:17 UTC+1, korisnik Marin Pranjić napisao 
je:

 This happened to an user multiple times. No idea why it happens.

 Error ticket doesn't show much, this is everything I can get from there:

 Traceback (most recent call last):
  File /home/www-data/web2py/gluon/main.py, line 571, in wsgibase
  session._try_store_in_cookie_or_file(request, response)
  File /home/www-data/web2py/gluon/globals.py, line 738, in 
 _try_store_in_cookie_or_file
  self._try_store_in_file(request, response)
  File /home/www-data/web2py/gluon/globals.py, line 745, in 
 _try_store_in_file
  if not response.session_id or self._forget or self._unchanged():
  File /home/www-data/web2py/gluon/globals.py, line 700, in _unchanged
  session_pickled = cPickle.dumps(dict(self))
  File /usr/lib/python2.7/copy_reg.py, line 74, in _reduce_ex
  getstate = self.__getstate__
  File /home/www-data/web2py/gluon/dal.py, line 7355, in __getattr__
  self.__allocate()
  File /home/www-data/web2py/gluon/dal.py, line 7350, in __allocate
  raise RuntimeError, Using a recursive select but encountered a broken 
 reference: %s %d%(self._table, int(self))
 RuntimeError: Using a recursive select but encountered a broken reference: 
 auth_group 5



 However, auth_group record with id=5 exists. I have no idea why it raises an 
 error.

 I'm using web2py 2.2.1, this is production instance so I can't test with 
 other versions right now.


 Marin



-- 

--- 
You received this message because you are 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: Issue with store() method on GAE

2013-03-02 Thread montgomery . global
Thanks. Please keep me posted.

On Saturday, March 2, 2013 11:15:17 PM UTC+8, Massimo Di Pierro wrote:

 Now I understand. Thanks for the clarification. I think there is a bug in 
 store on GAE. There is already an open ticket about this. Will take a look 
 asap.

 On Saturday, 2 March 2013 05:21:34 UTC-6, montgome...@gmail.com wrote:

 Sorry if that didn't make sense, let me try again.

 I have small (  100 kb) audio files that I am getting on the fly via the 
 gluon.tools.fetch method from a third party API. I want to insert them into 
 the uploads folder and create entries for them in the database (as if they 
 were data uploaded by users). I have been doing this via the store() method 
 and have had no problems during development.  On GAE, however, this is not 
 working.  Specifically, it is throwing a runtime error you must specify a 
 Field(...,uploadfolder=...).  My questions are as follows:

 1) When using the store() method on GAE, what should the 'path' argument 
 be?

 2) Since this problem appears when using the store() method to save 
 uploads to the database on GAE, but not when uploading files using SQLform, 
 it seems to be a glitch.  Is this the case, or am I missing something 
 obvious?

 Thanks again for the help.

 On Saturday, March 2, 2013 10:15:12 AM UTC+8, Massimo Di Pierro wrote:

 What do you mean? 

 On Friday, 1 March 2013 09:54:22 UTC-6, montgome...@gmail.com wrote:

 I just discovered that the insert works with the SQLform, but not 
 manually.  Any idea why that would be?  

 On Friday, March 1, 2013 12:35:08 PM UTC+8, montgome...@gmail.comwrote:

 So my app is getting some small audio files via the gluon.tools fetch 
 method, and then storing them manually in the upload folder via the 
 store() 
 method. While this works fine on a local server, it doesn't seem to work 
 on 
 GAE.  It's throwing a runtime error: you must specify a 
 Field(...,uploadfolder=...).  Looking at the DAL gluon, this seems to 
 imply that there is no path specified for the upload folder, even though 
 that should be a default argument for Field() regardless of backend.   
 Anyone have any ideas why?

 Here is the code:

 audio_file = StringIO.StringIO(fetch(audio_url))
 self.classcont_id = current.db.classcont.insert(, quest_audio = 
 current.db.classcont.quest_audio.store(audio_file, self.audio_name) 
 ,) 
 current.db.commit()

 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: Creating a form using a for loop

2013-03-02 Thread Arglanir
I think your compilation error comes from the fact that in Python you cannot 
have a variable name starting with a number. Try changing the field names of 
Evaluation table to letter_1_1A...

Then remember that only one form can be submitted in HTML, so your controler 
will be called only for one submitted form, not all.

Le samedi 2 mars 2013 07:26:18 UTC+1, Anthony Bond a écrit :
 I've been working with web2py for about two months now.  I've figured out how 
 to do a lot of awesome things with it; however, the problem I'm having now 
 has me stumped.
 
 
 I'm working on an application that allows a user to submit a self-evaluation, 
 based on criteria that the user will find on a page.  I have a table with 33 
 rows of of criteria.  The table contains a column which hosts the criteria, 
 pre-formatted in HTML.  Each HTML section contains a table the gives the 
 users the criteria for each of six levels - these individual tables are 
 almost large enough to take up the entire content section of the webpage, so 
 I've placed them all in a jQuery accordion.  Below each table, I've placed a 
 drop down list, where the user can select what criteria they feel as though 
 they've met.  I've added a small screenshot to show the look and feel I'm 
 trying to achieve (and currently have).
 
 
 The problem I'm having is getting the values of those drop down lists back 
 from the database.  Currently, I iterate through the table containing the 
 HTML using a for loop, tacking a drop down list at the end of each.  Right 
 now, I'm unable to get the data back from the page.  Here is my code:
 
 
 
 def Take_Eval(): 
 
     user = db(db.Person.auth_userUserId == 
 auth.user.id).select().first().PersonId
 
     table = db(db.PageContent.ContentId  0).select()
 
     submit = INPUT(_name='submit', _type='submit')
 
     formlist = []
 
     
 
     for row in table:
 
         newForm = FORM(H2(row['ContentDescription'], _style=padding-left: 
 10px;),
 
         DIV(XML(row.ContentHTML), BR(), P(SELECT(OPTGROUP(OPTION('Does not 
 Attempt', _value=0), OPTION('Developing', _value=1), OPTION('Progressing', 
 _value=2), OPTION('Established', _value=3), OPTION('Advanced', _value=4), 
 OPTION('Master', _value=5)), _id=row['QuestionNumber']), _style='text-align: 
 center;')))
 
         formlist.append(newForm)
 
     
 
     for form in formlist:
 
         if form.accepts(request, session):
 
            response.flash = 'Profile Saved Successfully on  ' + 
 str(time.strftime(%Y-%m-%d %H:%M:%S, time.localtime()))
 
        #db.Evaluation.insert(PersonBeingEvaluated, PersonEvaluating, EvalDate 
 ,1_1A ,1_1B ,1_2 ,1_3 ,1_4 , 1_5, 1_6, 2_1, 2_2A , 2_2B, 2_3A ,2_3B ,2_4 ,2_5 
 ,3_1 , 3_2 , 3_3, 3_4, 3_5A, 3_5B, 3_6, 3_7, 3_8, 3_9A, 3_9B, 3_9C, 4_1, 4_2, 
 4_3A, 4_3B, 4_4, BeliefsScore, CharacterScore)
 
            
 
            redirect(URL('default', 'index'))
 
         elif form.errors:
 
            response.flash = 'Profile could not be submitted.  Please try 
 again later. '
 
     
 
     db.Evaluation.insert(PersonBeingEvaluated=user, PersonEvaluating=0, 
 EvalDate=datetime.now(), 1_1A = formlist[0].vars.1_1A, 1_1B = 
 formlist[1].vars.1_1B, 1_2 = formlist[2].vars.1_2, 1_3 = 
 formlist[3].vars.1_3, 1_4 = formlist[4].vars.1_4, 1_5 = formlist[5].vars.1_5, 
 1_6 = formlist[6].vars.1_6, 2_1 = formlist[7].vars.2_1, 2_2A = 
 formlist[8].vars.2_2A, 2_2B = formlist[9].vars.2_2B, 2_3A = 
 formlist[10].vars.2_3A, 2_3B = formlist[11].vars.2_3B, 2_4 = 
 formlist[12].vars.2_4, 2_5 = formlist[13].vars.2_5, 3_1 = 
 formlist[14].vars.3_1, 3_2 = formlist[15].vars.3_2, 3_3 = 
 formlist[16].vars.3_3, 3_4 = formlist[17].vars.3_4, 3_5A = 
 formlist[18].vars.3_5A, 3_5B = formlist[19].vars.3_5B, 3_6 = 
 formlist[20].vars.3_6, 3_7 = formlist[21].vars.3_7, 3_8 = 
 formlist[22].vars.3_8, 3_9A = formlist[23].vars.3_9A, 3_9B = 
 formlist[24].vars.3_9B, 3_9C = formlist[25].vars.3_9C, 4_1 = 
 formlist[26].vars.4_1, 4_2 = formlist[27].vars.4_2, 4_3A = 
 formlist[28].vars.4_3A, 4_3B = formlist[29].vars.4_3B, 4_4 = 
 formlist[30].vars.4_4, BeliefsScore = formlist[31].vars.BeliefsScore, 
 CharacterScore = formlist[32].vars.CharacterScore)
 
           
 
     return locals()
 
 
 The code is not letting me compile due to a syntax error on the area I've 
 highlighted above.  I'm okay with not using a form, or a bunch of forms, as 
 long as I can get the values from the drop down list back to the controller 
 when the submit button is clicked.  I originally looped through the table in 
 the view to make the display.  Each drop down has a unique name that I'd be 
 able to access in the controller, but I haven't been able to figure out how 
 to do that only after post back.  I appreciate any guidance that could be 
 given.  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.

[web2py] Re: creating groups

2013-03-02 Thread sasogeek
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.




[web2py] Changing reference definition in models files does not update MySQL database

2013-03-02 Thread Kenneth
Hi,

I defined an table in models with an field with type reference db.t_abc
later I changed the models file so that type is reference db.t_def

I reloaded the page and everything seams to be fine but now when using the 
app I noticed that MySQL's table definition is not updated. 

What would be the correct way of doing this? The app is still in 
development so database is quite empty. So no problem to loose the 
connection between the tables.


Kenneth

-- 

--- 
You received this message because you are 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 is moving

2013-03-02 Thread Monte Milanuk
Could you provide a link?  I would very much like to work offline at times, 
and the PDF is falling further and further behind.

Actually, I wish the current version of the online html book would just be 
included in the download as a webapp by default.

On Friday, March 1, 2013 5:34:50 PM UTC-8, rh wrote:

 On Fri, 1 Mar 2013 15:10:54 -0800 (PST) 
 John Ho john@gmail.com javascript: wrote: 

  The link to the online engish book is broken (Invalid request). 

 I don't know if you're reporting it down because you need it now 
 or just to report it's down. FWIW you can download the book and it 
 is a web2py app and you can view it locally. Good for planes, trains and 
 automobiles too. 

 The book is on github. 



-- 

--- 
You received this message because you are 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: creating groups

2013-03-02 Thread Carlos Costa
You can create records and the the auth_group to create a group give a look
at it in the database admin, it is simple.

For example:
form = crud.create(db.auth_group)

with this line you can create a form where the user will insert a record,
so creating a new group.

To put someone in a group simply add a record in auth_membership.
Something like this:
form = crud.crate(db.auth_membership)

User must fill group and the user to add.

For setting preferences you can create another table that references a
group.
Put fields in this table for the preferences.
Something like this.

db.define_table('group_preferences'),
   Field('group',db.auth_group),
   Field('chat'),boolean), .. # other fields as
need
)

To verify if a user can chat with another you can do something like this:

can_chat = db(db.auth_group.user==userid_to_chat 
db.group_preferences.group==db.auth_group.id 
db.group_preferences.chat).select()
if len(can_chat)  0:
  # if you got some record in the query the you can chat
























2013/3/2 sasogeek sasog...@yahoo.com

 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.






-- 
Att.

Carlos J. Costa
Cientista da Computação
Esp. Gestão em Telecom

EL MELECH NEEMAN!
אָמֵן

-- 

--- 
You received this message because you are 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 is moving

2013-03-02 Thread LightDot
The book is too big to be included in every download, IMHO, it's about 120 
MB or so.

The link... well, github - search - web2py book ;)

Regards,
Ales

On Sunday, March 3, 2013 2:22:40 AM UTC+1, Monte Milanuk wrote:

 Could you provide a link?  I would very much like to work offline at 
 times, and the PDF is falling further and further behind.

 Actually, I wish the current version of the online html book would just be 
 included in the download as a webapp by default.

 On Friday, March 1, 2013 5:34:50 PM UTC-8, rh wrote:

 On Fri, 1 Mar 2013 15:10:54 -0800 (PST) 
 John Ho john@gmail.com wrote: 

  The link to the online engish book is broken (Invalid request). 

 I don't know if you're reporting it down because you need it now 
 or just to report it's down. FWIW you can download the book and it 
 is a web2py app and you can view it locally. Good for planes, trains and 
 automobiles too. 

 The book is on github. 



-- 

--- 
You received this message because you are 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] Optimising caching and enabling gzip for web2py on heroku?

2013-03-02 Thread Alec Taylor
Going through the Google PageSpeed Insights report
(https://developers.google.com/speed/pagespeed/insights) to see what I
should optimise to improve my site-load speed.

The two high priority ones to worry about are:
- Leverage browser caching
- Enable compression

How do I deal with these internally to web2py and on heroku?

(e.g.: Rocket doesn't support gzip; so how do I configure this on
heroku? - All the guides I saw were for Django or Flask…)

FYI: I have also enabled these two lines in my db.py:
response.optimize_css = 'concat,minify,inline'
response.optimize_js = 'concat,minify,inline'

How do I optimize these High priority metrics PageSpeed found?

Thanks for all suggestions,

Alec Taylor

-- 

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




Re: [web2py] Re: web2py is moving

2013-03-02 Thread Monte Milanuk

On 03/02/2013 08:01 PM, LightDot wrote:
The book is too big to be included in every download, IMHO, it's about 
120 MB or so.


Holy moly... didn't realize it was that portly!  I'd be curious as to 
where all the MB are coming from?  Guess I'll download it and find out ;)


The link... well, github - search - web2py book ;)



Thanks... I was looking in the main web2py github and not finding 
anything about it so I wasn't sure where to look next.


--

--- 
You received this message because you are 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 is moving

2013-03-02 Thread wwwgong
If you choose 1 lang, the size is much smaller

On Saturday, March 2, 2013 11:01:27 PM UTC-5, LightDot wrote:

 The book is too big to be included in every download, IMHO, it's about 120 
 MB or so.

 The link... well, github - search - web2py book ;)

 Regards,
 Ales

 On Sunday, March 3, 2013 2:22:40 AM UTC+1, Monte Milanuk wrote:

 Could you provide a link?  I would very much like to work offline at 
 times, and the PDF is falling further and further behind.

 Actually, I wish the current version of the online html book would just 
 be included in the download as a webapp by default.

 On Friday, March 1, 2013 5:34:50 PM UTC-8, rh wrote:

 On Fri, 1 Mar 2013 15:10:54 -0800 (PST) 
 John Ho john@gmail.com wrote: 

  The link to the online engish book is broken (Invalid request). 

 I don't know if you're reporting it down because you need it now 
 or just to report it's down. FWIW you can download the book and it 
 is a web2py app and you can view it locally. Good for planes, trains and 
 automobiles too. 

 The book is on github. 



-- 

--- 
You received this message because you are 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 is moving

2013-03-02 Thread wwwgong
I installed 3 languages (ENU, CHN DEU) locally, total size = 30MB
so it is about 10MB/per lang


On Saturday, March 2, 2013 11:53:07 PM UTC-5, wwwgong wrote:

 If you choose 1 lang, the size is much smaller

 On Saturday, March 2, 2013 11:01:27 PM UTC-5, LightDot wrote:

 The book is too big to be included in every download, IMHO, it's about 
 120 MB or so.

 The link... well, github - search - web2py book ;)

 Regards,
 Ales

 On Sunday, March 3, 2013 2:22:40 AM UTC+1, Monte Milanuk wrote:

 Could you provide a link?  I would very much like to work offline at 
 times, and the PDF is falling further and further behind.

 Actually, I wish the current version of the online html book would just 
 be included in the download as a webapp by default.

 On Friday, March 1, 2013 5:34:50 PM UTC-8, rh wrote:

 On Fri, 1 Mar 2013 15:10:54 -0800 (PST) 
 John Ho john@gmail.com wrote: 

  The link to the online engish book is broken (Invalid request). 

 I don't know if you're reporting it down because you need it now 
 or just to report it's down. FWIW you can download the book and it 
 is a web2py app and you can view it locally. Good for planes, trains 
 and 
 automobiles too. 

 The book is on github. 



-- 

--- 
You received this message because you are 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 is moving

2013-03-02 Thread Massimo Di Pierro
Most of it is images. They are repeated. They should not be.


On Saturday, 2 March 2013 22:56:50 UTC-6, wwwgong wrote:

 I installed 3 languages (ENU, CHN DEU) locally, total size = 30MB
 so it is about 10MB/per lang


 On Saturday, March 2, 2013 11:53:07 PM UTC-5, wwwgong wrote:

 If you choose 1 lang, the size is much smaller

 On Saturday, March 2, 2013 11:01:27 PM UTC-5, LightDot wrote:

 The book is too big to be included in every download, IMHO, it's about 
 120 MB or so.

 The link... well, github - search - web2py book ;)

 Regards,
 Ales

 On Sunday, March 3, 2013 2:22:40 AM UTC+1, Monte Milanuk wrote:

 Could you provide a link?  I would very much like to work offline at 
 times, and the PDF is falling further and further behind.

 Actually, I wish the current version of the online html book would just 
 be included in the download as a webapp by default.

 On Friday, March 1, 2013 5:34:50 PM UTC-8, rh wrote:

 On Fri, 1 Mar 2013 15:10:54 -0800 (PST) 
 John Ho john@gmail.com wrote: 

  The link to the online engish book is broken (Invalid request). 

 I don't know if you're reporting it down because you need it now 
 or just to report it's down. FWIW you can download the book and it 
 is a web2py app and you can view it locally. Good for planes, trains 
 and 
 automobiles too. 

 The book is on github. 



-- 

--- 
You received this message because you are 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 is moving

2013-03-02 Thread Monte Milanuk
So... this is supposed to be installable as an app within web2py, right?

It's not a w2p file, so I can't install it directly as a package file.  I 
tried renaming the original zip file I downloaded to a .w2p extension, 
nada.  Tried extracting and then repackaging as a .tar.gz file... nada. 
 Tried renaming *that* as a .w2p file... which finally installed, but as 
soon as I tried opening the application from web2py, I got a page saying 
invalid 
controller (default/index)

Trying to install directly from git appears to require 'gitpython', which I 
installed (via git), but web2py still complains about it being 'not 
available or incompatible version' (running python 2.7.3, git 1.7.10, 
web2py 2.3.2, on Ubuntu 12.10).

Any other suggestions?

-- 

--- 
You received this message because you are 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.