コード例 #1
0
    def migrate_schema_fields(self):
        timezone = str(self.old.start_date.tzinfo) \
            if self.old.start_date.tzinfo \
            else default_timezone(fallback='UTC')

        # Customização timezone inicia aqui
        self.new.timezone = timezone
        # Customização timezone finaliza aqui

        self.new.start = datetime_fixer(self.old.start_date, timezone)
        self.new.end = datetime_fixer(self.old.end_date, timezone)

        if hasattr(self.old, 'location'):
            self.new.location = self.old.location
        if hasattr(self.old, 'attendees'):
            # Customização attendess inicia aqui
            # self.new.attendees = tuple(self.old.attendees.splitlines())
            if self.old.attendees:
                self.new.attendees = tuple(self.old.attendees.splitlines())
            else:
                self.new.attendees = tuple()
            # Customização attendess finalizada
        if hasattr(self.old, 'event_url'):
            self.new.event_url = self.old.event_url
        if hasattr(self.old, 'contact_name'):
            self.new.contact_name = self.old.contact_name
        if hasattr(self.old, 'contact_email'):
            self.new.contact_email = self.old.contact_email
        if hasattr(self.old, 'contact_phone'):
            self.new.contact_phone = self.old.contact_phone
        if hasattr(self.old, 'text'):
            # Copy the entire richtext object, not just it's representation
            self.new.text = self.old.text
コード例 #2
0
ファイル: patches.py プロジェクト: fzans/brasil.gov.portal
    def migrate_schema_fields(self):
        timezone = str(self.old.start_date.tzinfo) \
            if self.old.start_date.tzinfo \
            else default_timezone(fallback='UTC')

        # Customização timezone inicia aqui
        self.new.timezone = timezone
        # Customização timezone finaliza aqui

        self.new.start = datetime_fixer(self.old.start_date, timezone)
        self.new.end = datetime_fixer(self.old.end_date, timezone)

        if hasattr(self.old, 'location'):
            self.new.location = self.old.location
        if hasattr(self.old, 'attendees'):
            # Customização attendess inicia aqui
            # self.new.attendees = tuple(self.old.attendees.splitlines())
            if self.old.attendees:
                self.new.attendees = tuple(self.old.attendees.splitlines())
            else:
                self.new.attendees = tuple()
            # Customização attendess finalizada
        if hasattr(self.old, 'event_url'):
            self.new.event_url = self.old.event_url
        if hasattr(self.old, 'contact_name'):
            self.new.contact_name = self.old.contact_name
        if hasattr(self.old, 'contact_email'):
            self.new.contact_email = self.old.contact_email
        if hasattr(self.old, 'contact_phone'):
            self.new.contact_phone = self.old.contact_phone
        if hasattr(self.old, 'text'):
            # Copy the entire richtext object, not just it's representation
            self.new.text = self.old.text
コード例 #3
0
 def migrate_schema_fields(self):
     self.new.start = datetime_fixer(self.old.start, self.old.timezone)
     self.new.end = datetime_fixer(self.old.end, self.old.timezone)
     self.new.whole_day = self.old.whole_day
     self.new.open_end = self.old.open_end
     self.new.recurrence = self.old.recurrence
     self.new.location = self.old.location
     self.new.attendees = self.old.attendees
     self.new.event_url = self.old.event_url
     self.new.contact_name = self.old.contact_name
     self.new.contact_email = self.old.contact_email
     self.new.contact_phone = self.old.contact_phone
     # The old behavior for the rich text field does not exist an more.
     # Look up the old value directly from the Annotation storage
     # Copy the entire richtext object, not just it's representation
     annotations = IAnnotations(self.old)
     old_text = annotations.get(
         'plone.app.event.dx.behaviors.IEventSummary.text', None)
     self.new.text = old_text
コード例 #4
0
 def migrate_schema_fields(self):
     self.new.start = datetime_fixer(self.old.start, self.old.timezone)
     self.new.end = datetime_fixer(self.old.end, self.old.timezone)
     self.new.whole_day = self.old.whole_day
     self.new.open_end = self.old.open_end
     self.new.recurrence = self.old.recurrence
     self.new.location = self.old.location
     self.new.attendees = self.old.attendees
     self.new.event_url = self.old.event_url
     self.new.contact_name = self.old.contact_name
     self.new.contact_email = self.old.contact_email
     self.new.contact_phone = self.old.contact_phone
     # The old behavior for the rich text field does not exist an more.
     # Look up the old value directly from the Annotation storage
     # Copy the entire richtext object, not just it's representation
     annotations = IAnnotations(self.old)
     old_text = annotations.get(
         'plone.app.event.dx.behaviors.IEventSummary.text', None)
     self.new.text = old_text