Re: [Trac] Re: Mandatory fields
(resolution : %s % ticket[resolution]) if ticket[resolution] == canceled - duplicate: if self._is_empty(ticket[duplicate]): errors.append((duplicate, ' cannot be empty.')) #errors=[(field_name, '%s must be an integer' % field_name) # for field_name in editcheck_fields # if self._is_not_integer(ticket[field_name])] #required_fields = self.config.getlist('ticketvalidator', # state + '.required') #errors = [(field_name, '%s is required' % field_name) # for field_name in required_fields # if self._is_empty(ticket[field_name])] return errors def _get_state(self, req, ticket): Get the state this ticket is going to be in. if 'action' not in req.args: return 'new' action = req.args['action'] action_changes = {} for controller in self._get_action_controllers(req, ticket, action): action_changes.update(controller.get_ticket_changes(req, ticket, action)) return 'status' in action_changes and action_changes['status'] or ticket['status'] def _get_action_controllers(self, req, ticket, action): for controller in TicketSystem(self.env).action_controllers: actions = [action for weight, action in controller.get_ticket_actions(req, ticket)] if action in actions: yield controller -Original Message- From: trac-...@googlegroups.com javascript: [mailto: trac-...@googlegroups.com javascript:] On Behalf Of yoheeb Sent: Tuesday, June 16, 2009 1:01 PM To: Trac Users Subject: [Trac] Re: Mandatory fields On Jun 10, 3:33 pm, Dan Winslow dwins...@aiminstitute.org wrote: You can use a couple different plugins. I wound up using TicketValidator plugin...although I had to modify it to do more than just check if the field was blank or not. -Original Message- From: trac-...@googlegroups.com javascript: [mailto: trac-...@googlegroups.com javascript:] On Behalf Of John Andrunas Sent: Wednesday, June 10, 2009 3:22 PM To: trac-...@googlegroups.com javascript: Subject: [Trac] Mandatory fields Is there any way to make mandatory fields in trac? I don't seen any way but it seems like the kind of thing that would be in there. -- John Any chance you could post these modifications to the hack as an attachment or something similiar? -- 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 http://groups.google.com/group/trac-users. For more options, visit https://groups.google.com/d/optout.
Re: [Trac] Re: Mandatory fields
in required_fields: field_name=field_name.lower() self.env.log.info(found required field name %s % field_name) flist = self.config.getlist('fieldscheck',field_name) if flist: self.env.log.info( found custom validate for %s type : %s value : %s % (field_name,flist[0],ticket[field_name])) if flist[0] == int: if self._is_not_integer(ticket[field_name]): errors.append((field_name, '%s must be an integer range %s to %s' % (field_name,flist[1],flist[2]))) elif flist[0] == date: if ticket[field_name]==click to set date or ticket[field_name]==: errors.append((field_name, '%s must be set to a date.' % field_name)) else: if self._is_empty(ticket[field_name]): errors.append((field_name, ' cannot be empty.')) else: if self._is_empty(ticket[field_name]): errors.append((field_name, ' cannot be empty.')) #this section does special validation based on resolution if state == closed: self.env.log.info(resolution : %s % ticket[resolution]) if ticket[resolution] == canceled - duplicate: if self._is_empty(ticket[duplicate]): errors.append((duplicate, ' cannot be empty.')) #errors=[(field_name, '%s must be an integer' % field_name) # for field_name in editcheck_fields # if self._is_not_integer(ticket[field_name])] #required_fields = self.config.getlist('ticketvalidator', # state + '.required') #errors = [(field_name, '%s is required' % field_name) # for field_name in required_fields # if self._is_empty(ticket[field_name])] return errors def _get_state(self, req, ticket): Get the state this ticket is going to be in. if 'action' not in req.args: return 'new' action = req.args['action'] action_changes = {} for controller in self._get_action_controllers(req, ticket, action): action_changes.update(controller.get_ticket_changes(req, ticket, action)) return 'status' in action_changes and action_changes['status'] or ticket['status'] def _get_action_controllers(self, req, ticket, action): for controller in TicketSystem(self.env).action_controllers: actions = [action for weight, action in controller.get_ticket_actions(req, ticket)] if action in actions: yield controller -Original Message- From: trac-...@googlegroups.com [mailto:trac-...@googlegroups.com] On Behalf Of yoheeb Sent: Tuesday, June 16, 2009 1:01 PM To: Trac Users Subject: [Trac] Re: Mandatory fields On Jun 10, 3:33 pm, Dan Winslow dwins...@aiminstitute.org wrote: You can use a couple different plugins. I wound up using TicketValidator plugin...although I had to modify it to do more than just check if the field was blank or not. -Original Message- From: trac-...@googlegroups.com [mailto:trac-...@googlegroups.com] On Behalf Of John Andrunas Sent: Wednesday, June 10, 2009 3:22 PM To: trac-...@googlegroups.com Subject: [Trac] Mandatory fields Is there any way to make mandatory fields in trac? I don't seen any way but it seems like the kind of thing that would be in there. -- John Any chance you could post these modifications to the hack as an attachment or something similiar? -- 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 http://groups.google.com/group/trac-users. For more options, visit https://groups.google.com/d/optout.
Re: [Trac] Re: Mandatory fields
: ticket[actual_hours]=0 ticket[estimate_hours]=0 ticket[date_due]= #this section validates based on required and type lookup tables errors=[] required_fields = self.config.getlist('ticketvalidator',state + '.required') for field_name in required_fields: field_name=field_name.lower() self.env.log.info(found required field name %s % field_name) flist = self.config.getlist('fieldscheck',field_name) if flist: self.env.log.info( found custom validate for %s type : %s value : %s % (field_name,flist[0],ticket[field_name])) if flist[0] == int: if self._is_not_integer(ticket[field_name]): errors.append((field_name, '%s must be an integer range %s to %s' % (field_name,flist[1],flist[2]))) elif flist[0] == date: if ticket[field_name]==click to set date or ticket[field_name]==: errors.append((field_name, '%s must be set to a date.' % field_name)) else: if self._is_empty(ticket[field_name]): errors.append((field_name, ' cannot be empty.')) else: if self._is_empty(ticket[field_name]): errors.append((field_name, ' cannot be empty.')) #this section does special validation based on resolution if state == closed: self.env.log.info(resolution : %s % ticket[resolution]) if ticket[resolution] == canceled - duplicate: if self._is_empty(ticket[duplicate]): errors.append((duplicate, ' cannot be empty.')) #errors=[(field_name, '%s must be an integer' % field_name) # for field_name in editcheck_fields # if self._is_not_integer(ticket[field_name])] #required_fields = self.config.getlist('ticketvalidator', # state + '.required') #errors = [(field_name, '%s is required' % field_name) # for field_name in required_fields # if self._is_empty(ticket[field_name])] return errors def _get_state(self, req, ticket): Get the state this ticket is going to be in. if 'action' not in req.args: return 'new' action = req.args['action'] action_changes = {} for controller in self._get_action_controllers(req, ticket, action): action_changes.update(controller.get_ticket_changes(req, ticket, action)) return 'status' in action_changes and action_changes['status'] or ticket['status'] def _get_action_controllers(self, req, ticket, action): for controller in TicketSystem(self.env).action_controllers: actions = [action for weight, action in controller.get_ticket_actions(req, ticket)] if action in actions: yield controller -Original Message- From: trac-...@googlegroups.com [mailto:trac-...@googlegroups.com] On Behalf Of yoheeb Sent: Tuesday, June 16, 2009 1:01 PM To: Trac Users Subject: [Trac] Re: Mandatory fields On Jun 10, 3:33 pm, Dan Winslow dwins...@aiminstitute.org wrote: You can use a couple different plugins. I wound up using TicketValidator plugin...although I had to modify it to do more than just check if the field was blank or not. -Original Message- From: trac-...@googlegroups.com [mailto:trac-...@googlegroups.com] On Behalf Of John Andrunas Sent: Wednesday, June 10, 2009 3:22 PM To: trac-...@googlegroups.com Subject: [Trac] Mandatory fields Is there any way to make mandatory fields in trac? I don't seen any way but it seems like the kind of thing that would be in there. -- John Any chance you could post these modifications to the hack as an attachment or something similiar? -- 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 http://groups.google.com/group/trac-users. For more options, visit https://groups.google.com/d/optout.
Re: [Trac] Re: Mandatory fields
On Friday, March 27, 2015 at 12:09:59 PM UTC-7, pineapplehandler wrote: I think I made some headway here. I removed ticketvalidator and deleted the plugin folders: easy_install -m ticketvalidator rm -rf TicketValidator-0.2* Then I downloaded the source as a .zip file and unpacked it: unzip ticketvalidatorplugin.zip cp ticketvalidatorplugin/11/0.11/ticketvalidator/ /usr/local/lib/python2.7 /dist-packages/ Then I installed it using the *develop* switch: cd /usr/local/lib/python2.7/dist-packages/ticketvalidator/ python setup.py develop Now I can make changes in core.py or admin.py and the changes take effect almost (*) immediately, rather than having to recompile a new core.pyc. I'm still struggling to understand how the From the docs http://pythonhosted.org//setuptools/setuptools.html#development-mode: It works very similarly to setup.py install or the EasyInstall tool, except that it doesn’t actually install anything. Instead, it creates a special .egg-link file in the deployment directory, that links to your project’s source code. (*) Sometimes I am able to modify and save changes to admin.py and hit refresh on my browser and see the changes. However when demonstrating this to a colleague, of course it stopped behaving that way and I had to bounce apache. Setting up the development environment is covered in TracDev/DevelopmentEnvironmentSetup. The easiest method for development is to run tracd with the -r flag. http://trac.edgewall.org/wiki/TracDev/DevelopmentEnvironmentSetup -- 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 http://groups.google.com/group/trac-users. For more options, visit https://groups.google.com/d/optout.
Re: [Trac] Re: Mandatory fields
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 27.03.2015 20:13, pineapplehandler wrote: continuing: I'm still struggling to understand how the... [fieldscheck] and [ticketvalidator] entries in trac.ini are passing their values to the code, but I think all I need is some time to understand it. Generally you should rather write below previous message's text. Avoid top-posting, because it effectively ruins reading flow (top-down for most languages). On you current topic: There are definitions you can use to establish know configuration options. Look at Option and friend in trac.config. Furthermore you'll find many examples, where options are declare in a plugin class. These options are then made class attributes, and you can read their current value by calling either self.option_name or self.config.get(section, option_name) Note that configuration changes applied permanently will trigger Trac environment reload (incl. configuration). Hope, this will get you make it a bit easier for you. Steffen Hoffmann -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAlUVxxUACgkQ31DJeiZFuHczNgCfX+krHwKFYM+nRhkBnfw4+ul0 C+QAn1OBaZMd63n3YYP0WiiNPPJl5rF0 =Xwax -END PGP SIGNATURE- -- 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 http://groups.google.com/group/trac-users. For more options, visit https://groups.google.com/d/optout.
Re: [Trac] Re: Mandatory fields
On Friday, March 27, 2015 at 12:13:29 PM UTC-7, pineapplehandler wrote: continuing: I'm still struggling to understand how the... [fieldscheck] and [ticketvalidator] entries in trac.ini are passing their values to the code, but I think all I need is some time to understand it. There are many ticket validation plugin on trac-hacks.org, and one of them may already do what you want. It might be more efficient to open a new thread on trac-users and describe what you want to do - someone may suggestion a plugin that will fit your needs. -- 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 http://groups.google.com/group/trac-users. For more options, visit https://groups.google.com/d/optout.
[Trac] Re: Mandatory fields
' % field_name) # for field_name in required_fields # if self._is_empty(ticket[field_name])] return errors def _get_state(self, req, ticket): Get the state this ticket is going to be in. if 'action' not in req.args: return 'new' action = req.args['action'] action_changes = {} for controller in self._get_action_controllers(req, ticket, action): action_changes.update(controller.get_ticket_changes(req, ticket, action)) return 'status' in action_changes and action_changes['status'] or ticket['status'] def _get_action_controllers(self, req, ticket, action): for controller in TicketSystem(self.env).action_controllers: actions = [action for weight, action in controller.get_ticket_actions(req, ticket)] if action in actions: yield controller -Original Message- From: trac-users@googlegroups.com [mailto:trac-us...@googlegroups.com] On Behalf Of yoheeb Sent: Tuesday, June 16, 2009 1:01 PM To: Trac Users Subject: [Trac] Re: Mandatory fields On Jun 10, 3:33 pm, Dan Winslow dwins...@aiminstitute.org wrote: You can use a couple different plugins. I wound up using TicketValidator plugin...although I had to modify it to do more than just check if the field was blank or not. -Original Message- From: trac-users@googlegroups.com [mailto:trac-us...@googlegroups.com] On Behalf Of John Andrunas Sent: Wednesday, June 10, 2009 3:22 PM To: trac-users@googlegroups.com Subject: [Trac] Mandatory fields Is there any way to make mandatory fields in trac? I don't seen any way but it seems like the kind of thing that would be in there. -- John Any chance you could post these modifications to the hack as an attachment or something similiar? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Trac Users group. To post to this group, send email to trac-users@googlegroups.com To unsubscribe from this group, send email to trac-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/trac-users?hl=en -~--~~~~--~~--~--~---
[Trac] Re: Mandatory fields
You can use a couple different plugins. I wound up using TicketValidator plugin...although I had to modify it to do more than just check if the field was blank or not. -Original Message- From: trac-users@googlegroups.com [mailto:trac-us...@googlegroups.com] On Behalf Of John Andrunas Sent: Wednesday, June 10, 2009 3:22 PM To: trac-users@googlegroups.com Subject: [Trac] Mandatory fields Is there any way to make mandatory fields in trac? I don't seen any way but it seems like the kind of thing that would be in there. -- John --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Trac Users group. To post to this group, send email to trac-users@googlegroups.com To unsubscribe from this group, send email to trac-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/trac-users?hl=en -~--~~~~--~~--~--~---
[Trac] Re: Mandatory fields
Thank you very much, this looks like it should work nicely. On Wed, Jun 10, 2009 at 1:33 PM, Dan Winslow dwins...@aiminstitute.org wrote: You can use a couple different plugins. I wound up using TicketValidator plugin...although I had to modify it to do more than just check if the field was blank or not. -Original Message- From: trac-users@googlegroups.com [mailto:trac-us...@googlegroups.com] On Behalf Of John Andrunas Sent: Wednesday, June 10, 2009 3:22 PM To: trac-users@googlegroups.com Subject: [Trac] Mandatory fields Is there any way to make mandatory fields in trac? I don't seen any way but it seems like the kind of thing that would be in there. -- John -- John --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Trac Users group. To post to this group, send email to trac-users@googlegroups.com To unsubscribe from this group, send email to trac-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/trac-users?hl=en -~--~~~~--~~--~--~---
[Trac] Re: Mandatory Fields
Hi. Noah Kantrowitz wrote: SpamFilter Obviously, should have had that idea myself :) Thanks for the hint. Bye, Mike --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Trac Users group. To post to this group, send email to trac-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/trac-users -~--~~~~--~~--~--~---
[Trac] Re: Mandatory Fields
Hi. Noah Kantrowitz wrote: You can write a plugin that implements ITicketManipulator. They can reject tickets that don't pass your tests. That sounds interesting and could be useful for an idea I have in mind. Is there an example plugin available that takes this road? Bye, Mike --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Trac Users group. To post to this group, send email to trac-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/trac-users -~--~~~~--~~--~--~---