def updateRegistrationStatus(self, saveMethod=False):
logger.debug('<STR_LIT>' % saveMethod)<EOL>modified = False<EOL>open = self.registrationOpen<EOL>startTime = self.startTime or getattr(self.eventoccurrence_set.order_by('<STR_LIT>').first(),'<STR_LIT>',None)<EOL>endTime = self.endTime or getattr(self.eventoccurrence_set.order_by('<STR_LIT>').first(),'<STR_LIT>',None)<EOL>force_closed_codes = [<EOL>self.RegStatus.disabled,<EOL>self.RegStatus.heldClosed,<EOL>self.RegStatus.regHidden,<EOL>self.RegStatus.hidden<EOL>]<EOL>force_open_codes = [<EOL>self.RegStatus.heldOpen,<EOL>]<EOL>automatic_codes = [<EOL>self.RegStatus.enabled,<EOL>self.RegStatus.linkOnly,<EOL>]<EOL>if (self.status in force_closed_codes or not self.pricingTier) and open is True:<EOL><INDENT>open = False<EOL>modified = True<EOL><DEDENT>elif not self.pricingTier:<EOL><INDENT>open = False<EOL>modified = False<EOL><DEDENT>elif (self.status in force_open_codes and self.pricingTier) and open is False:<EOL><INDENT>open = True<EOL>modified = True<EOL><DEDENT>elif (<EOL>startTime and self.status in automatic_codes and ((<EOL>self.closeAfterDays and timezone.now() > startTime + timedelta(days=self.closeAfterDays)) or<EOL>timezone.now() > endTime) and open is True):<EOL><INDENT>open = False<EOL>modified = True<EOL><DEDENT>elif startTime and self.status in automatic_codes and ((<EOL>timezone.now() < endTime and not self.closeAfterDays) or (<EOL>self.closeAfterDays and timezone.now() < startTime + timedelta(days=self.closeAfterDays))) and open is False:<EOL><INDENT>open = True<EOL>modified = True<EOL><DEDENT>if modified and not saveMethod:<EOL><INDENT>logger.debug('<STR_LIT>' % open)<EOL>self.registrationOpen = open<EOL>self.save(fromUpdateRegistrationStatus=True)<EOL><DEDENT>logger.debug('<STR_LIT>' % open)<EOL>return (modified, open)<EOL>
If called via cron job or otherwise, then update the registrationOpen
property for this series to reflect any manual override and/or the automatic
closing of this series for registration.