def clone(self, r, **attr):

        s3db = current.s3db

        # Get the alert ID
        alert_id = self.record_id
        if not alert_id:
            # Must be called for a particular alert
            r.error(404, current.ERROR.BAD_RECORD)

        alert_table = s3db.cap_alert
        # Get the person ID
        auth = current.auth
        person_id = auth.s3_logged_in_person()
        if not person_id or not auth.s3_has_permission("create", alert_table):
            auth.permission.fail()

        msg_type_options = ["Alert", "Update", "Cancel", "Error", "AllClear"]
        msg_type = current.request._get_vars["msg_type"]

        if msg_type is None or msg_type not in msg_type_options:
            r.error(400, current.ERROR.BAD_REQUEST)

        # Start of clone
        db = current.db
        info_table = s3db.cap_info
        area_table = s3db.cap_area
        location_table = s3db.cap_area_location
        tag_table = s3db.cap_area_tag
        resource_table = s3db.cap_resource
        unwanted_fields = s3fields.s3_all_meta_field_names()
        unwanted_fields.extend(["id", "doc_id"])
        unwanted_fields = set(unwanted_fields)
        accessible_query = auth.s3_accessible_query
        has_permission = auth.s3_has_permission
        audit = current.audit
        set_record_owner = auth.s3_set_record_owner
        onaccept = s3db.onaccept

        # Copy the alert segment
        alert_fields = [alert_table[f] for f in alert_table.fields
                        if f not in unwanted_fields]
        alert_query = (alert_table.id == alert_id) & \
                      accessible_query("read", alert_table)
        alert_row = db(alert_query).select(*alert_fields, limitby=(0, 1)).first()
        alert_row_clone = alert_row.as_dict()
        del alert_row_clone["identifier"]
        alert_row_clone["msg_type"] = msg_type
        alert_row_clone["reference"] = ("%s,%s,%s") % (alert_row.sender,
                                                       alert_row.identifier,
                                str(s3_utc(alert_row.sent)).replace(" ", "T"),
                                                       )

        new_alert_id = alert_table.insert(**alert_row_clone)
        # Post-process create
        alert_row_clone["id"] = new_alert_id
        audit("create", "cap", "alert", record=new_alert_id)
        set_record_owner(alert_table, new_alert_id)
        onaccept(alert_table, alert_row_clone)

        if has_permission("create", info_table):
            # Copy the info segment
            unwanted_fields_ = list(unwanted_fields)
            unwanted_fields_.remove("id")
            info_fields = [info_table[f] for f in info_table.fields
                           if f not in unwanted_fields_]
            info_query = (info_table.alert_id == alert_id) &\
                         accessible_query("read", info_table)
            info_rows = db(info_query).select(*info_fields)
            if info_rows:
                for info_row in info_rows:
                    info_id = info_row.id
                    info_row_clone = info_row.as_dict()
                    del info_row_clone["id"]
                    if msg_type == "AllClear":
                        info_row_clone["response_type"] = "AllClear"
                    info_row_clone["alert_id"] = new_alert_id
                    new_info_id = info_table.insert(**info_row_clone)
                    # Post-process create
                    info_row_clone["id"] = new_info_id
                    audit("create", "cap", "info", record=new_info_id)
                    set_record_owner(info_table, new_info_id)
                    onaccept(info_table, info_row_clone)
        if has_permission("create", area_table):
            # Copy the area segment
            area_fields = [area_table[f] for f in area_table.fields
                           if f not in unwanted_fields_]
            area_query = (area_table.alert_id == alert_id) & \
                         accessible_query("read", area_table)
            area_rows = db(area_query).select(*area_fields)
            if area_rows:
                gtable = s3db.gis_location
                onvalidation = s3db.onvalidation
                area_table_insert = area_table.insert

                location_table_insert = location_table.insert
                location_accessible = accessible_query("read", location_table)
                location_fields = [location_table[f] for f in location_table.fields
                                   if f not in unwanted_fields]

                tag_table_insert = tag_table.insert
                tag_accessible = accessible_query("read", tag_table)
                tag_fields = [tag_table[f] for f in tag_table.fields
                              if f not in unwanted_fields]

                for area_row in area_rows:
                    area_id = area_row.id
                    area_row_clone = area_row.as_dict()
                    del area_row_clone["id"]
                    area_row_clone["alert_id"] = new_alert_id

                    new_area_id = area_table_insert(**area_row_clone)
                    # Post-process create
                    area_row_clone["id"] = new_area_id
                    audit("create", "cap", "area", record=new_area_id)
                    set_record_owner(area_table, new_area_id)
                    onaccept(area_table, area_row_clone)

                    # Copy the area_location
                    location_query = (location_table.area_id == area_id) &\
                                     location_accessible
                    location_rows = db(location_query).\
                                        select(*location_fields)
                    if location_rows:
                        for location_row in location_rows:
                            location_row_clone = location_row.as_dict()
                            location_row_clone.update(alert_id = new_alert_id,
                                                      area_id = new_area_id)
                            onvalidation(gtable, location_row_clone)
                            new_location_id = location_table_insert(**location_row_clone)
                            # Post-process create
                            location_row_clone["id"] = new_location_id
                            audit("create", "cap", "area_location",
                                  record=new_location_id)
                            set_record_owner(location_table,
                                             new_location_id)
                            onaccept(location_table,
                                     location_row_clone)

                    # Copy the area_tag
                    tag_query = (tag_table.area_id == area_id) &\
                                tag_accessible
                    tag_rows = db(tag_query).select(*tag_fields)
                    for tag_row in tag_rows:
                        tag_row_clone = tag_row.as_dict()
                        tag_row_clone.update(alert_id = new_alert_id,
                                             area_id = new_area_id)

                        new_tag_id = tag_table_insert(**tag_row_clone)
                        # Post-process create
                        tag_row_clone["id"] = new_tag_id
                        audit("create", "cap", "area_tag",
                              record=new_tag_id)
                        set_record_owner(tag_table, new_tag_id)
                        onaccept(tag_table, tag_row_clone)
        if has_permission("create", resource_table):
            # Copy the resource segment
            resource_fields = [resource_table[f] for f in resource_table.fields
                               if f not in unwanted_fields]
            resource_query = (resource_table.alert_id == alert_id) &\
                             accessible_query("read", resource_table)
            resource_rows = db(resource_query).select(*resource_fields)
            if resource_rows:
                resource_table_insert = resource_table.insert
                update_super = s3db.update_super
                for resource_row in resource_rows:
                    resource_row_clone = resource_row.as_dict()
                    resource_row_clone["alert_id"] = new_alert_id
                    rid = resource_table_insert(**resource_row_clone)
                    resource_row_clone["id"] = rid
                    # Post-process create
                    audit("create", "cap", "resource", record=rid)
                    update_super(resource_table, resource_row_clone)
                    set_record_owner(resource_table, rid)
                    onaccept(resource_table, resource_row_clone)
            

        output = current.xml.json_message(message=new_alert_id)
        current.response.headers["Content-Type"] = "application/json"
        return output

# -----------------------------------------------------------------------------
Find all the sassycss files and set their relative deploy path.
dataset/ETHPy150Open sahana/eden/modules/s3db/cap.py/cap_CloneAlert.clone--crossover with--dataset/ETHPy150Open hyde/hyde/hyde/ext/plugins/css.py/SassyCSSPlugin.begin_site