« first day (2833 days earlier)      last day (533 days later) » 

2:05 AM
I know this is a ruby question, but anyone?
 
 
2 hours later…
4:22 AM
1 message moved from Python
 
 
2 hours later…
6:13 AM
services/service_register.py

from backened.dto.user_schema import UserSchema
from backened.sql.queries import CONST_INSERT, engine, conn
from sqlalchemy.sql import text
from werkzeug.security import generate_password_hash
from backened.validator.validation import validate_data, dump_data
import uuid
from flask import jsonify, make_response
import sqlalchemy


def service_register():
print("into register")
data_dict = validate_data()
print("dict:", data_dict)
user_name = data_dict['user_name']
print(user_name)
 
 
2 hours later…
7:44 AM
1 message moved from Python
 
 
1 hour later…
9:02 AM
how to return responses created in a function of A.py to return the same response in a function created in B.py


service_register.py
`
try:
sql = text(CONST_INSERT)
data = ({"user_name": user_name, "password": password,
"email_address": email_address, "dob": dob, "address": address, "uid": uid})
print(sql)
conn.execute(sql, data)

return jsonify({'Message': 'New user Created'})

except sqlalchemy.exc.IntegrityError:
return make_response({'message':'User already exist with this email address!'}, 409)
`
def validate_data():
    try:
        request_data = request.get_json()
        print("data", request_data)
        data = user_schema.load(request.get_json())
        return data
    except ValidationError as errors:
        raise ValueError(errors.messages)


def dump_data(data):
    return user_schema.dump(data)
`
here is my validation.py
suppose if I create user with len < 5 it is giving me validation error but not getting the response as a message
before restructuring my project I've done this process in a single app.py but now I'm restructuring and want to return the same error response.

`
<!doctype html>
<html lang=en>

<head>
	<title>ValueError: {'user_name': ['Shorter than minimum length 5.']}
		// Werkzeug Debugger</title>
	<link rel="stylesheet" href="?__debugger__=yes&amp;cmd=resource&amp;f=style.css">
	<link rel="shortcut icon" href="?__debugger__=yes&amp;cmd=resource&amp;f=console.png">
	<script src="?__debugger__=yes&amp;cmd=resource&amp;f=debugger.js"></script>
 
 
5 hours later…
1:48 PM
Yeah, that's what I'm doing. However, how should I name things?

"platform/core/process.py"

class Process:

"platform/win/process.py"

class WindowsProcess(Process):

"platform/linux/process.py"

class LinuxProcess(Process):



What I have:

"platform/__init__.py"

if platform.system() == "Windows":
    from platform.win.process import WindowsProcess
    Process = WindowsProcess
elif platform.system() == "Linux":
    from platform.linux.process import LinuxProcess
    Process = LinuxProcess

What I want (so the name is always "Process"):
 
1 message moved from Python
4 messages moved from Python
1 message moved from Python
 
 
1 hour later…
2:53 PM
I'm trying to simplify this:

for x in y:
for y in z:
for l in a:
for b in c:
(Do this)
 
3:16 PM
1 message moved from Python
 

« first day (2833 days earlier)      last day (533 days later) »