a
    Od                     @   sh   d dl mZ d dlZd dlZd dlZd dlZd dlZdd Zdd Zdd Z	d	d
 Z
dd Zdd ZdS )    )FileSystemStorageNc                  C   s   dd l } dd l}d}g d}g d}|| }| |}| |}|| }t|d D ](}	|| | }|d|}
| |
 qTd}|
D ]}	||	 }q|S )Nr   B   )
0123456789)abcdefghijkmnopqrstuvwxyz   r!    )randomarraychoicerangeshuffle)r)   r*   MAX_LENDIGITSLOCASE_CHARACTERSCOMBINED_LIST
rand_digit
rand_lower	temp_passr$   temp_pass_listtoken r7   5/var/www/html/Sam_Eipo/Eipo/customer_api/functions.pygernateToken   s"    


r9   c                  C   s4   d} d}t dD ]}|| tt d  7 }q|S )zFunction for gernate otp
0123456789r(   r'   
   )r,   mathfloorr)   )digitsOTPr   r7   r7   r8   
GernateOTP   s
    r@   c                     sp   dd l  dd ld fddtdD } | d fddtdD 7 } t| } | d|}|S )Nr   r(   c                 3   s   | ]}  jV  qd S N)r+   ascii_letters.0r$   r)   stringr7   r8   	<genexpr>"       z/randomStringFunctionForImage.<locals>.<genexpr>   c                 3   s   | ]}  jV  qd S rA   )r+   r>   rC   rE   r7   r8   rG   #   rH   r'   )r)   rF   joinr,   listr-   )str1sam_listfinalStringr7   rE   r8   randomStringFunctionForImage    s    "

rO   c                 C   sV   d}t |d}d}tj| jd }t }t|t| }||| }t|d | S )Nzmedia/customer_profilelocation   /r   ospathsplitextnamerO   strsaveimagefullPathfs	fullPath2filetypetheNametheImageNamefilenamer7   r7   r8   uploadTheProfile)   s    
rd   c                 C   sV   d}t |d}d}tj| jd }t }t|t| }||| }t|d | S )Nzmedia/recipetrP   rR   rS   rT   r[   r7   r7   r8   uploadTheRecipet4   s    
re   c                 C   sV   d}t |d}d}tj| jd }t }t|t| }||| }t|d | S )Nzmedia/contractsrP   rR   rS   rT   r[   r7   r7   r8   uploadTheContracts>   s    
rf   )django.core.files.storager   rU   r<   r)   pytzrF   r9   r@   rO   rd   re   rf   r7   r7   r7   r8   <module>   s    	
