[web2py] Re: Two parallel methods of authenticating users based on Auth class

2014-08-02 Thread marcin jaworski
From the handbook: Sessions are retrieved before module code is executed 
and therefore before classes are defined. Therefore user defined classes 
cannot be pickled.

Given that id of registered user is known, instead of creating any user 
class and instead of enriching it with required attributes, the right type 
of existing data should be passed to the right function. Session is already 
waiting with auth container to accept it before default module is loaded. 
So, we are geting the user ROW object to be authenticated from database and 
pass it as an argument to auth.user_login()

user_row_from_auth_table = db(db.auth_user.id == 
id_of_user_to_be_authenticated).select()[0] 
auth.user_login(user_row_from_auth_table)

From now on we have auth.user.id accessible from everywhere within the user 
session within the application




W dniu czwartek, 31 lipca 2014 12:43:35 UTC+2 użytkownik marcin jaworski 
napisał:

 Hi All, 
 My fault. Web2py handbook says: 
 Don't store user-defined classes in session
 I will have to re-read the basics after not touching framework for a long 
 time (since the luck of troubles).
 Thanks for your time.
 Marcin




 W dniu środa, 30 lipca 2014 14:39:38 UTC+2 użytkownik Marcin Jaworski 
 napisał:

 Hi Massimo,
 Thanks for your input. 
 Yes, they would receive email, since they have got external (out of 
 google services) email accounts.
 I realized that I should describe shortly my approach.

 Most of aplication users will use GaeGoogleLogin. 
 There are only few that will use alternative login method.
 The minority have their own records in datastore with id, login and 
 password. 

 How to authenticate the minority?
 I have found function in web2py.gluon.tools.Auth called login_user() that 
 should log in requested user as can be checked via is_logged_id(). 
 I prepared separate login screen (avoiding Google login) getting user 
 input namely login and password.
 Now If user input match user data I would like use auth.user_login() to 
 get 'logged in' status.
 Suppose that I have empty class ChineseUser in db.py and I am 
 instantiating it in default controller like so:

 user = ChineseUser()

 and I am binding required (by other gluon functions) attributes like so:
 user.id = id_taken_from_database
 user.email = email_taken_from_database

 and I am using auth.user_login(user) to log in the user. 
 call of 'if auth.is_logged_in()' confirms the success of logging operation
 And within one function all is fine, which means session.auth.user.id 
 returns correct id of the user that have been logged in.  

 Unfortunately, calling session variables (session.auth.user.id) or 
 auth.user.id within other function(s) returns error saying None type(s) 
 (session and auth in this case) have no requested attributes (id).

 How to provide session and auth (meaning the session and the auth called 
 by 'my' loggin in method - not the Google LoginService based method) to 
 hold their states across functions?

 Thanks in advance,
 Marcin

 On Tuesday, July 29, 2014 5:42:30 PM UTC+2, Massimo Di Pierro wrote:

 Even if you use GaeGoogleLogin the auth_user table contains both id and 
 email (as provided by gmail). Now if you switch from GaeGoogleLogin to 
 local authentication and email everybody a link to reset the password they 
 will not need to register again and therefore they will retain the current 
 id. I have not tried this but should work.

 For example you can make a script that does:

 auth.messages.reset_password = 'You must reset your password. Click on 
 the link %(link)s to reset your password'
 for user in db(db.auth_user).select(): auth.email_reset_password(user)

 Now the issue is, if they cannot access GAE for login, would they 
 receive the email?


 On Tuesday, 29 July 2014 09:01:07 UTC-5, Marcin Jaworski wrote:

 Hello,

 I have web2py on GAE and it works fine. Unfortunately, clients from 
 China cannot access Google ServiceLogin lately. I have declared it in 
 db.py 
 settings like so: auth.settings.login_form=GaeGoogleAccount() after 
 importing this method from gluon.contrib.login_methods.gae_google_account. 
 I need some kind of fix or rather some kind of enhanced, alternative 
 solution enabling users from China to be authenticated via available 
 web2py 
 Auth class despite the fact Google ServiceLogin is not accessible for them 
 and most of the remaining users should be logged in via Google 
 ServiceLogin? The problem (?) is that huge parts of application 
 functionality id based on calling auth.user.id in controllers and 
 views after auth tables based on declared login method had been generated. 
 Is there any painless solution not to give up the auth.user.id 
 construct in function call, but redefining the reference of auth in my 
 situation? 

 Thanks in advance,
 Marcin


 BI-Lion Analytics
 mobile: +48 72880


 BI-Lion Analytics
 mobile: +48 72880



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

[web2py] Re: Controller wont return submitted row id

2014-08-02 Thread desta
http://imgur.com/Rs2YVeq

Hi Massimo and thank you for the reply. A couple of questions
1) What are the associated overheads of SQLFORM?
2) I tried the code you suggested but unfortunately I have the same 
behavior.

If I use
return 'NOTOK' if r.errors else str(r.id)
I get nothing as a response, see here http://i.imgur.com/Rs2YVeq

If, on the other hand, I use
return 'NOTOK' if r.errors else str(OK)
I get the response correctly, see here http://i.imgur.com/Svk8ESQ

3) If I use the JSON return as you suggest, could I include the row.id as 
well?

Thank you

On Saturday, August 2, 2014 8:35:37 AM UTC+3, Massimo Di Pierro wrote:

 You should not do this. If this is meant to be called via ajax it is not a 
 good idea to use a SQLFORM because of the associated overhead. Instead try:

 def addsample():
 if request.env.request_method == 'POST':
 r = db.sample.validate_and_insert(**request.post_vars)
 return 'NOTOK' if r.errors else str(r.id)
 else: raise HTTP(400)

 even better you should return JSON objects (for example return 
 response.json(r.errors)).

 On Friday, 1 August 2014 19:08:31 UTC-5, desta wrote:

 Hello everyone,

 I have this controller which is called through AJAX and submits data to 
 the form. The data is successfully transmitted but when I try to return the 
 submitted row id the controller returns nothing. 

 def addsample():
 formSample = SQLFORM(db.sample, _class='form-horizontal', formstyle=
 'bootstrap3', _id='sampleForm');
 if formSample.accepts(request, hideerror=True, formname=None):
 return str((formSample.vars.id))
 elif formSample.errors:
 return str(NOTOK)

 I also tried returning a number (as a string) but it didn't work:
 return str(15)

 However, if I return OK it works:
 return str(OK)

 What am I missing here?

 Thank you!



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


[web2py] Re: Coping with new behavior of _referenced_by

2014-08-02 Thread Srikanth Durbha
I'm trying to modify this a bit:

https://github.com/mdipierro/web2py-appliances/tree/master/AppointmentManager

and bumped into this problem of the for loop throwing a ticket. None of the 
suggested solutions seem to work for me. Any way out?

On Saturday, 11 May 2013 23:46:19 UTC+5:30, Massimo Di Pierro wrote:

 Replace

 {{for t,f in db.t_sys_config._referenced_by:}}

 with

 {{for x in db.t_sys_config._referenced_by:}}{{t,f = x if 
 isinstance(x,tuple) else (x.tablename,x.name)}}

 It should do the trick. Sorry for the late response.

 On Wednesday, 1 May 2013 16:37:29 UTC-5, Michael Ellis wrote:

 I've got an app from before 2.0 with wizard-generated code in multiple 
 views that looks similar to this.

 {{=form}}
 {{for t,f in db.t_sys_config._referenced_by:}}{{if not 
 t[-8:]=='_archive':}}[{{=A(t[2:],_href=URL('%s_select'%t[2:],args=(f,
 form.record.id)))}}]{{pass}}{{pass}} 

 Under web2py 2.4.6, the for loop throws a ticket because *_referenced_by* 
 is returning a list of Field objects instead of tuples. The app is running 
 in almost 100 different servers on 1.99.  How can I modify the app code 
 (without doing something kludgey like detecting web2py versions) so it will 
 run under any web2py version?

 Thanks,
 Mike



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


[web2py] Pycharm - Web2py developing on remote server

2014-08-02 Thread Giovanni Marchetto
I've a question about developing web2py app on remote server with Pycharm. 
I've a professional license for Pycharm and a VPS where web2py  run on port 
8000. It is possible with Pycharm to developing the application using 
directly  web2py server VPS? Thanks a lot.
Giovanni

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


[web2py] Re: Controller wont return submitted row id

2014-08-02 Thread Massimo Di Pierro
I am not sure about the overhead of SQLFORM but it goes through the logic 
of generating the HTML for even if you do not need it.

The result you are getting is odd. What database are you using? What is the 
model? Is it possible your table does not have an auto increment id field?

On Saturday, 2 August 2014 03:50:24 UTC-5, desta wrote:

 Hi Massimo and thank you for the reply. A couple of questions
 1) What are the associated overheads of SQLFORM?
 2) I tried the code you suggested but unfortunately I have the same 
 behavior.

 If I use
 return 'NOTOK' if r.errors else str(r.id)
 I get nothing as a response, see here http://i.imgur.com/Rs2YVeq

 If, on the other hand, I use
 return 'NOTOK' if r.errors else str(OK)
 I get the response correctly, see here http://i.imgur.com/Svk8ESQ

 3) If I use the JSON return as you suggest, could I include the row.id as 
 well?

 Thank you

 On Saturday, August 2, 2014 8:35:37 AM UTC+3, Massimo Di Pierro wrote:

 You should not do this. If this is meant to be called via ajax it is not 
 a good idea to use a SQLFORM because of the associated overhead. Instead 
 try:

 def addsample():
 if request.env.request_method == 'POST':
 r = db.sample.validate_and_insert(**request.post_vars)
 return 'NOTOK' if r.errors else str(r.id)
 else: raise HTTP(400)

 even better you should return JSON objects (for example return 
 response.json(r.errors)).

 On Friday, 1 August 2014 19:08:31 UTC-5, desta wrote:

 Hello everyone,

 I have this controller which is called through AJAX and submits data to 
 the form. The data is successfully transmitted but when I try to return the 
 submitted row id the controller returns nothing. 

 def addsample():
 formSample = SQLFORM(db.sample, _class='form-horizontal', formstyle=
 'bootstrap3', _id='sampleForm');
 if formSample.accepts(request, hideerror=True, formname=None):
 return str((formSample.vars.id))
 elif formSample.errors:
 return str(NOTOK)

 I also tried returning a number (as a string) but it didn't work:
 return str(15)

 However, if I return OK it works:
 return str(OK)

 What am I missing here?

 Thank you!



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


[web2py] Question about FORM

2014-08-02 Thread tiraen
Good evening, I just started learning this fremvork because questions may 
seem childish, but still. 
task: 
Create a jump button (just to another page) 

My solution, I wrote a similar code kontoroller
 
def index (): 
 form = FORM () 
 form.add_button ('Click', URL ('first')) 
 return dict (form = form) 
the error is 

AttributeError: 'NoneType' object has no attribute 'parent'

Although the official documentation of such a method is listed as a way to 
create simple buttons. I would be grateful for your help

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


[web2py] Re: Question about FORM

2014-08-02 Thread Massimo Di Pierro
form = FORM()
makes a form but you are making a form that contains no 
input/select/texarea/buttons.

form.add_button('Click', URL ('first'))
adds a button after the submit button in the previous form, but that form 
does not have a submit button.

If you really want a form, you should put something in the form:

form = FORM(INPUT(_type=Submit)
form.add_button('Click', URL ('first'))

or do not use a form but, for example, a DIV

form = DIV()
form.append(A('Click', _href=URL ('first')))



On Saturday, 2 August 2014 12:58:04 UTC-5, tir...@gmail.com wrote:

 Good evening, I just started learning this fremvork because questions may 
 seem childish, but still. 
 task: 
 Create a jump button (just to another page) 

 My solution, I wrote a similar code kontoroller
  
 def index (): 
  form = FORM () 
  form.add_button ('Click', URL ('first')) 
  return dict (form = form) 
 the error is 

 AttributeError: 'NoneType' object has no attribute 'parent'

 Although the official documentation of such a method is listed as a way 
 to create simple buttons. I would be grateful for your help



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


[web2py] Re: Controller wont return submitted row id

2014-08-02 Thread desta
I believe I am using a standard db with id.
I used JSON to return the id and it works
return 'NOTOK' if r.errors else gluon.contrib.simplejson.dumps([r.id])
The response is correct http://imgur.com/8xzCzU5

Even though I solved my problem (using JSON) it still strange why it cannot 
return an integer.

Thank you.


On Saturday, August 2, 2014 8:48:47 PM UTC+3, Massimo Di Pierro wrote:

 I am not sure about the overhead of SQLFORM but it goes through the logic 
 of generating the HTML for even if you do not need it.

 The result you are getting is odd. What database are you using? What is 
 the model? Is it possible your table does not have an auto increment id 
 field?

 On Saturday, 2 August 2014 03:50:24 UTC-5, desta wrote:

 Hi Massimo and thank you for the reply. A couple of questions
 1) What are the associated overheads of SQLFORM?
 2) I tried the code you suggested but unfortunately I have the same 
 behavior.

 If I use
 return 'NOTOK' if r.errors else str(r.id)
 I get nothing as a response, see here http://i.imgur.com/Rs2YVeq

 If, on the other hand, I use
 return 'NOTOK' if r.errors else str(OK)
 I get the response correctly, see here http://i.imgur.com/Svk8ESQ

 3) If I use the JSON return as you suggest, could I include the row.id 
 as well?

 Thank you

 On Saturday, August 2, 2014 8:35:37 AM UTC+3, Massimo Di Pierro wrote:

 You should not do this. If this is meant to be called via ajax it is not 
 a good idea to use a SQLFORM because of the associated overhead. Instead 
 try:

 def addsample():
 if request.env.request_method == 'POST':
 r = db.sample.validate_and_insert(**request.post_vars)
 return 'NOTOK' if r.errors else str(r.id)
 else: raise HTTP(400)

 even better you should return JSON objects (for example return 
 response.json(r.errors)).

 On Friday, 1 August 2014 19:08:31 UTC-5, desta wrote:

 Hello everyone,

 I have this controller which is called through AJAX and submits data to 
 the form. The data is successfully transmitted but when I try to return 
 the 
 submitted row id the controller returns nothing. 

 def addsample():
 formSample = SQLFORM(db.sample, _class='form-horizontal', formstyle
 ='bootstrap3', _id='sampleForm');
 if formSample.accepts(request, hideerror=True, formname=None):
 return str((formSample.vars.id))
 elif formSample.errors:
 return str(NOTOK)

 I also tried returning a number (as a string) but it didn't work:
 return str(15)

 However, if I return OK it works:
 return str(OK)

 What am I missing here?

 Thank you!



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


[web2py] Re: Upload field custom manipulation

2014-08-02 Thread Massimo Di Pierro
Than it is easy. make it writable=false if forms.
Store your filename in the the upload field. But instead of

URL('download',)

use

URL('mydownload',)


Where:

def mydownload():
 fullname = os.path.join(os.path.join, 'private', request.args(0))
 response.stream(fullname)


On Wednesday, 30 July 2014 03:00:48 UTC-5, Kuba Kozłowicz wrote:

 f_invoice_file_path is location where the file is stored by myself, 
 because I generate these files myself and I save them myself as well. It 
 contains whole path to the file ( with the filename and its extension ). 
 They are stored under private directory with the structure I described 
 above. I don't need web2py to handle writing of these files ( because I am 
 doing it myself ), I just need to be able to browse and download these file 
 in SMART GRID as well as on VIEW page. And since I don't use default web2py 
 storing mechanism ( which does some name changing ) I can't simply do that 
 or I don't know how to do it.

 W dniu wtorek, 29 lipca 2014 17:35:02 UTC+2 użytkownik Massimo Di Pierro 
 napisał:

 Let me understand this better f_invoice_file_path is the location where 
 the file is supposed to be stored or is it the full path including the 
 desired filename? Do you handle the file writing or should web2py do it 
 automatically?


 On Tuesday, 29 July 2014 05:59:10 UTC-5, Kuba Kozłowicz wrote:

 I have three tables:

 - invoices
 - invoice summaries
 - invoice bundles

 The website I am working on provides such a functionality, that user 
 uploads a file, from which invoices and invoice summaries are generated and 
 after being generated they are zipped and put into a bundle.

 For each upload I create following structure for storing these files:

 invoices/
  /bundle_id/list of invoices of bundle bundle_id/
 summaries/
  /bundle_id/list of invoices of bundle bundle_id/
 bundles/
  /bundle_id/list of invoices of bundle bundle_id/



 So I end up having something that looks like this

 invoices/
  /1/list of invoices of bundle_1/
 /invoice1.pdf
 /invoice2.pdf
  /2/list of invoices of bundle_2/
 /invoice1.pdf
 /invoice2.pdf
  /3/list of invoices of bundle_3/
 /invoice1.pdf
 /invoice2.pdf
 summaries/
  /1/list of summaries of bundle_1/
 /summary1.pdf
  /2/list of summaries of bundle_2/
 /summary1.pdf
  /3/list of summaries of bundle_3/
 /summary1.pdf
 bundles/
  /1/bundle_1/
 /bundle.zip
  /2/bundle_2/
 /bundle.zip
  /3/bundle_3/
 /bundle.zip




 where inner folder name is ID of recently created bundle.

 Now to provide CRUD functionality I am using SMART GRID and I want to be 
 able to display the file of invoice, summary, bundle entries ( by 
 displaying I mean I want to display file's name and allow downloading it ), 
 when a user either chooses VIEW in the SMART GRID or when he looks at the 
 list of entries. Since I've chosen my own folder structure for storing 
 these invoices, summaries and bundles I can't do it in a simple way, 
 because Web2py uses its own mechanism to store and retrieve files and 
 changse file's name. So in each of these tables I store the following 
 fields:
 Field('f_invoice_file_path', type='string')
 Field('f_invoice_file', 'upload')



 what I wanted to do is something like this:

 def on_before_insert_invoice(fields, id):
 db(db.t_invoice.id == id).update(
 f_invoice_file=fields['f_invoice_file_path']
 )
 db.t_invoice._before_insert.append(
 on_before_insert_invoice
 )

 , here actually *fields* contains a list of tuples in following format 
 (field, value) so I had to iterate over it to find fields[
 'f_invoice_file_path'], I just omitted this part for brevity.

 , but I get following error and most likely it is not the proper way to 
 do that:

 *** RuntimeError: Unable to handle upload

 Note that the field:

 Field('f_invoice_file_path', type='string')

 is saved correctly, I just need somehow to make upload field point to 
 that location. The next weird thing is that variable *fields* doesn't 
 contain field Field('f_invoice_file', 'upload')
 , even though I added it to the model, settings.migrate is set to True, 
 and server has been restarted.

 How can I do it?









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


[web2py] Re: Multiple Routes - Same App

2014-08-02 Thread 'Michael Gheith' via web2py-users
Is there way to programmatically set a path prefix in a controller rather 
than in routes.py?

Best,
Michael Joseph Gheith

On Tuesday, July 29, 2014 4:47:17 PM UTC-5, Michael Gheith wrote:

 Hello,

 I rewrote what you had Massimo as the following (and it compiled just 
 fine):

 routes_in =  [('/sam/(?Pclient\w+)/$a/$c/$f', '/$a/$c/$f/\gclient')]

 routes_out =  [('/$a/$c/$f/(?Pclient)', '/sam/\gclient/$a/$c/$f')]


 I see what you are trying to do - although it's still not producing the 
 desired result unfortunately :(


 Further guidance would be much appreciated!  Anthony, where are you on 
 this one, I need your help man!



 Kindest of regards,

 Michael Joseph Gheith

 On Wednesday, July 23, 2014 11:41:29 AM UTC-5, Michael Gheith wrote:

 What I'm trying to do is to have my application serve 2 different 
 customers via URLs like the following:

 http://127.0.0.1:8000/sam/client1/appname/default/index
 http://127.0.0.1:8000/sam/client2/appname/default/index


 My routes.py looks like:

 routes_in =  (

   ('/sam/client1/$a/$c/$f', '/$a/$c/$f'), (
 '/sam/client2/$a/$c/$f', '/$a/$c/$f')

  )


 routes_out = (

   ('/$a/$c/$f', '/sam/client1/$a/$c/$f'), ('/$a/$c/$f', 
 '/sam/client2/$a/$c/$f')

  )


 This works great for client1.  The minute I use client2 the links use 
 client1 mappings in the URL.  I'm using the URL function for all my links. 
  Any ideas what I'm doing wrong?  Perhaps this is an issue with web2py? 
  Please advise.


 Thanks in advance!
 M.G.



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


[web2py] Hide a form field in view

2014-08-02 Thread desta
Is it possible, when creating a form with SQLFORM to set a field as hidden?

In my application I have a form which one of its fields, has to be 
completed automatically i.e. not by the user. The problem is that the data 
that goes into that field is dynamic (depends on the actions of the user) 
and it is not known when the form is constructed in the controller. That 
means that the field has to be in the html and hidden. *readable=False* and 
*writable=False* don't work in this case.

Any suggestions?

Thank you.

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


[web2py] Re: How to remove the symbol. What is the cause of its appearance?

2014-08-02 Thread LightDot
It's a common issue with unicode  python, perhaps this will give you some 
ideas on how to proceed:

http://stackoverflow.com/questions/2153920/returning-the-first-n-characters-of-a-unicode-string

Regards

On Tuesday, July 29, 2014 6:41:26 PM UTC+2, Капылов Данил wrote:

 Maybe you're right. But I have displayed several blocks with different 
 text, and if I change 400 to 401 or 403 or any other number. In some units 
 this symbol appears.

 How can I solve this problem?



 вторник, 29 июля 2014 г., 3:18:44 UTC+6 пользователь Derek написал:

 ok, so my guess is that this is unicode text, so it's not counting 400 
 characters, it's counting 400 bytes, so it may potentially cut off a byte 
 thus making an invalid unicode character. You can probably change it from 
 401 to 400 or 402, just to make sure you are cutting at the appropriate 
 place.


 On Thursday, July 24, 2014 11:48:34 PM UTC-7, Капылов Данил wrote:

 When displaying text in some text at the end appears. and some do not. 
 In this text there is no character. How to fix it was not? 

 p
 {{if len(row.body)400:}}
 {{=(row.body[:401] + '. . .')}}

 {{else:}}
 {{=row.body}}
 {{pass}}
 /p



 https://lh6.googleusercontent.com/-nJ-gIznhEXY/U9H9XFh4YOI/HrA/GLFnau6ffbk/s1600/simvol.png



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


[web2py] Re: Hide a form field in view

2014-08-02 Thread 黄祥
perhaps you can use, show_if.

ref:
http://web2py.com/books/default/chapter/29/07/forms-and-validators#Conditional-fields

best regards,
stifan

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


[web2py] Re: Creating a 5 page PDF file to teach web2py -- What should I focus on?

2014-08-02 Thread Matheus Cardoso
It could be a good ideia to create a github repository to allow the 
community collaborates with you. Then, you can control this by issues and, 
who knows, accept some pull requests. 

On Thursday, July 31, 2014 11:05:59 PM UTC-3, LoveWeb2py wrote:

 Hello,

 I'm creating a 5 page PDF to get users acquainted with web2py. I'd like to 
 orientate them with the MVC model, have them define a database, and create 
 a simple app.

 I could add an extra page if needed, but do you think there is a better 
 topic I could focus on other than what I have listed? I'm totally open to 
 input and will share the presentation when complete :)

 Everyone here has helped me so much in the past so I truly value and 
 appreciate your input.



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