[Trac] Re: Post request. Ticket does not change .

2017-05-02 Thread RjOllos


On Tuesday, May 2, 2017 at 12:46:32 PM UTC-7, Гордон Шамвей wrote:
>
> Hello.
>  I want to change the card component automatically using the post request in 
> the python.
>  I tried everything I could and knew.
>  But  trac gives me just only that (in any version of my code):
>
>  This ticket has been modified since you started editing. You should review
>>  the other modifications which have been appended above, and any conflicts
>>  shown in the preview below. You can nevertheless proceed and submit your
>>  changes if you wish so.
>
>
> I know for sure:  no one changed it. 
>
>  I'm at a loss. Can you help me?
>  # _*_ coding:utf-8 _*_
>  #!/usr/bin/python
>  import requests
>  from requests.auth import HTTPDigestAuth
>  from requests.auth import HTTPBasicAuth
>  import time
>  def payload2(hed):
>  payload={\
>  "__FORM_TOKEN" : hed,\
>  "__EDITOR__1" : "textarea",\
>  "comment" : "test",\
>  "field_summary" : "test",\
>  "__EDITOR__2" : "textarea",\
>  "field_description" : "",\
>  "field_type" : u"info",\
>  "field_priority" : "major",\
>  "field_milestone" : "",\
>  "field_component" : u"Info",\
>  "field_keywords" : "",\
>  "field_cc" : "",\
>  "action" : "leave",\
>  "start_time" : str(current_time),\
>  "view_time" : str(current_time),\
>  "replyto" : "",\
>  "submit" : "Submit+changes"\
>   }
>  return payload
>  current_time = int(time.time()*100)
>  URL = "http://trac.bla-bla.com/ticket/91279";
>  with requests.Session() as s:
>  s = requests.Session()
>  s.auth= ('user', 'password')
>  login = s.get(URL)
>  s.cookies = login.cookies
>  hed =   login.cookies["trac_form_token"]
>  hed = str(hed)
>  pay = payload2(hed)
>  ttt = requests.utils.dict_from_cookiejar(login.cookies)
>  print_text =  s.post(URL,  data=pay, cookies=ttt)
>  print  unicode(print_text.text).encode('utf8')
>  print print_text.cookies
>  print requests.utils.dict_from_cookiejar(login.cookies)
>
>  But ticket does not change. 
>

You'll need to know the ticket changetime:
https://trac.edgewall.org/browser/tags/trac-1.2.1/trac/ticket/web_ui.py?marks=1297,1298#L1295
It's a hidden field of the ticket page.

Have you considered using XmlRpcPlugin?

https://trac-hacks.org/wiki/XmlRpcPlugin

- Ryan

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to trac-users+unsubscr...@googlegroups.com.
To post to this group, send email to trac-users@googlegroups.com.
Visit this group at https://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.


Re: [Trac] Custom policies

2017-05-02 Thread RjOllos


On Tuesday, May 2, 2017 at 1:34:07 PM UTC-7, toto200891 wrote:
>
> I tried adding as [trac] permission_policies = Supportdeskpolicy,... But 
> it produced this error 'component Ipermission policy must be enabled.
>

Please let us know what you [trac] permission_policies was before making 
the edit.

Please also share your [components] section.

- Ryan 

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to trac-users+unsubscr...@googlegroups.com.
To post to this group, send email to trac-users@googlegroups.com.
Visit this group at https://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.


Re: [Trac] Custom policies

2017-05-02 Thread toto200891
I tried adding as [trac] permission_policies = Supportdeskpolicy,... But it 
produced this error 'component Ipermission policy must be enabled.


On Tuesday, May 2, 2017 at 7:48:18 PM UTC+2, RjOllos wrote:
>
>
>
> On Tue, May 2, 2017 at 7:28 AM toto200891  > wrote:
>
>> I have also granted permissions like TICKET_APPEND, TICKET_CHGPROP, and 
>> TICKET_MODIFY, as mentioned in the following recipe 
>> https://trac.edgewall.org/wiki/CookBook/PermissionPolicies#SupportDeskPolicy
>>
>> Regards,
>> SF
>>
>
> What is your [trac] permission_policies setting?
>
> - Ryan 
>

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to trac-users+unsubscr...@googlegroups.com.
To post to this group, send email to trac-users@googlegroups.com.
Visit this group at https://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.


[Trac] post request. Ticket does not change .

2017-05-02 Thread Гордон Шамвей
Hey.
 I want to change the card component automatically using the post request
 in the python.
 I tried everything I could.
 But  trac gives me just only that:

 {{{
>  This ticket has been modified since you started editing. You should review
>  the other modifications which have been appended above, and any conflicts
>  shown in the preview below. You can nevertheless proceed and submit your
>  changes if you wish so.
>  }}}


 Can you help me?

 that is my code



 
 
# _*_ coding:utf-8 _*_
 #!/usr/bin/python
 import requests
 from requests.auth import HTTPDigestAuth
 from requests.auth import HTTPBasicAuth
 import time
 def payload2(hed):
 payload={\
 "__FORM_TOKEN" : hed,\
 "__EDITOR__1" : "textarea",\
 "comment" : "test",\
 "field_summary" : "test",\
 "__EDITOR__2" : "textarea",\
 "field_description" : "",\
 "field_type" : u"info",\
 "field_priority" : "major",\
 "field_milestone" : "",\
 "field_component" : u"Info",\
 "field_keywords" : "",\
 "field_cc" : "",\
 "action" : "leave",\
 "start_time" : str(current_time),\
 "view_time" : str(current_time),\
 "replyto" : "",\
 "submit" : "Submit+changes"\
  }
 return payload
 current_time = int(time.time()*100)
 headers = {"__FORM_TOKEN" : u"c7b5686979628b866c10e354"}
 URL = "http://trac.bla-bla.com/ticket/91279";
 with requests.Session() as s:
 s = requests.Session()
 s.auth= ('user', 'password')
 login = s.get(URL)
 s.cookies = login.cookies
 hed =   login.cookies["trac_form_token"]
 hed = str(hed)
 pay = payload2(hed)
 ttt = requests.utils.dict_from_cookiejar(login.cookies)
 print_text =  s.post(URL,  data=pay, cookies=ttt)
 print  unicode(print_text.text).encode('utf8')
 print print_text.cookies
 print requests.utils.dict_from_cookiejar(login.cookies)



 

 But ticket do not change

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to trac-users+unsubscr...@googlegroups.com.
To post to this group, send email to trac-users@googlegroups.com.
Visit this group at https://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.


[Trac] Post request. Ticket does not change .

2017-05-02 Thread Гордон Шамвей
Hello.
 I want to change the card component automatically using the post request in 
the python.
 I tried everything I could and knew.
 But  trac gives me just only that (in any version of my code):

 This ticket has been modified since you started editing. You should review
>  the other modifications which have been appended above, and any conflicts
>  shown in the preview below. You can nevertheless proceed and submit your
>  changes if you wish so.


I know for sure:  no one changed it. 

 I'm at a loss. Can you help me?
 # _*_ coding:utf-8 _*_
 #!/usr/bin/python
 import requests
 from requests.auth import HTTPDigestAuth
 from requests.auth import HTTPBasicAuth
 import time
 def payload2(hed):
 payload={\
 "__FORM_TOKEN" : hed,\
 "__EDITOR__1" : "textarea",\
 "comment" : "test",\
 "field_summary" : "test",\
 "__EDITOR__2" : "textarea",\
 "field_description" : "",\
 "field_type" : u"info",\
 "field_priority" : "major",\
 "field_milestone" : "",\
 "field_component" : u"Info",\
 "field_keywords" : "",\
 "field_cc" : "",\
 "action" : "leave",\
 "start_time" : str(current_time),\
 "view_time" : str(current_time),\
 "replyto" : "",\
 "submit" : "Submit+changes"\
  }
 return payload
 current_time = int(time.time()*100)
 URL = "http://trac.bla-bla.com/ticket/91279";
 with requests.Session() as s:
 s = requests.Session()
 s.auth= ('user', 'password')
 login = s.get(URL)
 s.cookies = login.cookies
 hed =   login.cookies["trac_form_token"]
 hed = str(hed)
 pay = payload2(hed)
 ttt = requests.utils.dict_from_cookiejar(login.cookies)
 print_text =  s.post(URL,  data=pay, cookies=ttt)
 print  unicode(print_text.text).encode('utf8')
 print print_text.cookies
 print requests.utils.dict_from_cookiejar(login.cookies)

 But ticket does not change. 
 

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to trac-users+unsubscr...@googlegroups.com.
To post to this group, send email to trac-users@googlegroups.com.
Visit this group at https://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.


Re: [Trac] Custom policies

2017-05-02 Thread Ryan Ollos
On Tue, May 2, 2017 at 7:28 AM toto200891 
wrote:

> I have also granted permissions like TICKET_APPEND, TICKET_CHGPROP, and
> TICKET_MODIFY, as mentioned in the following recipe
> https://trac.edgewall.org/wiki/CookBook/PermissionPolicies#SupportDeskPolicy
>
> Regards,
> SF
>

What is your [trac] permission_policies setting?

- Ryan

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to trac-users+unsubscr...@googlegroups.com.
To post to this group, send email to trac-users@googlegroups.com.
Visit this group at https://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.


Re: [Trac] Custom policies

2017-05-02 Thread Ryan Ollos
On Tue, May 2, 2017 at 6:59 AM Steffen Hoffmann  wrote:

> Am 2. Mai 2017 14:06:31 MESZ schrieb toto200891 <
> syedfarathsay...@gmail.com>:
> >Hello,
> >
> >I have a question related to custom policies. I am trying to define a
> >permission that allows a user to view the tickets only reported by him.
> >I
> >followed the steps in
> >
> https://trac.edgewall.org/wiki/CookBook/PermissionPolicies#SupportDeskPolicy
> >
> >and created a egg file using setuptools and copied the egg file in
> >plugin
> >directory
> >
> >and also granted the permission TICKET_VIEW_REPORTED
> >
> >But I still see that the user can see the tickets created by other
> >users
> >and also modify it, though the permission like TICKET_VIEW is been
> >revoked
> >from that user.
>
> Are you sure, the user in question owns no other TICKET_* permission, that
> inherits TICKET_VIEW? Even if you checked this yourself, I would rather
> double-check that before looking at your custom permission policy
> implementation.
>
> Greetings,
>
> Steffen Hoffmann
>

Hello Steffen!

Good to hear from you, and welcome back to the mailing list. I hope you are
doing well.

- Ryan

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to trac-users+unsubscr...@googlegroups.com.
To post to this group, send email to trac-users@googlegroups.com.
Visit this group at https://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.


Re: [Trac] Custom policies

2017-05-02 Thread toto200891
I have also granted permissions like TICKET_APPEND, TICKET_CHGPROP, and 
TICKET_MODIFY, as mentioned in the following recipe 
https://trac.edgewall.org/wiki/CookBook/PermissionPolicies#SupportDeskPolicy

Regards,
SF

On Tuesday, May 2, 2017 at 3:59:28 PM UTC+2, hasienda wrote:
>
> Am 2. Mai 2017 14:06:31 MESZ schrieb toto200891  >: 
> >Hello, 
> > 
> >I have a question related to custom policies. I am trying to define a 
> >permission that allows a user to view the tickets only reported by him. 
> >I 
> >followed the steps in 
> >
> https://trac.edgewall.org/wiki/CookBook/PermissionPolicies#SupportDeskPolicy 
> > 
> >and created a egg file using setuptools and copied the egg file in 
> >plugin 
> >directory 
> > 
> >and also granted the permission TICKET_VIEW_REPORTED 
> > 
> >But I still see that the user can see the tickets created by other 
> >users 
> >and also modify it, though the permission like TICKET_VIEW is been 
> >revoked 
> >from that user. 
>
> Are you sure, the user in question owns no other TICKET_* permission, that 
> inherits TICKET_VIEW? Even if you checked this yourself, I would rather 
> double-check that before looking at your custom permission policy 
> implementation. 
>
> Greetings, 
>
> Steffen Hoffmann 
>

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to trac-users+unsubscr...@googlegroups.com.
To post to this group, send email to trac-users@googlegroups.com.
Visit this group at https://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.


Re: [Trac] Custom policies

2017-05-02 Thread Steffen Hoffmann
Am 2. Mai 2017 14:06:31 MESZ schrieb toto200891 :
>Hello,
>
>I have a question related to custom policies. I am trying to define a 
>permission that allows a user to view the tickets only reported by him.
>I 
>followed the steps in 
>https://trac.edgewall.org/wiki/CookBook/PermissionPolicies#SupportDeskPolicy
>
>and created a egg file using setuptools and copied the egg file in
>plugin 
>directory
>
>and also granted the permission TICKET_VIEW_REPORTED 
>
>But I still see that the user can see the tickets created by other
>users 
>and also modify it, though the permission like TICKET_VIEW is been
>revoked 
>from that user.

Are you sure, the user in question owns no other TICKET_* permission, that 
inherits TICKET_VIEW? Even if you checked this yourself, I would rather 
double-check that before looking at your custom permission policy 
implementation.

Greetings,

Steffen Hoffmann

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to trac-users+unsubscr...@googlegroups.com.
To post to this group, send email to trac-users@googlegroups.com.
Visit this group at https://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.


[Trac] Custom policies

2017-05-02 Thread toto200891
Hello,

I have a question related to custom policies. I am trying to define a 
permission that allows a user to view the tickets only reported by him. I 
followed the steps in 
https://trac.edgewall.org/wiki/CookBook/PermissionPolicies#SupportDeskPolicy 
and created a egg file using setuptools and copied the egg file in plugin 
directory

and also granted the permission TICKET_VIEW_REPORTED 

But I still see that the user can see the tickets created by other users 
and also modify it, though the permission like TICKET_VIEW is been revoked 
from that user.

Is there anything am missing out? any help is appreciated.

Regards,
SF

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to trac-users+unsubscr...@googlegroups.com.
To post to this group, send email to trac-users@googlegroups.com.
Visit this group at https://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.