[web2py] Changes not reflecting

2018-07-26 Thread yogeshwar khalkar
Hi All

I am facing strange behavior in web2py.

When I make some changes in controller or models it's getting saved in file 
but changes is not reflecting in application.

I have restarted the app multiple times but changes not reflecting in app.

I have compiled the app and installed in new project didn't helped.

I don't know what I am doing wrong.

Please tell me the reason and any pointer to solve this.

Thanks

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


[web2py] Cannot resolve reference

2018-06-21 Thread yogeshwar khalkar
Hi,

I am getting 
 'Cannot resolve reference company_process in 
board_meeting definition'
error when using circular reference..

Table structure

db.define_table('board_meeting',
Field('agenda', 'json'),
Field('process',db.process),
Field('event','reference company_process'),
Field('serial', length=100),
Field('address','string'),
Field('description','text'),
Field('resolution','json'),
format = '%(serial)s')

db.define_table("company_process",
Field('process',db.process),
Field('company',db.company),
Field('board_meeting',db.board_meeting),
Field('egm',db.board_meeting),
Field('steps','integer'),
Field('filling_document','json'),
auth.signature,
format='%(process)s')

I am using web2py 2.16.1

Please help me to solve this.

Thanks.

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


[web2py] json field data sequence

2018-05-31 Thread yogeshwar khalkar
Hi,

I have a JSON field in the table with multiple key-value pairs.

I want to render that data on the screen in the sequence I have entered it.

But web2py rearranges that data in the database, don't know on which 
precedence.

I want the data in the sequence I have entered in the database.

Anyone know's what happening here and how to keep the sequence of JSON as 
entered.

Please help me.

Thanks

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


[web2py] Error in mysql connection

2018-05-10 Thread yogeshwar khalkar
Hi all,

I am facing some issue to connect to the database with password including 
'@' symbol.
without including '@' symbol in the password, it works.
Is this a bug or am I missing something

mysql://root:pass@123@localhost/csautomation


It workes for following string:


mysql://root:pass123@localhost/csautomation




Traceback



 Failure to connect, tried 5 times: Traceback 
(most recent call last): File 
"C:\Users\Admin\PycharmProjects\MainApp\web2py\gluon\packages\dal\pydal\base.py",
 line 454, in __init__ self._adapter = adapter(**kwargs) File 
"C:\Users\Admin\PycharmProjects\MainApp\web2py\gluon\packages\dal\pydal\adapters\__init__.py",
 line 40, in __call__ obj = super(AdapterMeta, cls).__call__(*args, **kwargs) 
File 
"C:\Users\Admin\PycharmProjects\MainApp\web2py\gluon\packages\dal\pydal\adapters\base.py",
 line 368, in __init__ super(SQLAdapter, self).__init__(*args, **kwargs) File 
"C:\Users\Admin\PycharmProjects\MainApp\web2py\gluon\packages\dal\pydal\adapters\base.py",
 line 52, in __init__ self.reconnect() File 
"C:\Users\Admin\PycharmProjects\MainApp\web2py\gluon\packages\dal\pydal\connection.py",
 line 172, in reconnect self.connection = self.connector() File 
"C:\Users\Admin\PycharmProjects\MainApp\web2py\gluon\packages\dal\pydal\adapters\mysql.py",
 line 52, in connector return self.driver.connect(**self.driver_args) File 
"C:\Users\Admin\PycharmProjects\MainApp\web2py\gluon\contrib\pymysql\__init__.py",
 line 90, in Connect return Connection(*args, **kwargs) File 
"C:\Users\Admin\PycharmProjects\MainApp\web2py\gluon\contrib\pymysql\connections.py",
 line 688, in __init__ self.connect() File 
"C:\Users\Admin\PycharmProjects\MainApp\web2py\gluon\contrib\pymysql\connections.py",
 line 937, in connect raise exc OperationalError: (2003, "Can't connect to 
MySQL server on '123@localhost' ([Errno 11003] getaddrinfo failed)")

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


Re: [web2py] Re: auth decorator with rest api

2018-04-15 Thread yogeshwar khalkar
The site is served by angular and angular calling the web2py API but, the
site is not online to show you.

If someone worked on this scenario Please give me some pointers.




‌

Thanks,
Yogeshwar

On Sat, Apr 14, 2018 at 11:51 PM, Anthony <abasta...@gmail.com> wrote:

> Hard to say what is going on. Would have to see how these Ajax calls are
> being made and what response is received by the browser. What is the URL in
> the address bar of the browser? Is the site being served by web2py (port
> 8000) or by an angular development server (port 4200)?
>
> Anthony
>
> On Saturday, April 14, 2018 at 2:29:02 AM UTC-4, yogeshwar khalkar wrote:
>>
>> The session cookie is being set and user record is being added to the
>> session upon login.
>> but it not being sent back and forth on each request.
>>
>> Also, self.user is None before logout and logout event is not being added
>> to the auth_event table.
>>
>> I am confused here with sending session back and forth.
>>
>> I an using web2py with angular5, every operation is working using rest
>> API, web2py running on port 8000 and angular running on port 4200
>>
>>
>>
>> ‌
>>
>> Thanks,
>> Yogeshwar
>>
>> On Fri, Apr 13, 2018 at 7:39 PM, Anthony wrote:
>>
>>> So, are both the login and subsequent requests all being made via Ajax
>>> from a browser? If so, confirm that the session cookie is being set and
>>> sent back and forth on each request, and confirm that the user record is
>>> being added to the session upon login.
>>>
>>>
>>> On Friday, April 13, 2018 at 12:27:35 AM UTC-4, yogeshwar khalkar wrote:
>>>>
>>>> For logging, I am using rest API
>>>>
>>>> @request.restful()
>>>> def login():
>>>> def POST():
>>>> fields = simplejson.loads(request.body.read())
>>>> user = super(Auth, auth).login(**fields)
>>>>
>>>> return json(user)
>>>> return locals()
>>>>
>>>>
>>>> I am using this api in angular so for calling getActivity
>>>>
>>>> *Angular code*
>>>>
>>>> this.http.get(this.baseurl+'workflow/getActivity/'+this.processId+'/'+this.id).subscribe(res=>{
>>>>   console.log(res);
>>>>
>>>> });
>>>>
>>>> this.http.post(this.baseurl+'workflow/getActivity',JSON.stringify(this.actdata)).subscribe(res=>{
>>>>   console.log(res);
>>>>
>>>> });
>>>>
>>>>
>>>> *rest api*
>>>>
>>>> @auth.requires_login()
>>>> @request.restful()
>>>> def getActivity():
>>>>
>>>> def GET(process, activity):
>>>>
>>>> data = "do Something"
>>>>
>>>> return json(data)
>>>>
>>>> def POST():
>>>>
>>>> fields = simplejson.loads(request.body.read())
>>>>
>>>> data = "do Something"
>>>>
>>>> return json(data)
>>>>
>>>> return locals()
>>>>
>>>>
>>>> Thanks,
>>>> Yogeshwar
>>>>
>>>> On Fri, Apr 13, 2018 at 3:52 AM, Anthony wrote:
>>>>
>>>>> How are you (a) logging in and (b) making the calls to getActivity?
>>>>>
>>>>>
>>>>> On Thursday, April 12, 2018 at 8:55:02 AM UTC-4, yogeshwar khalkar
>>>>> wrote:
>>>>>>
>>>>>> Hi All,
>>>>>>
>>>>>>
>>>>>> I was implementing the @auth.requires_login() with @request.restful() 
>>>>>> but it not working.
>>>>>>
>>>>>> It redirects me every time even if I am login.
>>>>>>
>>>>>>
>>>>>> @auth.requires_login()
>>>>>> @request.restful()
>>>>>> def getActivity():
>>>>>>
>>>>>> def POST():
>>>>>>
>>>>>> data = "do Something"
>>>>>>
>>>>>> return json(data)
>>>>>>
>>>>>> return locals()
>>>>>>
>>>>>>
>>>>>> Here is my login API
>>>>>>
>>>>>>
>>>>>> @request.restful()
>>>>>&

Re: [web2py] Re: auth decorator with rest api

2018-04-14 Thread yogeshwar khalkar
The session cookie is being set and user record is being added to the
session upon login.
but it not being sent back and forth on each request.

Also, self.user is None before logout and logout event is not being added
to the auth_event table.

I am confused here with sending session back and forth.

I an using web2py with angular5, every operation is working using rest API,
web2py running on port 8000 and angular running on port 4200



‌

Thanks,
Yogeshwar

On Fri, Apr 13, 2018 at 7:39 PM, Anthony <abasta...@gmail.com> wrote:

> So, are both the login and subsequent requests all being made via Ajax
> from a browser? If so, confirm that the session cookie is being set and
> sent back and forth on each request, and confirm that the user record is
> being added to the session upon login.
>
>
> On Friday, April 13, 2018 at 12:27:35 AM UTC-4, yogeshwar khalkar wrote:
>>
>> For logging, I am using rest API
>>
>> @request.restful()
>> def login():
>> def POST():
>> fields = simplejson.loads(request.body.read())
>> user = super(Auth, auth).login(**fields)
>>
>> return json(user)
>> return locals()
>>
>>
>> I am using this api in angular so for calling getActivity
>>
>> *Angular code*
>>
>> this.http.get(this.baseurl+'workflow/getActivity/'+this.processId+'/'+this.id).subscribe(res=>{
>>   console.log(res);
>>
>> });
>>
>> this.http.post(this.baseurl+'workflow/getActivity',JSON.stringify(this.actdata)).subscribe(res=>{
>>   console.log(res);
>>
>> });
>>
>>
>> *rest api*
>>
>> @auth.requires_login()
>> @request.restful()
>> def getActivity():
>>
>> def GET(process, activity):
>>
>> data = "do Something"
>>
>> return json(data)
>>
>> def POST():
>>
>> fields = simplejson.loads(request.body.read())
>>
>>     data = "do Something"
>>
>> return json(data)
>>
>> return locals()
>>
>>
>> Thanks,
>> Yogeshwar
>>
>> On Fri, Apr 13, 2018 at 3:52 AM, Anthony wrote:
>>
>>> How are you (a) logging in and (b) making the calls to getActivity?
>>>
>>>
>>> On Thursday, April 12, 2018 at 8:55:02 AM UTC-4, yogeshwar khalkar wrote:
>>>>
>>>> Hi All,
>>>>
>>>>
>>>> I was implementing the @auth.requires_login() with @request.restful() but 
>>>> it not working.
>>>>
>>>> It redirects me every time even if I am login.
>>>>
>>>>
>>>> @auth.requires_login()
>>>> @request.restful()
>>>> def getActivity():
>>>>
>>>> def POST():
>>>>
>>>> data = "do Something"
>>>>
>>>> return json(data)
>>>>
>>>> return locals()
>>>>
>>>>
>>>> Here is my login API
>>>>
>>>>
>>>> @request.restful()
>>>> def login():
>>>> def POST():
>>>> fields = simplejson.loads(request.body.read())
>>>> user = super(Auth, auth).login(**fields)
>>>> return json(user)
>>>> return locals()
>>>>
>>>>
>>>> please help me with 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.
>>>
>>
>> --
> 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.
>

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


Re: [web2py] Re: auth decorator with rest api

2018-04-12 Thread yogeshwar khalkar
For logging, I am using rest API

@request.restful()
def login():
def POST():
fields = simplejson.loads(request.body.read())
user = super(Auth, auth).login(**fields)
return json(user)
return locals()


I am using this api in angular so for calling getActivity

*Angular code*

this.http.get(this.baseurl+'workflow/getActivity/'+this.processId+'/'+this.id).subscribe(res=>{
  console.log(res);

});

this.http.post(this.baseurl+'workflow/getActivity',JSON.stringify(this.actdata)).subscribe(res=>{
  console.log(res);

});


*rest api*

@auth.requires_login()
@request.restful()
def getActivity():

def GET(process, activity):

data = "do Something"

return json(data)

def POST():

fields = simplejson.loads(request.body.read())

data = "do Something"

return json(data)

return locals()


Thanks,
Yogeshwar

On Fri, Apr 13, 2018 at 3:52 AM, Anthony <abasta...@gmail.com> wrote:

> How are you (a) logging in and (b) making the calls to getActivity?
>
>
> On Thursday, April 12, 2018 at 8:55:02 AM UTC-4, yogeshwar khalkar wrote:
>>
>> Hi All,
>>
>>
>> I was implementing the @auth.requires_login() with @request.restful() but it 
>> not working.
>>
>> It redirects me every time even if I am login.
>>
>>
>> @auth.requires_login()
>> @request.restful()
>> def getActivity():
>>
>> def POST():
>>
>> data = "do Something"
>>
>> return json(data)
>>
>> return locals()
>>
>>
>> Here is my login API
>>
>>
>> @request.restful()
>> def login():
>> def POST():
>> fields = simplejson.loads(request.body.read())
>> user = super(Auth, auth).login(**fields)
>> return json(user)
>> return locals()
>>
>>
>> please help me with 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.
>

-- 
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] auth decorator with rest api

2018-04-12 Thread yogeshwar khalkar


Hi All,


I was implementing the @auth.requires_login() with @request.restful() but it 
not working.

It redirects me every time even if I am login.


@auth.requires_login()
@request.restful()
def getActivity(): 

def POST():

data = "do Something"

return json(data)

return locals()


Here is my login API


@request.restful()
def login():
def POST():
fields = simplejson.loads(request.body.read())
user = super(Auth, auth).login(**fields)
return json(user)
return locals()


please help me with 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.


Re: [web2py] Re: Sending emails from different email ids

2018-04-03 Thread yogeshwar khalkar
Thanks it solved my problem.
On Apr 3, 2018 5:17 PM, "Anthony" <abasta...@gmail.com> wrote:

> You can just dynamically set the values of the mail settings within each
> request (the mail settings do not have to be retrieved from the appconfig
> file).
>
> Anthony
>
> On Tuesday, April 3, 2018 at 4:01:26 AM UTC-4, yogeshwar khalkar wrote:
>>
>> Hi,
>>
>> I want to send email from different email IDs each time.
>>
>> I have configured 1 smtp email for sender in appconfig file & it's
>> working fine, But
>> i want to configure different email on user login.
>>
>> Please help me to solve the problem.
>>
> --
> 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.
>

-- 
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] Sending emails from different email ids

2018-04-03 Thread yogeshwar khalkar
Hi,

I want to send email from different email IDs each time.

I have configured 1 smtp email for sender in appconfig file & it's working 
fine, But 
i want to configure different email on user login.

Please help me to solve the problem. 

-- 
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] track email delivery

2018-03-26 Thread yogeshwar khalkar
Hi All,

I want to track the email delivery, Is there any way to do it using web2py.

Thanks for any 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.


Re: [web2py] Re: call to PUT restapi from angular

2018-03-13 Thread yogeshwar khalkar
Hi Leonel,

print request.env.request_method

prints -  "OPTIONS"

Thanks,
Yogeshwar

On Wed, Mar 14, 2018 at 2:19 AM, Val K  wrote:

> And keep in mind that 'return locals()' should be related to updateAgenda,
> not PUT + I think it should be PUT(id, **kw) because you pass additional
> payload, otherwise  you'll get 'bad request'
>
> --
> 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.
>

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


Re: [web2py] Re: call to PUT restapi from angular

2018-03-13 Thread yogeshwar khalkar
Still don't work.
It returns 405 method not found.
On Mar 13, 2018 7:00 PM, "Leonel Câmara"  wrote:

> You're missing a return locals()
>
>
> @request.restful()
> def updateAgenda():
>
> def PUT(id):
> data = json(request.body.read())
> ret = db(db.agenda.id 
> 
>  == id]).update(**data)
> return ret
> return locals() # the restful decorator uses this dictionary to get the 
> correct function for each method
>
> --
> 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.
>

-- 
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] call to PUT restapi from angular

2018-03-13 Thread yogeshwar khalkar
Hi,

I want to update table on PUT call from angular but, Angular PUT request is 
not recognised by Web2Py PUT restapi.


Here is angular code:

this.http.put('http://127.0.0.1:8000/automation/workflow/updateAgenda/'+this.id,
 
JSON.stringify(data)).subscribe(res=>{
console.log(res);
})


Here is Web2Py code:

@request.restful()
def updateAgenda():

def PUT(id):
data = json(request.body.read())
ret = db(db.agenda.id == id]).update(**data)
return ret



What I am doing wrong,

Please help me.





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


[web2py] how to use restapi for email verification

2018-02-07 Thread yogeshwar khalkar
My application is in angular 5 I want to write rest api in web2py to verify 
email on registration
This is my register api

@request.restful()
def register():
def GET(**fields):
user = auth.register_bare(**fields);
del user['password']
return json(user.id)


How can I write rest api for register with email verification

-- 
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] POST api return 405

2018-02-01 Thread yogeshwar khalkar
I have POST api in web2py I am accessing it using angular httpclient post 
service but, it returns 405(method not allow) error.

can anybody give me solution for it

Thanks

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


Re: [web2py] Re: web2py api call from angular 4

2018-01-22 Thread yogeshwar khalkar
Yes my angular app running on node.js server running on 4200

<https://www.avast.com/sig-email?utm_medium=email_source=link_campaign=sig-email_content=webmail>
Virus-free.
www.avast.com
<https://www.avast.com/sig-email?utm_medium=email_source=link_campaign=sig-email_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Tue, Jan 23, 2018 at 2:30 AM, Dave S <snidely@gmail.com> wrote:

>
>
> On Monday, January 22, 2018 at 4:57:34 AM UTC-8, yogeshwar khalkar wrote:
>>
>> Please help me,
>>
>>
>> When I am try to login from angular 4 app to web2py rest api browser
>> shows error like
>>
>> OPTIONS http://127.0.0.1:8000/csautomation/user/login 405 (METHOD NOT
>> ALLOWED)
>>
>> *AND*
>>
>> Failed to load http://127.0.0.1:8000/csautomation/user/login: Response
>> to preflight request doesn't pass access control check: No
>> 'Access-Control-Allow-Origin' header is present on the requested resource.
>> Origin 'http://localhost:4200' is therefore not allowed access. The
>> response had HTTP status code 405.
>>
>
> Just to clarify, you're supporting your Angular app with a node.js server
> running on port 4200, right?
>
>
>
>>
>> *here is my angular code*
>>
>> login(user): Promise{
>>   let url: string = `${this.BASE_URL}/login`;
>>   return this.http.post(url,user).toPromise();
>>   }
>>
>> *here my web2py api*
>>
>> @request.restful()
>> def login():
>> def POST(username, password):
>> user = auth.login_bare(username, password)
>> if user:
>> return json(user.id)
>> return user
>> return locals()
>>
>>
>> Thanks for any help
>>
>>
> /dps
>
>
> --
> 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.
>



-- 
Thanks/Regards
Yogeshwar

-- 
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] web2py api call from angular 4

2018-01-22 Thread yogeshwar khalkar
Please help me,


When I am try to login from angular 4 app to web2py rest api browser shows 
error like

OPTIONS http://127.0.0.1:8000/csautomation/user/login 405 (METHOD NOT 
ALLOWED)

*AND*

Failed to load http://127.0.0.1:8000/csautomation/user/login: Response to 
preflight request doesn't pass access control check: No 
'Access-Control-Allow-Origin' header is present on the requested resource. 
Origin 'http://localhost:4200' is therefore not allowed access. The 
response had HTTP status code 405.

*here is my angular code*

login(user): Promise{
  let url: string = `${this.BASE_URL}/login`;
  return this.http.post(url,user).toPromise();
  }

*here my web2py api*

@request.restful()
def login():
def POST(username, password):
user = auth.login_bare(username, password)
if user:
return json(user.id)
return user
return locals()


Thanks for any 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] comparison between foreign key id and name

2018-01-16 Thread yogeshwar khalkar
Hi,
Please help me with following.

I have created the api  I am passing company_name(string) to it, for select 
I am comparing reference Id to name.
I get the error 
 invalid literal for long() with base 10: 
'cadence'
at db.company_user.company == company_name
I actually don't know how to compare reference id to name.
 

@request.restful()
def company_user():
def GET(company_name, role=None):
company_user_ids = [u['auth_user'] for u in db(db.company_user.company 
== company_name
  ).select()]
query = db.auth_user.id.belongs(company_user_ids)
auth_users = db(query).select(db.auth_user.ALL)
return json(auth_users)
return locals()


Thanks.

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


Re: [web2py] Re: restapi for login

2018-01-16 Thread yogeshwar khalkar
Thanks Anthony
I have done this.

@request.restful()
def login():
def POST(username, password):
user = auth.login_bare(username, password)
return json(user)
return locals()


Its working fine for me.

But, am I doing it rigth.


On Mon, Jan 15, 2018 at 9:55 PM, Anthony <abasta...@gmail.com> wrote:

> Check out http://web2py.com/books/default/chapter/29/09/access-
> control#Manual-Authentication. Also, check out https://github.com/web2py/
> web2py/blob/623f3b99477eb97ffadb20d6f7cb3da398253c9c/gluon/authapi.py#L20,
> which Auth is built on top of.
>
> Anthony
>
>
> On Monday, January 15, 2018 at 10:16:38 AM UTC-5, yogeshwar khalkar wrote:
>>
>> Please help me to create restapi for login on auth_user table
>>
>> thanks in advance
>>
> --
> 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.
>

-- 
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] restapi for login

2018-01-15 Thread yogeshwar khalkar
Please help me to create restapi for login on auth_user table

thanks in advance

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